fixes #147 NHibernate 5 support

This commit is contained in:
Marko Lahma
2018-09-30 18:08:41 +03:00
parent a2af8c023e
commit bf8240936a
88 changed files with 2140 additions and 1851 deletions

View File

@@ -3,7 +3,7 @@
xmlns:db="http://www.springframework.net/database">
<db:provider id="dbProvider"
provider="SqlServer-1.1"
provider="System.Data.SqlClient"
connectionString="Data Source=SPRINGQA;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
<object id="transactionManager" type="Spring.Data.Core.AdoPlatformTransactionManager, Spring.Data">

View File

@@ -11,7 +11,7 @@
-->
<db:provider id="DbProvider"
provider="SqlServer-1.1"
provider="System.Data.SqlClient"
connectionString="Data Source=SPRINGQA;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
<object id="adoTransactionManager"
type="Spring.Data.Core.AdoPlatformTransactionManager, Spring.Data">

View File

@@ -16,7 +16,7 @@ namespace Spring.Data.NHibernate.Bytecode
static AbstractInjectableUserTypeFixture()
{
XmlConfigurator.Configure();
//XmlConfigurator.Configure();
}
/// <summary>

View File

@@ -1,6 +1,7 @@
using System.Data;
using System.Data.Common;
using NHibernate;
using NHibernate.Engine;
using NHibernate.SqlTypes;
using NHibernate.UserTypes;
@@ -15,9 +16,31 @@ namespace Spring.Data.NHibernate.Bytecode
this.delimiter = delimiter;
}
#if NH_5
public object NullSafeGet(DbDataReader rs, string[] names, ISessionImplementor session, object owner)
{
string resultString = (string) NHibernateUtil.String.NullSafeGet(rs, names[0], session);
if (resultString != null)
return delimiter.Delimit(resultString);
return null;
}
public void NullSafeSet(DbCommand cmd, object value, int index, ISessionImplementor session)
{
if (value == null)
{
NHibernateUtil.String.NullSafeSet(cmd, null, index, session);
return;
}
value = delimiter.Delimit((string) value);
NHibernateUtil.String.NullSafeSet(cmd, value, index, session);
}
#else
public object NullSafeGet(IDataReader rs, string[] names, object owner)
{
string resultString = (string)NHibernateUtil.String.NullSafeGet(rs, names[0]);
string resultString = (string) NHibernateUtil.String.NullSafeGet(rs, names[0]);
if (resultString != null)
return delimiter.Delimit(resultString);
return null;
@@ -31,15 +54,16 @@ namespace Spring.Data.NHibernate.Bytecode
return;
}
value = delimiter.Delimit((string)value);
value = delimiter.Delimit((string) value);
NHibernateUtil.String.NullSafeSet(cmd, value, index);
}
#endif
public object DeepCopy(object value)
{
if (value == null) return null;
return string.Copy((string)value);
return string.Copy((string) value);
}
public object Replace(object original, object target, object owner)
@@ -57,23 +81,11 @@ namespace Spring.Data.NHibernate.Bytecode
return DeepCopy(value);
}
public SqlType[] SqlTypes
{
get
{
return new SqlType[] { new SqlType(DbType.String) };
}
}
public SqlType[] SqlTypes => new[] {new SqlType(DbType.String)};
public System.Type ReturnedType
{
get { return typeof(string); }
}
public System.Type ReturnedType => typeof(string);
public bool IsMutable
{
get { return false; }
}
public bool IsMutable => false;
public new bool Equals(object x, object y)
{
@@ -86,4 +98,4 @@ namespace Spring.Data.NHibernate.Bytecode
return x.GetHashCode();
}
}
}
}

View File

@@ -1,7 +1,7 @@
#region License
/*
* Copyright <EFBFBD> 2002-2011 the original author or authors.
* Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,12 +62,10 @@ namespace Spring.Data.NHibernate
[Test]
public void DbProviderTranslation()
{
ISessionFactory sf = ctx["SessionFactory"] as ISessionFactory;
IDbProvider dbProvider = SessionFactoryUtils.GetDbProvider(sf);
Assert.IsTrue(dbProvider.DbMetadata.ProductName.Contains("Microsoft SQL Server, provider"));
Assert.IsTrue(dbProvider.DbMetadata.ProductName.Contains("in framework .NET"));
Assert.That(dbProvider.DbMetadata.ProductName, Does.Contain("Microsoft SQL Server"));
}
[Test]

View File

@@ -32,6 +32,12 @@ using Spring.Support;
using Spring.Transaction;
using Spring.Transaction.Support;
#if NH_5
using IDbConnection = System.Data.Common.DbConnection;
#else
using IDbConnection = System.Data.IDbConnection;
#endif
namespace Spring.Data.NHibernate
{
/// <summary>

View File

@@ -1,72 +0,0 @@
<?xml version="1.0" ?>
<project name="Spring.Data.NHibernate3.Integration.Tests" default="test" xmlns="http://nant.sf.net/schemas/nant.xsd">
<!--
Required properties:
* current.bin.dir - (path) root level to build to
* current.build.debug - (true|false) debug build?
* current.build.defines.csc - framework-specific build defines for C# compiler
-->
<include buildfile="${spring.basedir}/CopyLibToBinHelpers.include"/>
<target name="build">
<!-- build Spring.Data.NHibernate3.Integration.Tests -->
<call target="copycommonlogginglibtobin" />
<call target="copynh3libtobin" />
<csc target="library" define="${current.build.defines.csc}"
warnaserror="true"
optimize="${build.optimize}"
debug="${current.build.debug}"
output="${current.bin.dir}/${project::get-name()}.dll"
doc="${current.bin.dir}/${project::get-name()}.xml"
nostdlib="true"
noconfig="true"
>
<nowarn>
<warning number="${nowarn.numbers.test}" />
</nowarn>
<sources failonempty="true">
<include name="**/*.cs" />
<include name="../CommonAssemblyInfo.cs" />
</sources>
<references>
<include name="mscorlib.dll"/>
<include name="Microsoft.CSharp.dll"/>
<include name="System.dll"/>
<include name="System.Core.dll"/>
<include name="System.Data.dll" />
<include name="System.EnterpriseServices.dll" />
<include name="${current.bin.dir}/Common.Logging.dll"/>
<include name="${current.bin.dir}/Common.Logging.Core.dll"/>
<include name="${current.bin.dir}/log4net.dll"/>
<include name="${current.bin.dir}/Spring.Core.dll" />
<include name="${current.bin.dir}/Spring.Aop.dll" />
<include name="${current.bin.dir}/Spring.Data.dll" />
<include name="${current.bin.dir}/Spring.Data.NHibernate3.dll" />
<include name="${nh3.lib.dir}/NHibernate.dll"/>
<include name="${iesi3.lib.dir}/Iesi.Collections.dll"/>
<include name="${nunit.lib.dir}/nunit.framework.dll"/>
</references>
<resources prefix="Spring" dynamicprefix="true" failonempty="true">
<include name="**/*.xml" />
</resources>
</csc>
<copy file="${project::get-base-directory()}/${project::get-name()}.dll.config"
tofile="${current.bin.dir}/${project::get-name()}.dll.config"/>
</target>
<target name="test" depends="build">
<!-- skipping running of tests for now
<nunit2outproc>
<formatter type="Plain" />
<formatter type="Xml" usefile="true" extension=".xml"
outputdir="${current.bin.dir}/results" />
<test assemblyname="${current.bin.dir}/${project::get-name()}.dll" />
</nunit2outproc>
-->
</target>
</project>

View File

@@ -1,89 +0,0 @@
<?xml version="1.0" ?>
<project name="Spring.Data.NHibernate3.Tests" default="build" xmlns="http://nant.sf.net/schemas/nant.xsd">
<include buildfile="${spring.basedir}/common-project.include" />
<!--
Required properties:
* current.bin.dir - (path) root level to build to
* build.debug - (true|false) debug build?
* current.build.defines.csc - framework-specific build defines
-->
<include buildfile="${spring.basedir}/CopyLibToBinHelpers.include"/>
<target name="build">
<call target="copycommonlogginglibtobin" />
<call target="copynh3libtobin" />
<csc target="library" define="${current.build.defines.csc}"
warnaserror="true"
optimize="${build.optimize}"
debug="${current.build.debug}"
output="${current.bin.dir}/${project::get-name()}.dll"
doc="${current.bin.dir}/${project::get-name()}.xml"
nostdlib="true"
noconfig="true"
>
<nowarn>
<warning number="${nowarn.numbers.test}" />
</nowarn>
<sources failonempty="true">
<include name="../Spring.Data.NHibernate.Tests/**/*.cs" />
<include name="../CommonAssemblyInfo.cs" />
</sources>
<references>
<include name="mscorlib.dll"/>
<include name="Microsoft.CSharp.dll"/>
<include name="System.dll"/>
<include name="System.Core.dll"/>
<include name="System.Data.dll" />
<include name="System.EnterpriseServices.dll" />
<include name="${current.bin.dir}/Common.Logging.dll"/>
<include name="${current.bin.dir}/Common.Logging.Core.dll"/>
<include name="${current.bin.dir}/Spring.Core.dll" />
<include name="${current.bin.dir}/Spring.Aop.dll" />
<include name="${current.bin.dir}/Spring.Data.dll" />
<include name="${current.bin.dir}/Spring.Data.NHibernate3.dll" />
<include name="${current.bin.dir}/Spring.Core.Tests.dll" />
<include name="${current.bin.dir}/Spring.Data.Tests.dll" />
<include name="${nh3.lib.dir}/NHibernate.dll"/>
<include name="${iesi3.lib.dir}/Iesi.Collections.dll"/>
<include name="${nunit.lib.dir}/nunit.framework.dll"/>
<include name="${current.bin.dir}/Rhino.Mocks.dll"/>
</references>
<resources prefix="Spring" dynamicprefix="true" failonempty="true">
<include name="**/*.xml" />
</resources>
</csc>
<copy file="${project::get-base-directory()}/${project::get-name()}.dll.config"
tofile="${current.bin.dir}/${project::get-name()}.dll.config"/>
<!-- copy nh libs -->
<copy todir="${current.bin.dir}" overwrite="true">
<fileset basedir="${nh3.lib.dir}">
<include name="**/*.dll" />
</fileset>
</copy>
</target>
<target name="test" depends="build">
<!-- property name="test.assemblyname" value="${project::get-name()}" / -->
<call target="common.run-tests" />
</target>
<!--
<target name="test" depends="build">
<nunit2outproc>
<formatter type="Plain" />
<formatter type="Xml" usefile="true" extension=".xml"
outputdir="${current.bin.dir}/results" />
<test assemblyname="${current.bin.dir}/${project::get-name()}.dll"
appconfig="${current.bin.dir}/${project::get-name()}.dll.config" />
</nunit2outproc>
</target>
-->
</project>

View File

@@ -1,74 +0,0 @@
<?xml version="1.0" ?>
<project name="Spring.Data.NHibernate4.Integration.Tests" default="test" xmlns="http://nant.sf.net/schemas/nant.xsd">
<!--
Required properties:
* current.bin.dir - (path) root level to build to
* current.build.debug - (true|false) debug build?
* current.build.defines.csc - framework-specific build defines for C# compiler
-->
<include buildfile="${spring.basedir}/CopyLibToBinHelpers.include"/>
<target name="build">
<!-- build Spring.Data.NHibernate4.Integration.Tests -->
<call target="copycommonlogginglibtobin" />
<call target="copynh4libtobin" />
<csc target="library" define="${current.build.defines.csc}"
warnaserror="true"
optimize="${build.optimize}"
debug="${current.build.debug}"
output="${current.bin.dir}/${project::get-name()}.dll"
doc="${current.bin.dir}/${project::get-name()}.xml"
nostdlib="true"
noconfig="true"
>
<nowarn>
<warning number="${nowarn.numbers.test}" />
</nowarn>
<sources failonempty="true">
<include name="**/*.cs" />
<include name="../CommonAssemblyInfo.cs" />
</sources>
<references>
<include name="mscorlib.dll"/>
<include name="Microsoft.CSharp.dll"/>
<include name="System.dll"/>
<include name="System.Core.dll"/>
<include name="System.Data.dll" />
<include name="System.EnterpriseServices.dll" />
<include name="${current.bin.dir}/Common.Logging.dll"/>
<include name="${current.bin.dir}/Common.Logging.Core.dll"/>
<include name="${current.bin.dir}/log4net.dll"/>
<include name="${current.bin.dir}/Spring.Core.dll" />
<include name="${current.bin.dir}/Spring.Aop.dll" />
<include name="${current.bin.dir}/Spring.Data.dll" />
<include name="${current.bin.dir}/Spring.Data.NHibernate4.dll" />
<include name="${nh4.lib.dir}/NHibernate.dll"/>
<include name="${iesi4.lib.dir}/Iesi.Collections.dll"/>
<include name="${nunit.lib.dir}/nunit.framework.dll"/>
</references>
<resources prefix="Spring" dynamicprefix="true" failonempty="true">
<include name="**/*.xml" />
</resources>
</csc>
<copy file="${project::get-base-directory()}/${project::get-name()}.dll.config"
tofile="${current.bin.dir}/${project::get-name()}.dll.config"/>
</target>
<target name="test" depends="build">
<!-- skipping running of tests for now
<nunit2outproc>
<formatter type="Plain" />
<formatter type="Xml" usefile="true" extension=".xml"
outputdir="${current.bin.dir}/results" />
<test assemblyname="${current.bin.dir}/${project::get-name()}.dll" />
</nunit2outproc>
-->
</target>
</project>

View File

@@ -1,76 +0,0 @@
<?xml version="1.0" ?>
<project name="Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests" default="test" xmlns="http://nant.sf.net/schemas/nant.xsd">
<!--
Required properties:
* current.bin.dir - (path) root level to build to
* current.build.debug - (true|false) debug build?
* current.build.defines.csc - framework-specific build defines for C# compiler
-->
<include buildfile="${spring.basedir}/common-project.include" />
<include buildfile="${spring.basedir}/CopyLibToBinHelpers.include"/>
<target name="build">
<call target="copycommonlogginglibtobin" />
<call target="copynh4libtobin" />
<!-- build Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests -->
<csc target="library" define="${current.build.defines.csc}"
warnaserror="true"
optimize="${build.optimize}"
debug="${current.build.debug}"
output="${current.bin.dir}/${project::get-name()}.dll"
doc="${current.bin.dir}/${project::get-name()}.xml"
nostdlib="true"
noconfig="true"
>
<nowarn>
<warning number="${nowarn.numbers.test}" />
</nowarn>
<sources failonempty="true">
<include name="**/*.cs" />
<include name="../CommonAssemblyInfo.cs" />
</sources>
<references>
<include name="mscorlib.dll"/>
<include name="Microsoft.CSharp.dll"/>
<include name="System.dll"/>
<include name="System.Core.dll"/>
<include name="System.Data.dll" />
<include name="System.EnterpriseServices.dll" />
<include name="System.Transactions.dll" />
<include name="System.Xml.dll" />
<include name="System.Xml.Linq.dll" />
<include name="${current.bin.dir}/Common.Logging.dll"/>
<include name="${current.bin.dir}/Common.Logging.Core.dll"/>
<include name="${current.bin.dir}/Spring.Core.dll" />
<include name="${current.bin.dir}/Spring.Aop.dll" />
<include name="${current.bin.dir}/Spring.Data.dll" />
<include name="${current.bin.dir}/Spring.Data.NHibernate4.dll" />
<include name="${current.bin.dir}/Spring.Testing.NUnit.dll" />
<include name="${nh4.lib.dir}/NHibernate.dll"/>
<include name="${iesi4.lib.dir}/Iesi.Collections.dll"/>
<include name="${nunit.lib.dir}/nunit.framework.dll"/>
</references>
<resources prefix="Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests" dynamicprefix="true" failonempty="true">
<include name="**/*.xml" />
</resources>
</csc>
<!--<copy file="${project::get-base-directory()}/${project::get-name()}.dll.config"
tofile="${current.bin.dir}/${project::get-name()}.dll.config"/> -->
<copy file="${project::get-base-directory()}/app.config"
tofile="${current.bin.dir}/${project::get-name()}.dll.config"/>
</target>
<target name="test" depends="build">
<!-- property name="test.assemblyname" value="${project::get-name()}" / -->
<call target="common.run-tests" />
</target>
</project>

View File

@@ -1,89 +0,0 @@
<?xml version="1.0" ?>
<project name="Spring.Data.NHibernate4.Tests" default="build" xmlns="http://nant.sf.net/schemas/nant.xsd">
<include buildfile="${spring.basedir}/common-project.include" />
<!--
Required properties:
* current.bin.dir - (path) root level to build to
* build.debug - (true|false) debug build?
* current.build.defines.csc - framework-specific build defines
-->
<include buildfile="${spring.basedir}/CopyLibToBinHelpers.include"/>
<target name="build">
<call target="copycommonlogginglibtobin" />
<call target="copynh4libtobin" />
<csc target="library" define="${current.build.defines.csc},NH_4_0"
warnaserror="true"
optimize="${build.optimize}"
debug="${current.build.debug}"
output="${current.bin.dir}/${project::get-name()}.dll"
doc="${current.bin.dir}/${project::get-name()}.xml"
nostdlib="true"
noconfig="true"
>
<nowarn>
<warning number="${nowarn.numbers.test}" />
</nowarn>
<sources failonempty="true">
<include name="../Spring.Data.NHibernate.Tests/**/*.cs" />
<include name="../CommonAssemblyInfo.cs" />
</sources>
<references>
<include name="mscorlib.dll"/>
<include name="Microsoft.CSharp.dll"/>
<include name="System.dll"/>
<include name="System.Core.dll"/>
<include name="System.Data.dll" />
<include name="System.EnterpriseServices.dll" />
<include name="${current.bin.dir}/Common.Logging.dll"/>
<include name="${current.bin.dir}/Common.Logging.Core.dll"/>
<include name="${current.bin.dir}/Spring.Core.dll" />
<include name="${current.bin.dir}/Spring.Aop.dll" />
<include name="${current.bin.dir}/Spring.Data.dll" />
<include name="${current.bin.dir}/Spring.Data.NHibernate4.dll" />
<include name="${current.bin.dir}/Spring.Core.Tests.dll" />
<include name="${current.bin.dir}/Spring.Data.Tests.dll" />
<include name="${nh4.lib.dir}/NHibernate.dll"/>
<include name="${iesi4.lib.dir}/Iesi.Collections.dll"/>
<include name="${nunit.lib.dir}/nunit.framework.dll"/>
<include name="${current.bin.dir}/Rhino.Mocks.dll"/>
</references>
<resources prefix="Spring" dynamicprefix="true" failonempty="true">
<include name="**/*.xml" />
</resources>
</csc>
<copy file="${project::get-base-directory()}/${project::get-name()}.dll.config"
tofile="${current.bin.dir}/${project::get-name()}.dll.config"/>
<!-- copy nh libs -->
<copy todir="${current.bin.dir}" overwrite="true">
<fileset basedir="${nh4.lib.dir}">
<include name="**/*.dll" />
</fileset>
</copy>
</target>
<target name="test" depends="build">
<!-- property name="test.assemblyname" value="${project::get-name()}" / -->
<call target="common.run-tests" />
</target>
<!--
<target name="test" depends="build">
<nunit2outproc>
<formatter type="Plain" />
<formatter type="Xml" usefile="true" extension=".xml"
outputdir="${current.bin.dir}/results" />
<test assemblyname="${current.bin.dir}/${project::get-name()}.dll"
appconfig="${current.bin.dir}/${project::get-name()}.dll.config" />
</nunit2outproc>
</target>
-->
</project>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
<sectionGroup name="spring">
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core" />
</sectionGroup>
</configSections>
<common>
<logging>
<factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
<arg key="level" value="WARN" />
</factoryAdapter>
</logging>
</common>
<!--
<common>
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net129">
<arg key="configType" value="EXTERNAL" />
</factoryAdapter>
</logging>
</common>
-->
<spring>
<parsers>
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data" />
</parsers>
</spring>
</configuration>

View File

@@ -0,0 +1,4 @@
using System.Reflection;
[assembly: AssemblyTitle("Spring.Data.NHibernate5 Integration Tests")]
[assembly: AssemblyDescription("Integration tests for Spring.Data.NHibernate5 assembly")]

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="uNhAddIns.Adapters.CommonTests"
namespace="uNhAddIns.Adapters.CommonTests.EnhancedBytecodeProvider">
<typedef name="SpecialString"
class="InjectableStringUserType"/>
<class name ="Foo">
<id type="int">
<generator class="hilo"/>
</id>
<property name="Description" type="SpecialString" />
</class>
</hibernate-mapping>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Spring.Data.NHibernate.Credit, Spring.Data.NHibernate5.Integration.Tests"
table="Credits" lazy="false">
<id name="CreditID" column="CreditID" type="Int32">
<generator class="identity" />
</id>
<property name="Amount" column="CreditAmount"/>
</class>
</hibernate-mapping>

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns='http://www.springframework.net'
xmlns:db="http://www.springframework.net/database"
xmlns:tx="http://www.springframework.net/tx">
<object id="transactionManager"
type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate5">
<!-- Comment out DbProvider if you want to have the tx mgr infer the DbProvider from
the session factory. -->
<!-- Set the DbProvider explicitly if you would like to have ADO.NET and NHibernate
operations take place within the same transaction. -->
<!--
<property name="DbProvider" ref="DbProvider"/>
-->
<property name="SessionFactory" ref="SessionFactory"/>
</object>
<db:provider id="DbProvider"
provider="System.Data.SqlClient"
connectionString="Data Source=SPRINGQA;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate5">
<property name="DbProvider" ref="DbProvider"/>
<property name="MappingAssemblies">
<list>
<value>Spring.Data.NHibernate5.Integration.Tests</value>
</list>
</property>
<property name="HibernateProperties">
<dictionary>
<entry key="connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
<entry key="dialect"
value="NHibernate.Dialect.MsSql2000Dialect"/>
<entry key="connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"/>
</dictionary>
</property>
<!-- provides integation with Spring's declarative transaction management features -->
<property name="ExposeTransactionAwareSessionFactory" value="true" />
</object>
<!-- DAOs -->
<object id="AccountCreditDao" type="Spring.Data.NHibernate.AccountCreditDao">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
<object id="AccountDebitDao" type="Spring.Data.NHibernate.AccountDebitDao">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
<object id="AuditDao" type="Spring.Data.NHibernate.AuditDao">
<property name="DbProvider" ref="DbProvider"/>
</object>
</objects>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Spring.Data.NHibernate.Debit, Spring.Data.NHibernate5.Integration.Tests"
table="Debits" lazy="false">
<id name="DebitID" column="DebitID" type="Int32">
<generator class="identity" />
</id>
<property name="Amount" column="DebitAmount"/>
</class>
</hibernate-mapping>

View File

@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns='http://www.springframework.net'
xmlns:db="http://www.springframework.net/database">
<db:provider id="DbProvider1"
provider="System.Data.SqlClient"
connectionString="Data Source=(local);Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
<db:provider id="DbProvider2"
provider="System.Data.SqlClient"
connectionString="Data Source=(local);Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
<object id="SessionFactory1" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate5">
<property name="DbProvider" ref="DbProvider1"/>
<property name="MappingAssemblies">
<list>
<value>Spring.Data.NHibernate5.Integration.Tests</value>
</list>
</property>
<property name="HibernateProperties">
<dictionary>
<entry key="connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
<entry key="dialect"
value="NHibernate.Dialect.MsSql2000Dialect"/>
<entry key="connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"/>
</dictionary>
</property>
</object>
<object id="SessionFactory2" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate5">
<property name="DbProvider" ref="DbProvider2"/>
<property name="MappingAssemblies">
<list>
<value>Spring.Data.NHibernate5.Integration.Tests</value>
</list>
</property>
<property name="HibernateProperties">
<dictionary>
<entry key="connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
<entry key="dialect"
value="NHibernate.Dialect.MsSql2000Dialect"/>
<entry key="connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"/>
</dictionary>
</property>
</object>
<object id="transactionManager"
type="Spring.Data.Core.TxScopeTransactionManager, Spring.Data">
</object>
<object id="AccountCreditDao" type="Spring.Data.NHibernate.AccountCreditDao, Spring.Data.NHibernate5.Integration.Tests">
<property name="SessionFactory" ref="SessionFactory1"/>
</object>
<object id="AccountDebitDao" type="Spring.Data.NHibernate.AccountDebitDao, Spring.Data.NHibernate5.Integration.Tests">
<property name="SessionFactory" ref="SessionFactory2"/>
</object>
<!-- The DAO object that performs multiple data access operations -->
<object id="accountManagerTarget"
type="Spring.Data.NHibernate.AccountManager, Spring.Data.NHibernate5.Integration.Tests">
<property name="AccountCreditDao" ref="AccountCreditDao"/>
<property name="AccountDebitDao" ref="AccountDebitDao"/>
<!--
<property name="AuditDao" ref="AuditDao"/>
-->
<!--
<property name="ThrowException" value="true"/>
-->
<!--
<property name="ThrowExceptionAtEnd" value="true"/>
-->
</object>
<!-- construct the transaction proxy based on [Transaction()] in DAO class -->
<!-- todo condense this xml for attribute usage for ease of use -->
<!--
<aop:transaction name=testObjectDao"
target="NHTestObjectDao"
interfaces="Spring.NHibernate.ITestObjectDao"
transactionManager="hibernateTransactionManager"/>
-->
<!-- Transactional Proxy for TestObjectManager using the ProxyFactoryObject -->
<object id="accountManager"
type="Spring.Aop.Framework.ProxyFactoryObject, Spring.Aop">
<property name="Target" ref="accountManagerTarget"/>
<property name="InterceptorNames">
<value>transactionInterceptor</value>
</property>
</object>
<!-- Transaction Interceptor based on attribute [Transaction()] -->
<object id="transactionInterceptor"
type="Spring.Transaction.Interceptor.TransactionInterceptor, Spring.Data">
<property name="TransactionManager" ref="transactionManager"/>
<!-- note do not have converter from string to this property type registered -->
<property name="TransactionAttributeSource">
<object type="Spring.Transaction.Interceptor.AttributesTransactionAttributeSource, Spring.Data"/>
</property>
</object>
</objects>

View File

@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns='http://www.springframework.net'
xmlns:db="http://www.springframework.net/database">
<db:provider id="DbProvider"
provider="System.Data.SqlClient"
connectionString="Data Source=(local);Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
<!--
<db:provider id="DbProvider"
provider="System.Data.SqlClient"
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=CreditsAndDebits;User ID=springqa;Password=springqa"/>
-->
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate5">
<property name="DbProvider" ref="DbProvider"/>
<property name="MappingAssemblies">
<list>
<value>Spring.Data.NHibernate5.Integration.Tests</value>
</list>
</property>
<property name="HibernateProperties">
<dictionary>
<entry key="connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
<entry key="dialect"
value="NHibernate.Dialect.MsSql2000Dialect"/>
<entry key="connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"/>
<!--
<entry key="proxyfactory.factory_class"
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
-->
</dictionary>
</property>
</object>
<object id="AccountCreditDao" type="Spring.Data.NHibernate.AccountCreditDao, Spring.Data.NHibernate5.Integration.Tests">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
<object id="AccountDebitDao" type="Spring.Data.NHibernate.AccountDebitDao, Spring.Data.NHibernate5.Integration.Tests">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
<object id="AuditDao" type="Spring.Data.NHibernate.AuditDao, Spring.Data.NHibernate5.Integration.Tests">
<property name="DbProvider" ref="DbProvider"/>
</object>
<!-- The DAO object that performs multiple data access operations -->
<object id="accountManagerTarget"
type="Spring.Data.NHibernate.AccountManager, Spring.Data.NHibernate5.Integration.Tests">
<property name="AccountCreditDao" ref="AccountCreditDao"/>
<property name="AccountDebitDao" ref="AccountDebitDao"/>
<!--
<property name="AuditDao" ref="AuditDao"/>
-->
<!--
<property name="ThrowException" value="true"/>
-->
<!--
<property name="ThrowExceptionAtEnd" value="true"/>
-->
</object>
<object id="hibernateTransactionManager"
type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate5">
<!-- Comment out DbProvider if you want to have the tx mgr infer the DbProvider from
the session factory. -->
<!-- Set the DbProvider explicitly if you would like to have ADO.NET and NHibernate
operations take place within the same transaction. -->
<property name="DbProvider" ref="DbProvider"/>
<property name="sessionFactory" ref="SessionFactory"/>
</object>
<!-- construct the transaction proxy based on [Transaction()] in DAO class -->
<!-- todo condense this xml for attribute usage for ease of use -->
<!--
<aop:transaction name=testObjectDao"
target="NHTestObjectDao"
interfaces="Spring.NHibernate.ITestObjectDao"
transactionManager="hibernateTransactionManager"/>
-->
<!-- Transactional Proxy for TestObjectManager using the ProxyFactoryObject -->
<object id="accountManager"
type="Spring.Aop.Framework.ProxyFactoryObject, Spring.Aop">
<property name="Target" ref="accountManagerTarget"/>
<property name="InterceptorNames">
<value>transactionInterceptor</value>
</property>
</object>
<!-- Transaction Interceptor based on attribute [Transaction()] -->
<object id="transactionInterceptor"
type="Spring.Transaction.Interceptor.TransactionInterceptor, Spring.Data">
<property name="TransactionManager" ref="hibernateTransactionManager"/>
<!-- note do not have converter from string to this property type registered -->
<property name="TransactionAttributeSource">
<object type="Spring.Transaction.Interceptor.AttributesTransactionAttributeSource, Spring.Data"/>
</property>
</object>
</objects>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Spring.Data.NHibernate.TestObject, Spring.Data.NHibernate5.Integration.Tests" table="TestObjects">
<id name="ObjectNumber" column="TestObjectNo" type="Int32">
<generator class="identity" />
<!--
<generator class="sequence">
<param name="sequence">ID_SEQ</param>
</generator>
-->
</id>
<property name="Age" column="Age" type="Int32"/>
<property name="Name" type="String" length="50"/>
</class>
</hibernate-mapping>

View File

@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns='http://www.springframework.net'
xmlns:db="http://www.springframework.net/database">
<!--
<db:provider id="DbProvider"
provider="System.Data.SqlClient"
connectionString="Data Source=MARKT60\SQL2005;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
-->
<object id="DbProvider" type="Spring.Data.Common.UserCredentialsDbProvider, Spring.Data">
<property name="TargetDbProvider" ref="targetDbProvider"/>
<property name="Username" value="User ID=springqa"/>
<property name="Password" value="Password=springqa"/>
</object>
<db:provider id="targetDbProvider"
provider="System.Data.SqlClient"
connectionString="Data Source=(local);Database=Spring;Trusted_Connection=False"/>
<db:provider id="standardDbProvider"
provider="System.Data.SqlClient"
connectionString="Data Source=(local);Database=Spring;Trusted_Connection=False;User ID=springqa;Password=springqa"/>
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate5">
<property name="DbProvider" ref="DbProvider"/>
<property name="MappingResources">
<list>
<value>assembly://Spring.Data.NHibernate5.Integration.Tests/Spring.Data.NHibernate/TestObject.hbm.xml</value>
</list>
</property>
<!--
<property name="MappingAssemblies">
<list>
<value>Spring.Data.NHibernate.Integration.Tests</value>
</list>
</property>
-->
<property name="HibernateProperties">
<dictionary>
<!-- use connection provided by DbProvider
<entry key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
-->
<entry key="dialect"
value="NHibernate.Dialect.MsSql2000Dialect"/>
<entry key="connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"/>
<!--
<entry key="hibernate.dialect"
value="NHibernate.Dialect.Oracle9Dialect"/>
-->
<!--
<entry key="proxyfactory.factory_class"
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
-->
</dictionary>
</property>
</object>
<!--
<object id="nativeNHTestObjectDao" type="Spring.Data.NHibernate.NativeNHTestObjectDao, Spring.Data.NHibernate.Integration.Tests">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
<object id="NHTestObjectDao" type="Spring.Data.NHibernate.NHTestObjectDao, Spring.Data.NHibernate.Integration.Tests">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
-->
<object id="hibernateTransactionManager"
type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate5">
<property name="DbProvider" ref="DbProvider"/>
<property name="sessionFactory" ref="SessionFactory"/>
</object>
<!-- Transactional Proxy for TestObjectDao using the TransactionProxyFactory -->
<object id="testObjectDaoTransProxy"
type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject, Spring.Data">
<property name="PlatformTransactionManager" ref="hibernateTransactionManager"/>
<property name="Target">
<object type="Spring.Data.NHibernate.NHTestObjectDao, Spring.Data.NHibernate5.Integration.Tests">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
</property>
<property name="ProxyInterfaces" value="Spring.Data.NHibernate.ITestObjectDao"/>
<property name="TransactionAttributes">
<name-values>
<add key="Create*" value="PROPAGATION_REQUIRED"/>
<add key="Delete*" value="PROPAGATION_REQUIRED"/>
<add key="Update*" value="PROPAGATION_REQUIRED"/>
<add key="Find*" value="PROPAGATION_REQUIRED"/>
</name-values>
</property>
</object>
</objects>

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns='http://www.springframework.net'
xmlns:db="http://www.springframework.net/database">
<db:provider id="DbProvider"
provider="System.Data.SqlClient"
connectionString="Data Source=(local);Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
<!--
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=Spring;User ID=springqa; Password=springqa"/>
-->
<!--
<db:provider id="DbProvider"
provider="OracleODP-2.0"
connectionString="Data Source=AGORA; User Id=agora_user; Password=welcome_bad"/>
-->
<!--
<db:provider id="DbProvider"
provider="System.Data.SqlClient"
connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=Spring;User ID=springqa; Password=springqa"/>
-->
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate5">
<!-- TODO Provide dedicated NHibernate Schema -->
<property name="DbProvider" ref="DbProvider"/>
<property name="MappingResources">
<list>
<value>assembly://Spring.Data.NHibernate5.Integration.Tests/Spring.Data.NHibernate/TestObject.hbm.xml</value>
</list>
</property>
<!--
<property name="MappingAssemblies">
<list>
<value>Spring.Data.NHibernate.Integration.Tests</value>
</list>
</property>
-->
<property name="HibernateProperties">
<dictionary>
<!--
<entry key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
<entry key="hibernate.dialect"
value="NHibernate.Dialect.Oracle9Dialect"/>
-->
<entry key="dialect"
value="NHibernate.Dialect.MsSql2000Dialect"/>
<entry key="connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"/>
<!--
<entry key="proxyfactory.factory_class"
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
-->
</dictionary>
</property>
</object>
<object id="nativeNHTestObjectDao" type="Spring.Data.NHibernate.NativeNHTestObjectDao, Spring.Data.NHibernate5.Integration.Tests">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
<object id="NHTestObjectDao" type="Spring.Data.NHibernate.NHTestObjectDao, Spring.Data.NHibernate5.Integration.Tests">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
<object id="hibernateTransactionManager"
type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate5">
<property name="DbProvider" ref="DbProvider"/>
<property name="sessionFactory" ref="SessionFactory"/>
</object>
<!-- Transactional Proxy for TestObjectDao using transaction attributes -->
<object id="testObjectDaoViaTxAttributes"
type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject, Spring.Data">
<property name="PlatformTransactionManager" ref="hibernateTransactionManager"/>
<property name="Target">
<object type="Spring.Data.NHibernate.NHTestObjectDao">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
</property>
<property name="ProxyInterfaces" value="Spring.Data.NHibernate.ITestObjectDao"/>
<property name="TransactionAttributeSource">
<object type="Spring.Transaction.Interceptor.AttributesTransactionAttributeSource" />
</property>
</object>
<!-- Transactional Proxy for TestObjectDao using the TransactionProxyFactory -->
<object id="testObjectDaoTransProxy"
type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject, Spring.Data">
<property name="PlatformTransactionManager" ref="hibernateTransactionManager"/>
<property name="Target">
<object type="Spring.Data.NHibernate.NHTestObjectDao, Spring.Data.NHibernate5.Integration.Tests">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
</property>
<property name="ProxyInterfaces" value="Spring.Data.NHibernate.ITestObjectDao"/>
<property name="TransactionAttributes">
<name-values>
<add key="Create*" value="PROPAGATION_REQUIRED"/>
<add key="Delete*" value="PROPAGATION_REQUIRED"/>
<add key="Update*" value="PROPAGATION_REQUIRED"/>
<add key="Find*" value="PROPAGATION_REQUIRED"/>
</name-values>
</property>
</object>
</objects>

View File

@@ -0,0 +1,128 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
<DefineConstants>$(DefineConstants);NH_5</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\Spring\Spring.Aop\Spring.Aop.2010.csproj" />
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.2010.csproj" />
<ProjectReference Include="..\..\..\src\Spring\Spring.Data.NHibernate5\Spring.Data.NHibernate5.2010.csproj" />
<ProjectReference Include="..\..\..\src\Spring\Spring.Data\Spring.Data.2010.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="log4net" Version="$(Log4NetVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftTestSDKVersion)" />
<PackageReference Include="NUnit" Version="$(NUnitVersion)" />
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnitTestAdapterVersion)" />
<PackageReference Include="System.Data.SqlClient" Version="4.5.1" Condition=" '$(TargetFramework)' == 'netcoreapp2.1' " />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == '$(TargetFullFrameworkVersion)' ">
<Reference Include="System.Transactions" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountController.cs">
<Link>Data\NHibernate\AccountController.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountCreditDao.cs">
<Link>Data\NHibernate\AccountCreditDao.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountDebitDao.cs">
<Link>Data\NHibernate\AccountDebitDao.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AccountManager.cs">
<Link>Data\NHibernate\AccountManager.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\AuditDao.cs">
<Link>Data\NHibernate\AuditDao.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\AbstractInjectableUserTypeFixture.cs">
<Link>Data\Bytecode\AbstractInjectableUserTypeFixture.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\Foo.cs">
<Link>Data\Bytecode\Foo.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\IDelimiter.cs">
<Link>Data\Bytecode\IDelimiter.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\InjectableStringUserType.cs">
<Link>Data\Bytecode\InjectableStringUserType.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\InjectableUserTypeFixture.cs">
<Link>Data\Bytecode\InjectableUserTypeFixture.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Bytecode\Product.cs">
<Link>Data\Bytecode\Product.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Credit.cs">
<Link>Data\NHibernate\Credit.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\DbProviderTemplateTests.cs">
<Link>Data\NHibernate\DbProviderTemplateTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Debit.cs">
<Link>Data\NHibernate\Debit.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\HibernateTxScopeTransactionManagerTests.cs">
<Link>Data\NHibernate\HibernateTxScopeTransactionManagerTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountController.cs">
<Link>Data\NHibernate\IAccountController.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountCreditDao.cs">
<Link>Data\NHibernate\IAccountCreditDao.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountDebitDao.cs">
<Link>Data\NHibernate\IAccountDebitDao.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAccountManager.cs">
<Link>Data\NHibernate\IAccountManager.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\IAuditDao.cs">
<Link>Data\NHibernate\IAuditDao.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\ITestObjectDao.cs">
<Link>Data\NHibernate\ITestObjectDao.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\MultipleDbTests.cs">
<Link>Data\NHibernate\MultipleDbTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NativeNHTestObjectDao.cs">
<Link>Data\NHibernate\NativeNHTestObjectDao.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NativeNHTests.cs">
<Link>Data\NHibernate\NativeNHTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NHDAOTests.cs">
<Link>Data\NHibernate\NHDAOTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\NHTestObjectDao.cs">
<Link>Data\NHibernate\NHTestObjectDao.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\SimpleTestDao.cs">
<Link>Data\NHibernate\SimpleTestDao.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\TemplateTests.cs">
<Link>Data\NHibernate\TemplateTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\TestObject.cs">
<Link>Data\NHibernate\TestObject.cs</Link>
</Compile>
<None Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\creditdebit.sql">
<Link>Data\NHibernate\creditdebit.sql</Link>
</None>
<Content Include="Data\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\HibernateTxScopeTransactionManagerTests.xml">
<Link>Data\NHibernate\HibernateTxScopeTransactionManagerTests.xml</Link>
</Content>
<Content Include="Data\NHibernate\Bytecode\Foo.Spechbm.xml" />
<EmbeddedResource Include="Data\NHibernate\*.xml" />
<EmbeddedResource Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Controllers.xml">
<Link>Data\NHibernate\Controllers.xml</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\Spring.Data.NHibernate.Integration.Tests\Data\NHibernate\Services.xml">
<Link>Data\NHibernate\Services.xml</Link>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
<sectionGroup name="spring">
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core" />
</sectionGroup>
</configSections>
<!--
<common>
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net129">
<arg key="configType" value="EXTERNAL" />
</factoryAdapter>
</logging>
</common>
-->
<spring>
<parsers>
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data"/>
<parser type="Spring.Transaction.Config.TxNamespaceParser, Spring.Data" />
<parser type="Spring.Aop.Config.AopNamespaceParser, Spring.Aop" />
</parsers>
</spring>
</configuration>

View File

@@ -0,0 +1,4 @@
using System.Reflection;
[assembly: AssemblyTitle("Spring.Data.NHibernate5 Tests")]
[assembly: AssemblyDescription("Unit tests for Spring.Data.NHibernate5 assembly")]

View File

@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
xmlns:db="http://www.springframework.net/database"
xmlns:tx="http://www.springframework.net/tx">
<!-- Database and NHibernate Configuration -->
<db:provider id="DbProvider"
provider="System.Data.SqlClient"
connectionString="Data Source=(local);Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa;"/>
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate5">
<property name="DbProvider" ref="DbProvider"/>
<property name="MappingResources">
<list>
<value>assembly://Spring.Data.NHibernate5.Tests/Spring.Data.NHibernate/TestObject.hbm.xml</value>
</list>
</property>
<property name="HibernateProperties">
<dictionary>
<entry key="dialect"
value="NHibernate.Dialect.MsSql2000Dialect"/>
<entry key="connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"/>
<!--
<entry key="proxyfactory.factory_class"
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
-->
</dictionary>
</property>
</object>
<object id="TestObjectDao" type="Spring.Data.NHibernate.TestObjectDao, Spring.Data.NHibernate5.Tests">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
<object id="hibernateTransactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate5">
<property name="DbProvider" ref="DbProvider"/>
<property name="sessionFactory" ref="SessionFactory"/>
</object>
<object name="transactionManager" type="Spring.Transaction.CallCountingTransactionManager, Spring.Data.Tests"/>
<object name="SimpleService" type="Spring.Data.NHibernate.SimpleService, Spring.Data.NHibernate5.Tests">
<property name="TestObjectDao" ref="TestObjectDao"/>
</object>
<object id="loggingAroundAdvice" type="Spring.Data.LoggingAroundAdvice, Spring.Data.Tests"/>
<object id ="myAutoProxy" type="Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxyCreator">
<property name="InterceptorNames">
<list>
<value>loggingAroundAdvice</value>
</list>
</property>
<property name="ProxyTargetType" value="false"/>
<property name="ExposeProxy" value="false"/>
<property name="Optimize" value="false"/>
<property name="ObjectNames">
<list>
<value>TestObjectDao</value>
</list>
</property>
</object>
<tx:attribute-driven transaction-manager="transactionManager"/>
<!-- Transactional Proxy for TestObjectDao using the TransactionProxyFactory -->
<!--
<object id="testObjectDaoTransProxy"
type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject, Spring.Data">
<property name="PlatformTransactionManager" ref="transactionManager"/>
<property name="Target" ref="SimpleService"/>
<property name="ProxyInterfaces" value="Spring.Data.NHibernate.ISimpleService"/>
<property name="TransactionAttributes">
<name-values>
<add key="Create*" value="PROPAGATION_REQUIRED"/>
<add key="Delete*" value="PROPAGATION_REQUIRED"/>
<add key="Update*" value="PROPAGATION_REQUIRED"/>
<add key="Find*" value="PROPAGATION_REQUIRED"/>
</name-values>
</property>
</object>
-->
</objects>

View File

@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
xmlns:db="http://www.springframework.net/database"
xmlns:tx="http://www.springframework.net/tx"
xmlns:aop="http://www.springframework.net/aop">
<!-- Database and NHibernate Configuration -->
<db:provider id="DbProvider"
provider="System.Data.SqlClient"
connectionString="Data Source=(local);Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa;"/>
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate5">
<property name="DbProvider" ref="DbProvider"/>
<property name="MappingResources">
<list>
<value>assembly://Spring.Data.NHibernate5.Tests/Spring.Data.NHibernate/TestObject.hbm.xml</value>
</list>
</property>
<property name="HibernateProperties">
<dictionary>
<entry key="hibernate.dialect"
value="NHibernate.Dialect.MsSql2000Dialect"/>
<entry key="hibernate.connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"/>
<!--
<entry key="proxyfactory.factory_class"
value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
-->
</dictionary>
</property>
</object>
<object id="TestObjectDao" type="Spring.Data.NHibernate.TestObjectDao, Spring.Data.NHibernate5.Tests">
<property name="SessionFactory" ref="SessionFactory"/>
</object>
<object id="transactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate5">
<property name="DbProvider" ref="DbProvider"/>
<property name="sessionFactory" ref="SessionFactory"/>
</object>
<object name="SimpleService" type="Spring.Data.NHibernate.SimpleService, Spring.Data.NHibernate5.Tests">
<property name="TestObjectDao" ref="TestObjectDao"/>
</object>
<object name="hibernateTemplate" type="Spring.Data.NHibernate.HibernateTemplate, Spring.Data.NHibernate5">
<property name="sessionFactory" ref="SessionFactory"/>
</object>
<!-- once add 'internal' role for autoproxycreator that is created via the tx:attribute-driven element -->
<!-- then we can add advisors to the config and have them picked up by any 'user' role defined autoproxycreators -->
<object id="loggingAdvisor" type="Spring.Aop.Support.NameMatchMethodPointcutAdvisor, Spring.Aop">
<property name="Advice">
<object id="loggingAroundAdvice" type="Spring.Data.LoggingAroundAdvice, Spring.Data.Tests"/>
</property>
<property name="MappedNames">
<list>
<value>12341234asdf*</value>
</list>
</property>
</object>
<object id ="myAutoProxy" type="Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxyCreator">
<property name="InterceptorNames">
<list>
<value>loggingAdvisor</value>
</list>
</property>
<property name="ProxyTargetType" value="false"/>
<property name="ExposeProxy" value="false"/>
<property name="Optimize" value="false"/>
<property name="ObjectNames">
<list>
<value>TestObjectDao</value>
</list>
</property>
</object>
<tx:attribute-driven transaction-manager="transactionManager"/>
</objects>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Spring.Data.NHibernate.TestObject, Spring.Data.NHibernate5.Tests" table="TestObjects">
<id name="ObjectNumber" column="TestObjectNo" type="Int32">
<generator class="identity" />
<!--
<generator class="sequence">
<param name="sequence">ID_SEQ</param>
</generator>
-->
</id>
<property name="Age" column="Age" type="Int32"/>
<property name="Name" type="String" length="50"/>
</class>
</hibernate-mapping>

View File

@@ -0,0 +1,67 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
<DefineConstants>$(DefineConstants);NH_5</DefineConstants>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\Spring\Spring.Aop\Spring.Aop.2010.csproj" />
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.2010.csproj" />
<ProjectReference Include="..\..\..\src\Spring\Spring.Data.NHibernate5\Spring.Data.NHibernate5.2010.csproj" />
<ProjectReference Include="..\..\..\src\Spring\Spring.Data\Spring.Data.2010.csproj" />
<ProjectReference Include="..\Spring.Data.Tests\Spring.Data.Tests.2010.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FakeItEasy" Version="$(FakeItEasyVersion)" />
<PackageReference Include="FakeItEasy.Analyzer" Version="$(FakeItEasyVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftTestSDKVersion)" />
<PackageReference Include="NUnit" Version="$(NUnitVersion)" />
<PackageReference Include="NUnit3TestAdapter" Version="$(NUnitTestAdapterVersion)" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\Config\AopConfiguration.cs">
<Link>Data\NHibernate\Config\AopConfiguration.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\DelegatingLocalSessionFactoryObjectTests.cs">
<Link>Data\NHibernate\DelegatingLocalSessionFactoryObjectTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\HibernateTransactionManagerTests.cs">
<Link>Data\NHibernate\HibernateTransactionManagerTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\ISimpleService.cs">
<Link>Data\NHibernate\ISimpleService.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\ITestObjectDao.cs">
<Link>Data\NHibernate\ITestObjectDao.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\LocalSessionFactoryObjectTests.cs">
<Link>Data\NHibernate\LocalSessionFactoryObjectTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\NHTestObjectDao.cs">
<Link>Data\NHibernate\NHTestObjectDao.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\SessionFactoryUtilsTests.cs">
<Link>Data\NHibernate\SessionFactoryUtilsTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\SimpleService.cs">
<Link>Data\NHibernate\SimpleService.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\Support\ConfigSectionSessionScopeSettingsTests.cs">
<Link>Data\NHibernate\Support\ConfigSectionSessionScopeSettingsTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\Support\SessionScopeSettingsTests.cs">
<Link>Data\NHibernate\Support\SessionScopeSettingsTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\Support\SessionScopeTests.cs">
<Link>Data\NHibernate\Support\SessionScopeTests.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate.Tests\Data\NHibernate\TestObject.cs">
<Link>Data\NHibernate\TestObject.cs</Link>
</Compile>
<Content Include="Data\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<EmbeddedResource Include="Data\NHibernate\Config\AopConfiguration.xml" />
<EmbeddedResource Include="Data\NHibernate\Config\AopConfigurationTxPointcut.xml" />
<EmbeddedResource Include="Data\NHibernate\TestObject.hbm.xml" />
</ItemGroup>
</Project>

View File

@@ -1,7 +1,7 @@
#region License
/*
* Copyright <EFBFBD> 2002-2011 the original author or authors.
* Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -80,10 +80,16 @@ namespace Spring.Data.Common
[Test]
public void ThreadSafety()
{
AsyncTestTask t1 = new AsyncTestDbProviderFactory(1000, "SqlServer-2.0").Start();
AsyncTestTask t2 = new AsyncTestDbProviderFactory(1000, "SqlServer-2.0").Start();
AsyncTestTask t3 = new AsyncTestDbProviderFactory(1000, "SqlServer-2.0").Start();
AsyncTestTask t4 = new AsyncTestDbProviderFactory(1000, "SqlServer-2.0").Start();
#if NETCOREAPP
const string providerName = "SqlServer";
#else
const string providerName = "SqlServer-2.0";
#endif
AsyncTestTask t1 = new AsyncTestDbProviderFactory(1000, providerName).Start();
AsyncTestTask t2 = new AsyncTestDbProviderFactory(1000, providerName).Start();
AsyncTestTask t3 = new AsyncTestDbProviderFactory(1000, providerName).Start();
AsyncTestTask t4 = new AsyncTestDbProviderFactory(1000, providerName).Start();
t1.AssertNoException();
t2.AssertNoException();
@@ -166,7 +172,6 @@ namespace Spring.Data.Common
Assert.IsNotNull(provider.CreateParameter());
Assert.AreEqual("?", provider.CreateParameterName("Foo"));
}
#endif
[Test]
public void DefaultInstanceWithSqlServer40()
@@ -182,6 +187,17 @@ namespace Spring.Data.Common
Assert.AreEqual("@Foo", provider.CreateParameterName("Foo"));
}
[Test]
public void TestSqlServer20Names()
{
//Initialize internal application context. factory
DbProviderFactory.GetDbProvider("SqlServer-2.0");
IApplicationContext ctx = DbProviderFactory.ApplicationContext;
IList<string> dbProviderNames = ctx.GetObjectNamesForType(typeof (IDbProvider));
Assert.IsTrue(dbProviderNames.Count > 0);
}
#endif
[Test]
public void DefaultInstanceWithOracleClient10_20()
{
@@ -273,16 +289,6 @@ namespace Spring.Data.Common
*/
[Test]
public void TestSqlServer20Names()
{
//Initialize internal application context. factory
DbProviderFactory.GetDbProvider("SqlServer-2.0");
IApplicationContext ctx = DbProviderFactory.ApplicationContext;
IList<string> dbProviderNames = ctx.GetObjectNamesForType(typeof (IDbProvider));
Assert.IsTrue(dbProviderNames.Count > 0);
}
private void AssertIsSqlServer2005(IDbProvider provider)
{
Assert.AreEqual("Microsoft SQL Server, provider V2.0.0.0 in framework .NET V2.0",

View File

@@ -1,7 +1,5 @@
#region Licence
/*
* Copyright <EFBFBD> 2002-2011 the original author or authors.
* Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,10 +14,6 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using NUnit.Framework;
using Spring.Dao;
@@ -27,8 +21,6 @@ using Spring.Data;
using Spring.Data.Common;
using Spring.Data.Support;
#endregion
namespace Spring.Support
{
/// <summary>
@@ -38,16 +30,11 @@ namespace Spring.Support
[TestFixture]
public class ErrorCodeExceptionTranslatorTests
{
#region Fields
private static ErrorCodes ERROR_CODES = new ErrorCodes();
private static ErrorCodes ERROR_CODES = new ErrorCodes();
private IDbProvider dbProvider = new TestDbProvider();
#endregion
#region Constructor (s)
/// <summary>
/// <summary>
/// Initializes a new instance of the <see cref="ErrorCodeExceptionTranslatorTests"/> class.
/// </summary>
public ErrorCodeExceptionTranslatorTests()
@@ -55,15 +42,7 @@ namespace Spring.Support
}
#endregion
#region Properties
#endregion
[SetUp]
[SetUp]
public void SetUp()
{
ERROR_CODES.BadSqlGrammarCodes = (new String[] { "1", "2" });

View File

@@ -1,7 +1,7 @@
#region License
/*
* Copyright <EFBFBD> 2002-2011 the original author or authors.
* Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,9 +41,8 @@ namespace Spring.Support
public TestDbProvider()
{
IDbProvider provider = DbProviderFactory.GetDbProvider("SqlServer-1.1");
IDbProvider provider = DbProviderFactory.GetDbProvider("System.Data.SqlClient");
dbMetadata = provider.DbMetadata;
}
/// <summary>

View File

@@ -3,7 +3,7 @@
xmlns:db="http://www.springframework.net/database">
<db:provider id="DbProvider"
provider="SqlServer-2.0"
provider="System.Data.SqlClient"
connectionString="Data Source=.\SQL2005;Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>