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

1
.gitignore vendored
View File

@@ -60,6 +60,7 @@ PrecompiledWeb
/src/Spring/Spring.Core/Spring.Core.xml
/src/Spring/Spring.Data.NHibernate3/Spring.Data.NHibernate3.xml
/src/Spring/Spring.Data.NHibernate4/Spring.Data.NHibernate4.xml
/src/Spring/Spring.Data.NHibernate5/Spring.Data.NHibernate5.xml
/src/Spring/Spring.Messaging.Ems/Spring.Messaging.Ems.xml
/src/Spring/Spring.Messaging.Nms/Spring.Messaging.Nms.xml
/src/Spring/Spring.Messaging/Spring.Messaging.xml

View File

@@ -109,6 +109,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spring.Template.Velocity.Ca
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests", "test\Spring\Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests\Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests.csproj", "{DE276F7C-4564-49EC-AABC-B964EC3D1626}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate5.2010", "src\Spring\Spring.Data.NHibernate5\Spring.Data.NHibernate5.2010.csproj", "{26604974-B6B8-45BA-A72A-66574ADC498B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate5.Integration.Tests.2010", "test\Spring\Spring.Data.NHibernate5.Integration.Tests\Spring.Data.NHibernate5.Integration.Tests.2010.csproj", "{740CDA28-39BC-455A-86C3-5323D14F5B2E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate5.Tests.2010", "test\Spring\Spring.Data.NHibernate5.Tests\Spring.Data.NHibernate5.Tests.2010.csproj", "{BEEBC49B-4519-4C77-AE93-11E68F4CA7E3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET = Debug|.NET
@@ -589,6 +595,42 @@ Global
{DE276F7C-4564-49EC-AABC-B964EC3D1626}.Release|Any CPU.Build.0 = Release|Any CPU
{DE276F7C-4564-49EC-AABC-B964EC3D1626}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{DE276F7C-4564-49EC-AABC-B964EC3D1626}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{26604974-B6B8-45BA-A72A-66574ADC498B}.Debug|.NET.ActiveCfg = Debug|Any CPU
{26604974-B6B8-45BA-A72A-66574ADC498B}.Debug|.NET.Build.0 = Debug|Any CPU
{26604974-B6B8-45BA-A72A-66574ADC498B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26604974-B6B8-45BA-A72A-66574ADC498B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26604974-B6B8-45BA-A72A-66574ADC498B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{26604974-B6B8-45BA-A72A-66574ADC498B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{26604974-B6B8-45BA-A72A-66574ADC498B}.Release|.NET.ActiveCfg = Release|Any CPU
{26604974-B6B8-45BA-A72A-66574ADC498B}.Release|.NET.Build.0 = Release|Any CPU
{26604974-B6B8-45BA-A72A-66574ADC498B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26604974-B6B8-45BA-A72A-66574ADC498B}.Release|Any CPU.Build.0 = Release|Any CPU
{26604974-B6B8-45BA-A72A-66574ADC498B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{26604974-B6B8-45BA-A72A-66574ADC498B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{740CDA28-39BC-455A-86C3-5323D14F5B2E}.Debug|.NET.ActiveCfg = Debug|Any CPU
{740CDA28-39BC-455A-86C3-5323D14F5B2E}.Debug|.NET.Build.0 = Debug|Any CPU
{740CDA28-39BC-455A-86C3-5323D14F5B2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{740CDA28-39BC-455A-86C3-5323D14F5B2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{740CDA28-39BC-455A-86C3-5323D14F5B2E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{740CDA28-39BC-455A-86C3-5323D14F5B2E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{740CDA28-39BC-455A-86C3-5323D14F5B2E}.Release|.NET.ActiveCfg = Release|Any CPU
{740CDA28-39BC-455A-86C3-5323D14F5B2E}.Release|.NET.Build.0 = Release|Any CPU
{740CDA28-39BC-455A-86C3-5323D14F5B2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{740CDA28-39BC-455A-86C3-5323D14F5B2E}.Release|Any CPU.Build.0 = Release|Any CPU
{740CDA28-39BC-455A-86C3-5323D14F5B2E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{740CDA28-39BC-455A-86C3-5323D14F5B2E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{BEEBC49B-4519-4C77-AE93-11E68F4CA7E3}.Debug|.NET.ActiveCfg = Debug|Any CPU
{BEEBC49B-4519-4C77-AE93-11E68F4CA7E3}.Debug|.NET.Build.0 = Debug|Any CPU
{BEEBC49B-4519-4C77-AE93-11E68F4CA7E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BEEBC49B-4519-4C77-AE93-11E68F4CA7E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BEEBC49B-4519-4C77-AE93-11E68F4CA7E3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{BEEBC49B-4519-4C77-AE93-11E68F4CA7E3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{BEEBC49B-4519-4C77-AE93-11E68F4CA7E3}.Release|.NET.ActiveCfg = Release|Any CPU
{BEEBC49B-4519-4C77-AE93-11E68F4CA7E3}.Release|.NET.Build.0 = Release|Any CPU
{BEEBC49B-4519-4C77-AE93-11E68F4CA7E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BEEBC49B-4519-4C77-AE93-11E68F4CA7E3}.Release|Any CPU.Build.0 = Release|Any CPU
{BEEBC49B-4519-4C77-AE93-11E68F4CA7E3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{BEEBC49B-4519-4C77-AE93-11E68F4CA7E3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -377,6 +377,10 @@ Commandline Examples:
<do>
<echo message="Running .NET Framework tests for ${path}" />
<property name="test.bin.dir" value="${path}/net452" />
<if test="${directory::exists(test.bin.dir) == false}">
<property name="test.bin.dir" value="${path}/net461" />
</if>
<property name="test.assemblyname" value="${string::substring(path, string::last-index-of(path, '\') + 1, string::get-length(path) - string::last-index-of(path, '\') - 1)}" />
<property name="test.assemblyfile" value="${test.assemblyname}.dll" />
<property name="test.assemblyname.tocover" value="${string::substring(test.assemblyname,0,string::last-index-of(test.assemblyname, '.Tests') )}" />
@@ -411,6 +415,8 @@ Commandline Examples:
<include name="${spring.basedir}/test/Spring/Spring.Aop.Tests/Spring.Aop.Tests.2010.csproj" />
<include name="${spring.basedir}/test/Spring/Spring.Data.Tests/Spring.Data.Tests.2010.csproj" />
<include name="${spring.basedir}/test/Spring/Spring.Testing.NUnit.Tests/Spring.Testing.NUnit.Tests.2010.csproj" />
<include name="${spring.basedir}/test/Spring/Spring.Data.NHibernate5.Integration.Tests/Spring.Data.NHibernate5.Integration.Tests.2010.csproj" />
<include name="${spring.basedir}/test/Spring/Spring.Data.NHibernate5.Tests/Spring.Data.NHibernate5.Tests.2010.csproj" />
</items>
</in>
<do>
@@ -892,30 +898,6 @@ Commandline Examples:
</copy>
</if>
<mkdir dir="${current.package.dir}/lib/NHibernate3"/>
<if test="${property::exists('build.allnamespaces') and not build.allnamespaces}">
<copy todir="${current.package.dir}/lib/NHibernate3" verbose="${copy-verbose}">
<fileset basedir="lib/NHibernate3">
<include name="**/*.dll"/>
<include name="**/*.xml"/>
<include name="**/*.license.txt"/>
<exclude name="mono/**"/>
</fileset>
</copy>
</if>
<mkdir dir="${current.package.dir}/lib/NHibernate4"/>
<if test="${property::exists('build.allnamespaces') and not build.allnamespaces}">
<copy todir="${current.package.dir}/lib/NHibernate4" verbose="${copy-verbose}">
<fileset basedir="lib/NHibernate4">
<include name="**/*.dll"/>
<include name="**/*.xml"/>
<include name="**/*.license.txt"/>
<exclude name="mono/**"/>
</fileset>
</copy>
</if>
<if test="${property::exists('build.allnamespaces') and build.allnamespaces}">
<copy todir="${current.package.dir}/lib" verbose="${copy-verbose}">
<fileset basedir="lib">
@@ -1113,6 +1095,10 @@ Commandline Examples:
<include name="*/*/Spring.Web.Conversation.NHibernate4.xml"/>
<include name="*/*/Spring.Web.Conversation.NHibernate4.pdb"/>
<include name="*/*/Spring.Web.Conversation.NHibernate5.dll"/>
<include name="*/*/Spring.Web.Conversation.NHibernate5.xml"/>
<include name="*/*/Spring.Web.Conversation.NHibernate5.pdb"/>
</fileset>
</copy>
@@ -1307,6 +1293,7 @@ Commandline Examples:
<include name="src/Spring/Spring.Data/**"/>
<include name="src/Spring/Spring.Data.NHibernate3/**"/>
<include name="src/Spring/Spring.Data.NHibernate4/**"/>
<include name="src/Spring/Spring.Data.NHibernate5/**"/>
<include name="src/Spring/Spring.Messaging/**"/>
<include name="src/Spring/Spring.Messaging.Nms/**"/>
<include name="src/Spring/Spring.Messaging.Ems/**"/>
@@ -1317,6 +1304,7 @@ Commandline Examples:
<include name="src/Spring/CommonAssemblyInfo.cs"/>
<include name="src/Spring/Spring.Web.Conversation.NHibernate3/**"/>
<include name="src/Spring/Spring.Web.Conversation.NHibernate4/**"/>
<include name="src/Spring/Spring.Web.Conversation.NHibernate5/**"/>
<include name="test/Spring/Spring.Core.Tests/**"/>
<include name="test/Spring/Spring.Aop.Tests/**"/>
@@ -1332,6 +1320,8 @@ Commandline Examples:
<include name="test/Spring/Spring.Data.NHibernate4.Tests/**"/>
<include name="test/Spring/Spring.Data.NHibernate4.Integration.Tests/**"/>
<include name="test/Spring/Spring.Data.NHibernate4.NestedTxSuspension.Integration.Tests/**"/>
<include name="test/Spring/Spring.Data.NHibernate5.Tests/**"/>
<include name="test/Spring/Spring.Data.NHibernate5.Integration.Tests/**"/>
<include name="test/Spring/Spring.Messaging.Tests/**"/>
<include name="test/Spring/Spring.Messaging.Nms.Tests/**"/>
<include name="test/Spring/Spring.Messaging.Nms.Integration.Tests/**"/>
@@ -1343,6 +1333,7 @@ Commandline Examples:
<include name="test/Spring/CommonAssemblyInfo.cs"/>
<include name="test/Spring/Spring.Web.Conversation.NHibernate3.Tests/**"/>
<include name="test/Spring/Spring.Web.Conversation.NHibernate4.Tests/**"/>
<include name="test/Spring/Spring.Web.Conversation.NHibernate5.Tests/**"/>
<include name="examples/Spring/Spring.Examples.build"/>
<include name="examples/Spring/Spring.AopQuickStart/**"/>

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,8 +14,6 @@
* limitations under the License.
*/
#endregion
using System;
using NHibernate.Bytecode;
using NHibernate.Properties;

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,8 +14,6 @@
* limitations under the License.
*/
#endregion
using System;
using System.Reflection;
using AopAlliance.Intercept;
@@ -53,13 +49,22 @@ namespace Spring.Data.NHibernate.Bytecode
///<param name="componentIdType"></param>
///<param name="session"></param>
public LazyInitializer(string entityName, Type persistentClass, object id, MethodInfo getIdentifierMethod,
MethodInfo setIdentifierMethod, IAbstractComponentType componentIdType,
ISessionImplementor session)
MethodInfo setIdentifierMethod, IAbstractComponentType componentIdType,
ISessionImplementor session)
: base(
entityName, persistentClass, id, getIdentifierMethod,
setIdentifierMethod, componentIdType, session) { }
#region Implementation of IInterceptor
entityName,
persistentClass,
id,
getIdentifierMethod,
setIdentifierMethod,
componentIdType,
session
#if NH_5
, overridesEquals: false
#endif
)
{
}
/// <summary>
/// Implement this method to perform extra treatments before and after
@@ -106,27 +111,12 @@ namespace Spring.Data.NHibernate.Bytecode
}
}
#endregion
#region Implementation of ITargetSource
object ITargetSource.GetTarget()
{
return Target;
}
object ITargetSource.GetTarget() => Target;
void ITargetSource.ReleaseTarget(object target) { }
Type ITargetSource.TargetType
{
get { return PersistentClass; }
}
Type ITargetSource.TargetType => PersistentClass;
bool ITargetSource.IsStatic
{
get { return false; }
}
#endregion
bool ITargetSource.IsStatic => false;
}
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,10 +14,6 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Collections.Generic;
@@ -27,8 +21,6 @@ using NHibernate.Bytecode;
using Spring.Objects.Factory;
#endregion
namespace Spring.Data.NHibernate.Bytecode
{
/// <summary>

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,8 +14,6 @@
* limitations under the License.
*/
#endregion
using System;
using Common.Logging;
using NHibernate;
@@ -46,8 +42,6 @@ namespace Spring.Data.NHibernate.Bytecode
}
}
#region IProxyFactory Members
/// <summary>
/// Creates a new proxy.
/// </summary>
@@ -78,7 +72,5 @@ namespace Spring.Data.NHibernate.Bytecode
throw new HibernateException("Creating a proxy instance failed", ex);
}
}
#endregion
}
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,16 +14,10 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using NHibernate.Bytecode;
using NHibernate.Proxy;
#endregion
namespace Spring.Data.NHibernate.Bytecode
{
/// <summary>

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,10 +14,6 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Collections.Generic;
@@ -27,8 +21,6 @@ using NHibernate.Properties;
using Spring.Objects.Factory;
#endregion
namespace Spring.Data.NHibernate.Bytecode
{
/// <summary>

View File

@@ -1,11 +1,19 @@
using System.Data;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Threading;
using System.Threading.Tasks;
using NHibernate;
using NHibernate.Engine;
using NHibernate.Metadata;
using NHibernate.Stat;
#if NH_5
using IDbConnection = System.Data.Common.DbConnection;
#else
using IDbConnection = System.Data.IDbConnection;
#endif
namespace Spring.Data.NHibernate
{
#pragma warning disable 1591
@@ -14,150 +22,104 @@ namespace Spring.Data.NHibernate
/// </summary>
public abstract class DelegatingSessionFactory : ISessionFactory
{
public ICollection<string> DefinedFilterNames
{
get { return TargetSessionFactory.DefinedFilterNames; }
}
public abstract ISessionFactory TargetSessionFactory { get; }
public bool IsClosed
{
get { return TargetSessionFactory.IsClosed; }
}
public ICollection<string> DefinedFilterNames => TargetSessionFactory.DefinedFilterNames;
public IStatistics Statistics
{
get { return TargetSessionFactory.Statistics; }
}
public bool IsClosed => TargetSessionFactory.IsClosed;
public abstract ISessionFactory TargetSessionFactory
{
get;
}
public IStatistics Statistics => TargetSessionFactory.Statistics;
public void Close()
{
TargetSessionFactory.Close();
}
public void Close() => TargetSessionFactory.Close();
public void Dispose()
{
TargetSessionFactory.Dispose();
}
public void Dispose() => TargetSessionFactory.Dispose();
public void Evict(System.Type persistentClass, object id)
{
TargetSessionFactory.Evict(persistentClass, id);
}
public void Evict(Type persistentClass, object id) => TargetSessionFactory.Evict(persistentClass, id);
public void Evict(System.Type persistentClass)
{
TargetSessionFactory.Evict(persistentClass);
}
public void Evict(Type persistentClass) => TargetSessionFactory.Evict(persistentClass);
public void EvictCollection(string roleName, object id)
{
TargetSessionFactory.EvictCollection(roleName, id);
}
public void EvictCollection(string roleName, object id) => TargetSessionFactory.EvictCollection(roleName, id);
public void EvictCollection(string roleName)
{
TargetSessionFactory.EvictCollection(roleName);
}
public void EvictCollection(string roleName) => TargetSessionFactory.EvictCollection(roleName);
public void EvictEntity(string entityName)
{
TargetSessionFactory.EvictEntity(entityName);
}
public void EvictEntity(string entityName) => TargetSessionFactory.EvictEntity(entityName);
public void EvictEntity(string entityName, object id)
{
TargetSessionFactory.EvictEntity(entityName, id);
}
public void EvictEntity(string entityName, object id) => TargetSessionFactory.EvictEntity(entityName, id);
public void EvictQueries(string cacheRegion)
{
TargetSessionFactory.EvictQueries(cacheRegion);
}
public void EvictQueries(string cacheRegion) => TargetSessionFactory.EvictQueries(cacheRegion);
public void EvictQueries()
{
TargetSessionFactory.EvictQueries();
}
public void EvictQueries() => TargetSessionFactory.EvictQueries();
public IDictionary<string, IClassMetadata> GetAllClassMetadata()
{
return TargetSessionFactory.GetAllClassMetadata();
}
public IDictionary<string, IClassMetadata> GetAllClassMetadata() => TargetSessionFactory.GetAllClassMetadata();
public IDictionary<string, ICollectionMetadata> GetAllCollectionMetadata()
{
return TargetSessionFactory.GetAllCollectionMetadata();
}
public IClassMetadata GetClassMetadata(System.Type persistentType)
{
return TargetSessionFactory.GetClassMetadata(persistentType);
}
public IClassMetadata GetClassMetadata(string entityName)
{
return TargetSessionFactory.GetClassMetadata(entityName);
}
public ICollectionMetadata GetCollectionMetadata(string roleName)
{
return TargetSessionFactory.GetCollectionMetadata(roleName);
}
public ISession GetCurrentSession()
{
return TargetSessionFactory.GetCurrentSession();
}
public FilterDefinition GetFilterDefinition(string filterName)
{
return TargetSessionFactory.GetFilterDefinition(filterName);
}
public ISession OpenSession(IInterceptor interceptor)
{
return TargetSessionFactory.OpenSession(interceptor);
}
public ISession OpenSession()
{
return TargetSessionFactory.OpenSession();
}
public ISession OpenSession(IDbConnection conn, IInterceptor interceptor)
{
return TargetSessionFactory.OpenSession(conn, interceptor);
}
public ISession OpenSession(IDbConnection conn)
{
return TargetSessionFactory.OpenSession(conn);
}
public IStatelessSession OpenStatelessSession()
{
return TargetSessionFactory.OpenStatelessSession();
}
public IDictionary<string, ICollectionMetadata> GetAllCollectionMetadata()
=> TargetSessionFactory.GetAllCollectionMetadata();
public IStatelessSession OpenStatelessSession(IDbConnection connection)
{
return TargetSessionFactory.OpenStatelessSession(connection);
}
=> TargetSessionFactory.OpenStatelessSession(connection);
public IClassMetadata GetClassMetadata(Type persistentType)
=> TargetSessionFactory.GetClassMetadata(persistentType);
public IClassMetadata GetClassMetadata(string entityName)
=> TargetSessionFactory.GetClassMetadata(entityName);
public ICollectionMetadata GetCollectionMetadata(string roleName)
=> TargetSessionFactory.GetCollectionMetadata(roleName);
public ISession GetCurrentSession() => TargetSessionFactory.GetCurrentSession();
public FilterDefinition GetFilterDefinition(string filterName)
=> TargetSessionFactory.GetFilterDefinition(filterName);
#if NH_5
public Task CloseAsync(CancellationToken cancellationToken = new CancellationToken())
=> TargetSessionFactory.CloseAsync(cancellationToken);
public Task EvictAsync(Type persistentClass, CancellationToken cancellationToken = new CancellationToken())
=> TargetSessionFactory.EvictAsync(persistentClass, cancellationToken);
public Task EvictAsync(Type persistentClass, object id, CancellationToken cancellationToken = new CancellationToken())
=> TargetSessionFactory.EvictAsync(persistentClass, id, cancellationToken);
public Task EvictEntityAsync(string entityName, CancellationToken cancellationToken = new CancellationToken())
=> TargetSessionFactory.EvictEntityAsync(entityName, cancellationToken);
public Task EvictEntityAsync(string entityName, object id, CancellationToken cancellationToken = new CancellationToken())
=> TargetSessionFactory.EvictEntityAsync(entityName, id, cancellationToken);
public Task EvictCollectionAsync(string roleName, CancellationToken cancellationToken = new CancellationToken())
=> TargetSessionFactory.EvictCollectionAsync(roleName, cancellationToken);
public Task EvictCollectionAsync(string roleName, object id, CancellationToken cancellationToken = new CancellationToken())
=> TargetSessionFactory.EvictCollectionAsync(roleName, id, cancellationToken);
public Task EvictQueriesAsync(CancellationToken cancellationToken = new CancellationToken())
=> TargetSessionFactory.EvictQueriesAsync(cancellationToken);
public Task EvictQueriesAsync(string cacheRegion, CancellationToken cancellationToken = new CancellationToken())
=> TargetSessionFactory.EvictQueriesAsync(cacheRegion, cancellationToken);
public ISessionBuilder WithOptions() => TargetSessionFactory.WithOptions();
public IStatelessSessionBuilder WithStatelessOptions() => TargetSessionFactory.WithStatelessOptions();
#endif
public ISession OpenSession(IInterceptor interceptor) => TargetSessionFactory.OpenSession(interceptor);
public ISession OpenSession() => TargetSessionFactory.OpenSession();
public ISession OpenSession(IDbConnection conn, IInterceptor interceptor)
=> TargetSessionFactory.OpenSession(conn, interceptor);
public ISession OpenSession(IDbConnection conn) => TargetSessionFactory.OpenSession(conn);
public IStatelessSession OpenStatelessSession() => TargetSessionFactory.OpenStatelessSession();
IDictionary<string, IClassMetadata> ISessionFactory.GetAllClassMetadata()
{
return TargetSessionFactory.GetAllClassMetadata();
}
IDictionary<string, ICollectionMetadata> ISessionFactory.GetAllCollectionMetadata()
{
return TargetSessionFactory.GetAllCollectionMetadata();
}
=> TargetSessionFactory.GetAllClassMetadata();
IDictionary<string, ICollectionMetadata> ISessionFactory.GetAllCollectionMetadata()
=> TargetSessionFactory.GetAllCollectionMetadata();
}
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,10 +14,6 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Collections;
using System.Collections.Generic;
@@ -28,8 +22,6 @@ using NHibernate.Type;
using Spring.Objects.Factory;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,15 +14,9 @@
* limitations under the License.
*/
#endregion
#region Imports
using NHibernate;
using System.Collections.Generic;
#endregion
namespace Spring.Data.NHibernate.Generic
{
/// <summary>

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,17 +14,11 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using NHibernate;
using Spring.Dao;
using Spring.Dao.Support;
#endregion
namespace Spring.Data.NHibernate.Generic.Support
{
/// <summary>
@@ -50,14 +42,9 @@ namespace Spring.Data.NHibernate.Generic.Support
/// <author>Mark Pollack (.NET)</author>
public abstract class HibernateDaoSupport : DaoSupport
{
#region Fields
private HibernateTemplate hibernateTemplate;
#endregion
private HibernateTemplate hibernateTemplate;
#region Constructor (s)
/// <summary>
/// <summary>
/// Initializes a new instance of the <see cref="HibernateDaoSupport"/> class.
/// </summary>
public HibernateDaoSupport()
@@ -65,11 +52,7 @@ namespace Spring.Data.NHibernate.Generic.Support
}
#endregion
#region Properties
/// <summary>
/// <summary>
/// Gets or sets the hibernate template.
/// </summary>
/// <remarks>Set the HibernateTemplate for this DAO explicitly,
@@ -130,11 +113,7 @@ namespace Spring.Data.NHibernate.Generic.Support
}
}
#endregion
#region Methods
/// <summary>
/// <summary>
/// Create a HibernateTemplate for the given ISessionFactory.
/// </summary>
/// <remarks>
@@ -227,8 +206,5 @@ namespace Spring.Data.NHibernate.Generic.Support
{
SessionFactoryUtils.ReleaseSession(session, SessionFactory);
}
#endregion
}
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,14 +14,8 @@
* limitations under the License.
*/
#endregion
#region Imports
using NHibernate;
#endregion
namespace Spring.Data.NHibernate.Generic
{
/// <summary>

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,10 +14,6 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Collections.Generic;
using NHibernate;
@@ -30,8 +24,6 @@ using Spring.Data.Common;
using Spring.Data.Support;
using Spring.Objects.Factory;
#endregion
namespace Spring.Data.NHibernate.Generic
{
/// <summary>
@@ -70,14 +62,8 @@ namespace Spring.Data.NHibernate.Generic
/// <author>Mark Pollack (.NET)</author>
public class HibernateTemplate : HibernateAccessor, IHibernateOperations
{
#region Fields
NHibernate.HibernateTemplate classicHibernateTemplate;
#endregion
#region Constructor (s)
/// <summary>
/// Initializes a new instance of the <see cref="HibernateTemplate"/> class.
/// </summary>
@@ -357,17 +343,6 @@ namespace Spring.Data.NHibernate.Generic
set { classicHibernateTemplate.ProxyFactory = value; }
}
#endregion
#region Properties
#endregion
#region Methods
/// <summary>
/// Remove all objects from the Session cache, and cancel all pending saves,
/// updates and deletes.
@@ -586,7 +561,7 @@ namespace Spring.Data.NHibernate.Generic
classicHibernateTemplate.SaveOrUpdate(entity);
}
#if !NH_4_0
#if !NH_4_0 && !NH_5
/// <summary>
/// Save or update the contents of given persistent object,
/// according to its id (matching the configured "unsaved-value"?).
@@ -624,10 +599,6 @@ namespace Spring.Data.NHibernate.Generic
return classicHibernateTemplate.Merge(entity);
}
#endregion
#region IHibernateOperations Gets
/// <summary>
/// Return the persistent instance of the given entity type
/// with the given identifier, or null if not found.
@@ -657,10 +628,6 @@ namespace Spring.Data.NHibernate.Generic
return Execute(new GetByTypeHibernateCallback<T>(id, lockMode), true);
}
#endregion
#region IHibernateOperations Loads
/// <summary>
/// Return the persistent instance of the given entity class
/// with the given identifier, throwing an exception if not found.
@@ -703,10 +670,6 @@ namespace Spring.Data.NHibernate.Generic
return ExecuteFind(new LoadAllByTypeHibernateCallback<T>(this), true);
}
#endregion
#region IHibernateOperations Finds
/// <summary>
/// Execute a query for persistent instances.
/// </summary>
@@ -1059,10 +1022,6 @@ namespace Spring.Data.NHibernate.Generic
return ExecuteFind(new FindByValueObjectHibernateCallback<T>(this, queryString, valueObject), true);
}
#endregion
#region Execute methods
/// <summary>
/// Execute the action specified by the given action object within a Session.
/// </summary>
@@ -1335,13 +1294,8 @@ namespace Spring.Data.NHibernate.Generic
{
return ExecuteFind<T>(action, ExposeNativeSession);
}
#endregion
}
#region Internal Supporting Callback Classes
internal class ExecuteHibernateCallbackUsingDelegate<T> : IHibernateCallback<T>
{
private HibernateDelegate<T> del;
@@ -1722,5 +1676,4 @@ namespace Spring.Data.NHibernate.Generic
return del(session);
}
}
#endregion
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,8 +14,6 @@
* limitations under the License.
*/
#endregion
using System.Collections.Generic;
using NHibernate;

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,14 +14,8 @@
* limitations under the License.
*/
#endregion
#region Imports
using NHibernate;
#endregion
namespace Spring.Data.NHibernate.Generic
{
/// <summary>

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,8 +14,6 @@
* limitations under the License.
*/
#endregion
using System;
using System.Collections.Generic;
using NHibernate;

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,10 +14,6 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Collections;
using System.Reflection;
@@ -35,8 +29,6 @@ using Spring.Objects.Factory;
using IInterceptor=NHibernate.IInterceptor;
using ICriteria=NHibernate.ICriteria;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>
@@ -52,17 +44,11 @@ namespace Spring.Data.NHibernate
{
private Type criteriaType;
#region Constants
/// <summary>
/// <summary>
/// The <see cref="ILog"/> instance for this class.
/// </summary>
private readonly ILog log = LogManager.GetLogger(typeof (HibernateAccessor));
#endregion
#region Constructor (s)
/// <summary>
/// Initializes a new instance of the <see cref="HibernateAccessor"/> class.
@@ -72,12 +58,7 @@ namespace Spring.Data.NHibernate
}
#endregion
#region Properties
/// <summary>
/// <summary>
/// Gets or sets if a new Session should be created when no transactional Session
/// can be found for the current thread.
/// </summary>
@@ -328,12 +309,8 @@ namespace Spring.Data.NHibernate
}
}
#endregion
#region Methods
/// <summary>
/// <summary>
/// Apply the flush mode that's been specified for this accessor
/// to the given Session.
/// </summary>
@@ -626,10 +603,8 @@ namespace Spring.Data.NHibernate
log.Warn("CriteriaImpl not available. FetchSize can not be set on ICriteria objects", e);
}
}
#endregion
/// <summary>
/// <summary>
/// Ensure SessionFactory is not null
/// </summary>
/// <exception cref="ArgumentException">If SessionFactory property is null.</exception>
@@ -641,8 +616,7 @@ namespace Spring.Data.NHibernate
}
}
#region Helper Classes
/// <summary>
/// <summary>
/// Helper class to determine if the FlushMode enumeration
/// was changed from its default value
/// </summary>
@@ -690,11 +664,6 @@ namespace Spring.Data.NHibernate
}
}
#endregion
}
internal class CloseSuppressingMethodInterceptor : IMethodInterceptor

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,36 +14,28 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Runtime.Serialization;
using NHibernate;
using Spring.Dao;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>
/// <summary>
/// Hibernate-specific subclass of UncategorizedDataAccessException,
/// for ADO.NET exceptions that Hibernate rethrew and could not be
/// mapped into the DAO exception heirarchy.
/// </summary>
/// <author>Mark Pollack (.NET)</author>
[Serializable]
public class HibernateAdoException : UncategorizedDataAccessException
{
#region Constructor (s)
/// </summary>
/// <author>Mark Pollack (.NET)</author>
[Serializable]
public class HibernateAdoException : UncategorizedDataAccessException
{
/// <summary>
/// Initializes a new instance of the <see cref="HibernateAdoException"/> class.
/// </summary>
public HibernateAdoException() : base() {}
public HibernateAdoException() : base()
{
}
/// <summary>
/// Creates a new instance of the
@@ -54,7 +44,9 @@ namespace Spring.Data.NHibernate
/// <param name="message">
/// A message about the exception.
/// </param>
public HibernateAdoException( string message ) : base( message ) {}
public HibernateAdoException(string message) : base(message)
{
}
/// <summary>
/// Creates a new instance of the
@@ -66,8 +58,9 @@ namespace Spring.Data.NHibernate
/// <param name="rootCause">
/// The root exception from the underlying data access API - ADO.NET
/// </param>
public HibernateAdoException( string message, ADOException rootCause ) : base( message, rootCause ) {}
public HibernateAdoException(string message, ADOException rootCause) : base(message, rootCause)
{
}
/// <summary>
/// Creates a new instance of the HibernateSystemException class with the specified message
@@ -83,23 +76,9 @@ namespace Spring.Data.NHibernate
{
}
/// <summary>
/// Creates a new instance of the
/// <see cref="HibernateAdoException"/> class.
/// </summary>
/// <param name="info">
/// The <see cref="System.Runtime.Serialization.SerializationInfo"/>
/// that holds the serialized object data about the exception being thrown.
/// </param>
/// <param name="context">
/// The <see cref="System.Runtime.Serialization.StreamingContext"/>
/// that contains contextual information about the source or destination.
/// </param>
protected HibernateAdoException( SerializationInfo info, StreamingContext context ) : base( info, context ) {}
#endregion
}
}
/// <inheritdoc />
protected HibernateAdoException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,14 +14,8 @@
* limitations under the License.
*/
#endregion
#region Imports
using NHibernate;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,40 +14,31 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Runtime.Serialization;
using NHibernate;
using Spring.Dao;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>
/// Hibernate-specific subclass of ObjectRetrievalFailureException.
/// </summary>
/// <remarks>
/// Converts Hibernate's UnresolvableObjectException, ObjectNotFoundException,
/// ObjectDeletedException, and WrongClassException.
/// </remarks>
/// <author>Mark Pollack (.NET)</author>
/// <version>$Id: HibernateObjectRetrievalFailureException.cs,v 1.1 2008/04/07 20:12:53 lahma Exp $</version>
[Serializable]
public class HibernateObjectRetrievalFailureException : ObjectRetrievalFailureException
{
#region Constructor (s)
/// <summary>
/// Hibernate-specific subclass of ObjectRetrievalFailureException.
/// </summary>
/// <remarks>
/// Converts Hibernate's UnresolvableObjectException, ObjectNotFoundException,
/// ObjectDeletedException, and WrongClassException.
/// </remarks>
/// <author>Mark Pollack (.NET)</author>
/// <version>$Id: HibernateObjectRetrievalFailureException.cs,v 1.1 2008/04/07 20:12:53 lahma Exp $</version>
[Serializable]
public class HibernateObjectRetrievalFailureException : ObjectRetrievalFailureException
{
/// <summary>
/// Initializes a new instance of the <see cref="HibernateObjectRetrievalFailureException"/> class.
/// Initializes a new instance of the <see cref="HibernateObjectRetrievalFailureException"/> class.
/// </summary>
public HibernateObjectRetrievalFailureException()
{
}
public HibernateObjectRetrievalFailureException()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="HibernateObjectRetrievalFailureException"/> class.
@@ -60,12 +49,12 @@ namespace Spring.Data.NHibernate
{
}
/// <summary>
/// Initializes a new instance of the <see cref="HibernateObjectRetrievalFailureException"/> class.
/// </summary>
/// <param name="ex">The ex.</param>
public HibernateObjectRetrievalFailureException(UnresolvableObjectException ex) : base(ex.PersistentClass, ex.Identifier, ex.Message, ex)
public HibernateObjectRetrievalFailureException(UnresolvableObjectException ex) : base(ex.PersistentClass,
ex.Identifier, ex.Message, ex)
{
}
@@ -73,8 +62,9 @@ namespace Spring.Data.NHibernate
/// Initializes a new instance of the <see cref="HibernateObjectRetrievalFailureException"/> class.
/// </summary>
/// <param name="ex">The ex.</param>
public HibernateObjectRetrievalFailureException(ObjectNotFoundException ex) : base(ex.PersistentClass, ex.Identifier, ex.Message, ex)
public HibernateObjectRetrievalFailureException(ObjectNotFoundException ex) : base(ex.PersistentClass,
ex.Identifier, ex.Message, ex)
{
}
@@ -82,9 +72,9 @@ namespace Spring.Data.NHibernate
/// Initializes a new instance of the <see cref="HibernateObjectRetrievalFailureException"/> class.
/// </summary>
/// <param name="ex">The ex.</param>
public HibernateObjectRetrievalFailureException(ObjectDeletedException ex) : base(ex.PersistentClass, ex.Identifier, ex.Message, ex)
public HibernateObjectRetrievalFailureException(ObjectDeletedException ex) : base(ex.PersistentClass,
ex.Identifier, ex.Message, ex)
{
}
//TODO investigate WrongClassException.Type as equivalent to ex.PersistentClass
@@ -92,8 +82,9 @@ namespace Spring.Data.NHibernate
/// Initializes a new instance of the <see cref="HibernateObjectRetrievalFailureException"/> class.
/// </summary>
/// <param name="ex">The ex.</param>
public HibernateObjectRetrievalFailureException(WrongClassException ex) : base(ex.EntityName, ex.Identifier, ex.Message, ex)
{
public HibernateObjectRetrievalFailureException(WrongClassException ex) : base(ex.EntityName, ex.Identifier,
ex.Message, ex)
{
}
/// <summary>
@@ -111,24 +102,10 @@ namespace Spring.Data.NHibernate
{
}
/// <summary>
/// Creates a new instance of the
/// <see cref="HibernateObjectRetrievalFailureException"/> class.
/// </summary>
/// <param name="info">
/// The <see cref="System.Runtime.Serialization.SerializationInfo"/>
/// that holds the serialized object data about the exception being thrown.
/// </param>
/// <param name="context">
/// The <see cref="System.Runtime.Serialization.StreamingContext"/>
/// that contains contextual information about the source or destination.
/// </param>
/// <inheritdoc />
protected HibernateObjectRetrievalFailureException(
SerializationInfo info, StreamingContext context ) : base( info, context ) {}
#endregion
}
}
SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,17 +14,11 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Runtime.Serialization;
using NHibernate;
using Spring.Dao;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>
@@ -41,12 +33,6 @@ namespace Spring.Data.NHibernate
[Serializable]
public class HibernateOptimisticLockingFailureException : ObjectOptimisticLockingFailureException
{
#region Fields
#endregion
#region Constructor (s)
/// <summary>
/// Initializes a new instance of the <see cref="HibernateOptimisticLockingFailureException"/> class.
/// </summary>
@@ -61,13 +47,16 @@ namespace Spring.Data.NHibernate
/// <param name="message">
/// A message about the exception.
/// </param>
public HibernateOptimisticLockingFailureException(string message) : base(message) { }
public HibernateOptimisticLockingFailureException(string message) : base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="HibernateOptimisticLockingFailureException"/> class.
/// </summary>
/// <param name="ex">The ex.</param>
public HibernateOptimisticLockingFailureException(StaleObjectStateException ex) : base(ex.EntityName, ex.Identifier, ex.Message, ex)
public HibernateOptimisticLockingFailureException(StaleObjectStateException ex) : base(ex.EntityName,
ex.Identifier, ex.Message, ex)
{
}
@@ -76,8 +65,8 @@ namespace Spring.Data.NHibernate
/// </summary>
/// <param name="ex">The StaleStateException.</param>
public HibernateOptimisticLockingFailureException(StaleStateException ex) : base(ex.Message, ex)
{
}
{
}
/// <summary>
/// Creates a new instance of the HibernateOptimisticLockingFailureException class with the specified message
@@ -94,32 +83,10 @@ namespace Spring.Data.NHibernate
{
}
/// <summary>
/// Creates a new instance of the
/// <see cref="HibernateOptimisticLockingFailureException"/> class.
/// </summary>
/// <param name="info">
/// The <see cref="System.Runtime.Serialization.SerializationInfo"/>
/// that holds the serialized object data about the exception being thrown.
/// </param>
/// <param name="context">
/// The <see cref="System.Runtime.Serialization.StreamingContext"/>
/// that contains contextual information about the source or destination.
/// </param>
protected HibernateOptimisticLockingFailureException(SerializationInfo info, StreamingContext context) : base(info, context)
/// <inheritdoc />
protected HibernateOptimisticLockingFailureException(SerializationInfo info, StreamingContext context) : base(
info, context)
{
}
#endregion
#region Properties
#endregion
#region Methods
#endregion
}
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,17 +14,11 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Runtime.Serialization;
using NHibernate;
using Spring.Dao;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>
@@ -37,8 +29,6 @@ namespace Spring.Data.NHibernate
[Serializable]
public class HibernateQueryException : InvalidDataAccessResourceUsageException
{
#region Constructor (s)
/// <summary>
/// Initializes a new instance of the <see cref="HibernateQueryException"/> class.
/// </summary>
@@ -53,7 +43,9 @@ namespace Spring.Data.NHibernate
/// <param name="message">
/// A message about the exception.
/// </param>
public HibernateQueryException(string message) : base(message) { }
public HibernateQueryException(string message) : base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="HibernateQueryException"/> class.
@@ -87,22 +79,9 @@ namespace Spring.Data.NHibernate
get { return ((QueryException) this.InnerException).QueryString; }
}
/// <summary>
/// Creates a new instance of the
/// <see cref="HibernateQueryException"/> class.
/// </summary>
/// <param name="info">
/// The <see cref="System.Runtime.Serialization.SerializationInfo"/>
/// that holds the serialized object data about the exception being thrown.
/// </param>
/// <param name="context">
/// The <see cref="System.Runtime.Serialization.StreamingContext"/>
/// that contains contextual information about the source or destination.
/// </param>
/// <inheritdoc />
protected HibernateQueryException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
#endregion
}
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,42 +14,34 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Runtime.Serialization;
using NHibernate;
using Spring.Dao;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>
/// <summary>
/// Hibernate-specific subclass of UncategorizedDataAccessException,
/// for Hibernate system errors that do not match any concrete
/// <code>Spring.Dao</code> exceptions.
/// </summary>
/// <author>Mark Pollack (.NET)</author>
[Serializable]
public class HibernateSystemException : UncategorizedDataAccessException
{
#region Constructor (s)
/// <summary>
/// Initializes a new instance of the <see cref="HibernateSystemException"/> class.
/// </summary>
/// <author>Mark Pollack (.NET)</author>
[Serializable]
public class HibernateSystemException : UncategorizedDataAccessException
{
/// <summary>
/// Initializes a new instance of the <see cref="HibernateSystemException"/> class.
/// </summary>
public HibernateSystemException()
{
}
public HibernateSystemException()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="HibernateSystemException"/> class.
/// </summary>
/// <param name="message">The message.</param>
public HibernateSystemException(string message): base(message)
public HibernateSystemException(string message) : base(message)
{
}
@@ -75,26 +65,11 @@ namespace Spring.Data.NHibernate
/// <param name="cause">The cause.</param>
public HibernateSystemException(HibernateException cause) : base(cause != null ? cause.Message : null, cause)
{
}
/// <summary>
/// Creates a new instance of the
/// <see cref="HibernateSystemException"/> class.
/// </summary>
/// <param name="info">
/// The <see cref="System.Runtime.Serialization.SerializationInfo"/>
/// that holds the serialized object data about the exception being thrown.
/// </param>
/// <param name="context">
/// The <see cref="System.Runtime.Serialization.StreamingContext"/>
/// that contains contextual information about the source or destination.
/// </param>
protected HibernateSystemException( SerializationInfo info, StreamingContext context ) : base( info, context ) {}
#endregion
}
}
/// <inheritdoc />
protected HibernateSystemException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright © 2002-2011 the original author or authors.
*
@@ -16,10 +14,6 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Collections;
@@ -37,8 +31,6 @@ using NHibernate.Type;
using Spring.Dao;
using Spring.Objects.Factory;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>
@@ -76,8 +68,6 @@ namespace Spring.Data.NHibernate
/// <author>Mark Pollack (.NET)</author>
public class HibernateTemplate : HibernateAccessor, IHibernateOperations
{
#region Fields
/// <summary>
/// The <see cref="ILog"/> instance for this class.
/// </summary>
@@ -103,10 +93,6 @@ namespace Spring.Data.NHibernate
private readonly object syncRoot = new object();
private ProxyFactory sessionProxyFactory;
#endregion
#region Constructor (s)
/// <summary>
/// Initializes a new instance of the <see cref="HibernateTemplate"/> class.
/// </summary>
@@ -141,10 +127,6 @@ namespace Spring.Data.NHibernate
AfterPropertiesSet();
}
#endregion
#region Properties
/// <summary>
/// Gets or sets if a new Session should be created when no transactional Session
/// can be found for the current thread.
@@ -398,10 +380,6 @@ namespace Spring.Data.NHibernate
set { sessionProxyFactory = value; }
}
#endregion
#region IHibernateOperations Members
/// <summary>
/// Set the ADO.NET exception translator for this instance.
/// Applied to System.Data.Common.DbException (or provider specific exception type
@@ -646,7 +624,7 @@ namespace Spring.Data.NHibernate
Execute(new SaveOrUpdateAllHibernateCallback(this, entities), true);
}
#if !NH_4_0
#if !NH_4_0 && !NH_5
/// <summary>
/// Save or update the contents of given persistent object,
/// according to its id (matching the configured "unsaved-value"?).
@@ -1290,10 +1268,6 @@ namespace Spring.Data.NHibernate
return (IList) Execute(new FindByValueObjectHibernateCallback(this, queryString, valueObject), true);
}
#endregion
#region Methods
/// <summary>
/// Create a close-suppressing proxy for the given Hibernate Session.
/// The proxy also prepares returned Query and Criteria objects.
@@ -1366,12 +1340,8 @@ namespace Spring.Data.NHibernate
}
//TODO other combinations.
}
#endregion
}
#region Internal Supporting Callback Classes
//TODO see if can create common base class for some callbacks.
internal class ContainsHibernateCallback : IHibernateCallback
@@ -2144,7 +2114,7 @@ namespace Spring.Data.NHibernate
}
}
#if !NH_4_0
#if !NH_4_0 && !NH_5
internal class SaveOrUpdateCopyHibernateCallback : IHibernateCallback
{
private HibernateTemplate outer;
@@ -2205,6 +2175,4 @@ namespace Spring.Data.NHibernate
return session.Merge(entity);
}
}
#endregion
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,10 +14,6 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Data;
using System.Reflection;
@@ -37,8 +31,6 @@ using Spring.Transaction.Support;
using HibernateTransactionException = NHibernate.TransactionException;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>
@@ -65,8 +57,6 @@ namespace Spring.Data.NHibernate
/// <author>Mark Pollack (.NET)</author>
public class HibernateTransactionManager : AbstractPlatformTransactionManager, IResourceTransactionManager, IObjectFactoryAware, IInitializingObject
{
#region Fields
private ISessionFactory sessionFactory;
private IDbProvider dbProvider;
@@ -84,10 +74,6 @@ namespace Spring.Data.NHibernate
/// </summary>
private IObjectFactory objectFactory;
#endregion
#region Constructor (s)
/// <summary>
/// Initializes a new instance of the <see cref="HibernateTransactionManager"/> class.
/// </summary>
@@ -105,10 +91,6 @@ namespace Spring.Data.NHibernate
AfterPropertiesSet();
}
#endregion
#region Properties
/// <summary>
/// Gets or sets the db provider.
/// </summary>
@@ -264,13 +246,6 @@ namespace Spring.Data.NHibernate
set { autodetectDbProvider = value; }
}
#endregion
#region Methods
#endregion
/// <summary>
/// The object factory just needs to be known for resolving entity interceptor
/// It does not need to be set for any other mode of operation.

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,10 +14,6 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Data;
using System.Reflection;
@@ -36,8 +30,6 @@ using Spring.Objects.Factory;
using Spring.Transaction;
using Spring.Transaction.Support;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>
@@ -64,8 +56,6 @@ namespace Spring.Data.NHibernate
/// <author>Mark Pollack (.NET)</author>
public class HibernateTxScopeTransactionManager : AbstractPlatformTransactionManager, IResourceTransactionManager, IObjectFactoryAware, IInitializingObject
{
#region Fields
private ISessionFactory sessionFactory;
private IDbProvider dbProvider;
@@ -85,10 +75,6 @@ namespace Spring.Data.NHibernate
private TxScopeTransactionManager txScopeTranactionManager;
#endregion
#region Constructor (s)
/// <summary>
/// Initializes a new instance of the <see cref="HibernateTxScopeTransactionManager"/> class.
/// </summary>
@@ -107,10 +93,6 @@ namespace Spring.Data.NHibernate
AfterPropertiesSet();
}
#endregion
#region Properties
/// <summary>
/// Gets or sets the db provider.
/// </summary>
@@ -266,13 +248,6 @@ namespace Spring.Data.NHibernate
set { autodetectDbProvider = value; }
}
#endregion
#region Methods
#endregion
/// <summary>
/// The object factory just needs to be known for resolving entity interceptor
/// It does not need to be set for any other mode of operation.

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,17 +14,10 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using NHibernate;
using NHibernate.Type;
using Spring.Dao;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>
@@ -102,7 +93,7 @@ namespace Spring.Data.NHibernate
/// <param name="types"> Hibernate types of the parameters (or <code>null</code>)</param>
/// <returns>The number of entity instances deleted.</returns>
/// <exception cref="DataAccessException">In case of Hibernate errors</exception>
int Delete(String queryString, Object[] values, IType[] types);
int Delete(string queryString, object[] values, IType[] types);
/// <summary>
@@ -116,8 +107,6 @@ namespace Spring.Data.NHibernate
/// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void Flush();
#region Convenience methods for loading individual objects
/// <summary>
/// Load the persistent instance with the given identifier
/// into the given object, throwing an exception if not found.
@@ -162,11 +151,6 @@ namespace Spring.Data.NHibernate
/// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void Evict(object entity);
#endregion
#region Convenience methods for storing individual objects
/// <summary>
/// Obtain the specified lock level upon the given object, implicitly
/// checking whether the corresponding database entry still exists
@@ -222,7 +206,7 @@ namespace Spring.Data.NHibernate
/// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void SaveOrUpdate(object entity);
#if !NH_4_0
#if !NH_4_0 && !NH_5
/// <summary>
/// Save or update the contents of given persistent object,
/// according to its id (matching the configured "unsaved-value"?).
@@ -253,7 +237,5 @@ namespace Spring.Data.NHibernate
/// <returns>An updated persistent instance</returns>
/// <exception cref="DataAccessException">In case of Hibernate errors</exception>
object Merge(object entity);
#endregion
}
}
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,14 +14,8 @@
* limitations under the License.
*/
#endregion
#region Imports
using NHibernate;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,18 +14,12 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Collections;
using NHibernate;
using NHibernate.Type;
using Spring.Dao;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>
@@ -111,8 +103,7 @@ namespace Spring.Data.NHibernate
/// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList ExecuteFind(IHibernateCallback action);
#region Finder Methods
/// <summary>
/// <summary>
/// Execute a query for persistent instances.
/// </summary>
/// <param name="queryString">a query expressed in Hibernate's query language</param>
@@ -350,11 +341,7 @@ namespace Spring.Data.NHibernate
/// <exception cref="DataAccessException">In case of Hibernate errors</exception>
IList FindByValueObject(string queryString, object valueObject);
#endregion
#region Convenience methods for loading individual objects
/// <summary>
/// <summary>
/// Return the persistent instance of the given entity type
/// with the given identifier, or <code>null</code> if not found.
/// </summary>
@@ -413,14 +400,7 @@ namespace Spring.Data.NHibernate
IList LoadAll(Type entityType);
#endregion
#region Convenience methods for storing individual objects
/// <summary>
/// <summary>
/// Save or update all given persistent instances,
/// according to its id (matching the configured "unsaved-value"?).
/// </summary>
@@ -428,9 +408,5 @@ namespace Spring.Data.NHibernate
/// (to be associated with the Hibernate Session)he entities.</param>
/// <exception cref="DataAccessException">In case of Hibernate errors</exception>
void SaveOrUpdateAll(ICollection entities);
#endregion
}
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright © 2002-2011 the original author or authors.
*
@@ -16,16 +14,13 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Threading;
using System.Threading.Tasks;
using Common.Logging;
using NHibernate;
using NHibernate.Bytecode;
@@ -49,7 +44,11 @@ using Spring.Util;
using Environment = NHibernate.Cfg.Environment;
using Configuration = NHibernate.Cfg.Configuration;
#endregion
#if NH_5
using IDbConnection = System.Data.Common.DbConnection;
#else
using IDbConnection = System.Data.IDbConnection;
#endif
namespace Spring.Data.NHibernate
{
@@ -77,9 +76,7 @@ namespace Spring.Data.NHibernate
public class LocalSessionFactoryObject : IFactoryObject, IInitializingObject, IPersistenceExceptionTranslator, IDisposable
, IApplicationContextAware
{
#region Fields
private Configuration configuration;
private Configuration configuration;
private ISessionFactory sessionFactory;
@@ -93,9 +90,7 @@ namespace Spring.Data.NHibernate
private IDbProvider dbProvider;
private bool exposeTransactionAwareSessionFactory = false;
private IInterceptor entityInterceptor;
private IInterceptor entityInterceptor;
private INamingStrategy namingStrategy;
@@ -123,19 +118,12 @@ namespace Spring.Data.NHibernate
private IBytecodeProvider bytecodeProvider;
#endregion
#region Constants
/// <summary>
/// The shared <see cref="ILog"/> instance for this class (and derived classes).
/// </summary>
protected static readonly ILog log =
LogManager.GetLogger(typeof (LocalSessionFactoryObject));
#endregion
#region Constructor (s)
/// <summary>
/// Initializes a new instance of the <see cref="LocalSessionFactoryObject"/> class.
/// </summary>
@@ -144,17 +132,13 @@ namespace Spring.Data.NHibernate
}
#endregion
#region Properties
/// <summary>
/// <summary>
/// Setting the Application Context determines were resources are loaded from
/// </summary>
public IApplicationContext ApplicationContext
{
set { this.applicationContext = value; }
protected get { return this.applicationContext; }
set { applicationContext = value; }
protected get { return applicationContext; }
}
/// <summary>
@@ -170,8 +154,8 @@ namespace Spring.Data.NHibernate
}
return resourceLoader;
}
set { resourceLoader = value; }
}
set => resourceLoader = value;
}
/// <summary>
/// Sets the assemblies to load that contain mapping files.
@@ -179,7 +163,7 @@ namespace Spring.Data.NHibernate
/// <value>The mapping assemblies.</value>
public string[] MappingAssemblies
{
set { mappingAssemblies = value; }
set => mappingAssemblies = value;
}
/// <summary>
@@ -187,8 +171,8 @@ namespace Spring.Data.NHibernate
/// </summary>
public string[] ConfigFilenames
{
set { configFilenames = value; }
}
set => configFilenames = value;
}
/// <summary>
/// Sets the locations of Spring IResources that contain mapping
@@ -197,7 +181,7 @@ namespace Spring.Data.NHibernate
/// <value>The location of mapping resources.</value>
public string[] MappingResources
{
set { mappingResources = value;}
set => mappingResources = value;
}
/// <summary>
@@ -205,12 +189,9 @@ namespace Spring.Data.NHibernate
/// Allows access to configuration metadata stored there (rarely needed).
/// </summary>
/// <value>The hibernate configuration.</value>
public Configuration Configuration
{
get { return configuration; }
}
public Configuration Configuration => configuration;
/// <summary>
/// <summary>
/// Set NHibernate configuration properties, like "hibernate.dialect".
/// </summary>
/// <value>The hibernate properties.</value>
@@ -233,11 +214,8 @@ namespace Spring.Data.NHibernate
}
return hibernateProperties;
}
set
{
hibernateProperties = value;
}
}
set => hibernateProperties = value;
}
/// <summary>
/// Get or set the DataSource to be used by the SessionFactory.
@@ -252,9 +230,9 @@ namespace Spring.Data.NHibernate
/// </remarks>
public IDbProvider DbProvider
{
set { dbProvider = value; }
get { return dbProvider; }
}
set => dbProvider = value;
get => dbProvider;
}
/// <summary>
/// Gets or sets a value indicating whether to expose a transaction aware session factory.
@@ -262,14 +240,10 @@ namespace Spring.Data.NHibernate
/// <value>
/// <c>true</c> if want to expose transaction aware session factory; otherwise, <c>false</c>.
/// </value>
public bool ExposeTransactionAwareSessionFactory
{
set { exposeTransactionAwareSessionFactory = value; }
get { return exposeTransactionAwareSessionFactory; }
}
public bool ExposeTransactionAwareSessionFactory { set; get; } = false;
/// <summary>
/// <summary>
/// Set a NHibernate entity interceptor that allows to inspect and change
/// property values before writing to and reading from the database.
/// Will get applied to any new Session created by this factory.
@@ -283,7 +257,7 @@ namespace Spring.Data.NHibernate
/// <seealso cref="HibernateTransactionManager.EntityInterceptor" />
public IInterceptor EntityInterceptor
{
set { this.entityInterceptor = value; }
set => entityInterceptor = value;
}
/// <summary>
@@ -292,7 +266,7 @@ namespace Spring.Data.NHibernate
/// </summary>
public INamingStrategy NamingStrategy
{
set { this.namingStrategy = value; }
set => namingStrategy = value;
}
/// <summary>
@@ -306,7 +280,7 @@ namespace Spring.Data.NHibernate
/// </summary>
public IObjectDefinition[] TypeDefinitions
{
set { this.typeDefinitions = value; }
set => typeDefinitions = value;
}
@@ -323,8 +297,8 @@ namespace Spring.Data.NHibernate
/// <see cref="FilterDefinitionFactoryObject" />
public FilterDefinition[] FilterDefinitions
{
set { this.filterDefinitions = value; }
}
set => filterDefinitions = value;
}
/// <summary>
/// Specify the cache strategies for entities (persistent classes or named entities).
@@ -342,7 +316,7 @@ namespace Spring.Data.NHibernate
/// </summary>
public Properties EntityCacheStrategies
{
set { this.entityCacheStrategies = value; }
set => entityCacheStrategies = value;
}
/// <summary>
@@ -361,7 +335,7 @@ namespace Spring.Data.NHibernate
/// </summary>
public Properties CollectionCacheStrategies
{
set { this.collectionCacheStrategies = value; }
set => collectionCacheStrategies = value;
}
@@ -380,7 +354,7 @@ namespace Spring.Data.NHibernate
/// </remarks>
public IDictionary EventListeners
{
set { this.eventListeners = value; }
set => eventListeners = value;
}
/// <summary>
@@ -393,8 +367,8 @@ namespace Spring.Data.NHibernate
/// </summary>
public bool SchemaUpdate
{
set { schemaUpdate = value; }
}
set => schemaUpdate = value;
}
/// <summary>
/// Set the ADO.NET exception translator for this instance.
@@ -408,8 +382,8 @@ namespace Spring.Data.NHibernate
/// <value>The ADO exception translator.</value>
public virtual IAdoExceptionTranslator AdoExceptionTranslator
{
set { adoExceptionTranslator = value; }
get
set => adoExceptionTranslator = value;
get
{
if (adoExceptionTranslator == null)
{
@@ -426,17 +400,11 @@ namespace Spring.Data.NHibernate
/// </summary>
public virtual IBytecodeProvider BytecodeProvider
{
get { return this.bytecodeProvider; }
set { this.bytecodeProvider = value; }
}
get => bytecodeProvider;
set => bytecodeProvider = value;
}
#endregion
#region Methods
#endregion
/// <summary>
/// <summary>
/// Return the singleon session factory.
/// </summary>
/// <returns>The singleon session factory.</returns>
@@ -449,24 +417,15 @@ namespace Spring.Data.NHibernate
/// Return the type <see cref="ISessionFactory"/> or subclass.
/// </summary>
/// <value>The type created by this factory</value>
public Type ObjectType
{
get
{
return (sessionFactory != null) ? sessionFactory.GetType() : typeof(ISessionFactory);
}
}
public Type ObjectType => (sessionFactory != null) ? sessionFactory.GetType() : typeof(ISessionFactory);
/// <summary>
/// <summary>
/// Returns true
/// </summary>
/// <value>true</value>
public bool IsSingleton
{
get { return true; }
}
public bool IsSingleton => true;
/// <summary>
/// <summary>
/// Initialize the SessionFactory for the given or the
/// default location.
/// </summary>
@@ -475,11 +434,11 @@ namespace Spring.Data.NHibernate
// Create Configuration instance.
Configuration config = NewConfiguration();
if (this.dbProvider != null)
if (dbProvider != null)
{
config.SetProperty(Environment.ConnectionString, dbProvider.ConnectionString);
config.SetProperty(Environment.ConnectionProvider, typeof(DbProviderWrapper).AssemblyQualifiedName);
configTimeDbProvider = this.dbProvider;
configTimeDbProvider = dbProvider;
}
if (ExposeTransactionAwareSessionFactory)
@@ -490,19 +449,19 @@ namespace Spring.Data.NHibernate
config.SetProperty(Environment.CurrentSessionContextClass, typeof(SpringSessionContext).AssemblyQualifiedName);
}
if (this.entityInterceptor != null)
if (entityInterceptor != null)
{
// Set given entity interceptor at SessionFactory level.
config.SetInterceptor(this.entityInterceptor);
config.SetInterceptor(entityInterceptor);
}
if (this.namingStrategy != null)
if (namingStrategy != null)
{
// Pass given naming strategy to Hibernate Configuration.
config.SetNamingStrategy(this.namingStrategy);
config.SetNamingStrategy(namingStrategy);
}
if (this.typeDefinitions != null)
if (typeDefinitions != null)
{
// Register specified Hibernate type definitions.
IDictionary<string, string> typedProperties = new Dictionary<string, string>();
@@ -513,9 +472,9 @@ namespace Spring.Data.NHibernate
Dialect dialect = Dialect.GetDialect(typedProperties);
Mappings mappings = config.CreateMappings(dialect);
for (int i = 0; i < this.typeDefinitions.Length; i++)
for (int i = 0; i < typeDefinitions.Length; i++)
{
IObjectDefinition typeDef = this.typeDefinitions[i];
IObjectDefinition typeDef = typeDefinitions[i];
Dictionary<string, string> typedParamMap = new Dictionary<string, string>();
foreach (DictionaryEntry entry in typeDef.PropertyValues)
{
@@ -525,28 +484,27 @@ namespace Spring.Data.NHibernate
}
}
if (this.filterDefinitions != null)
if (filterDefinitions != null)
{
// Register specified NHibernate FilterDefinitions.
for (int i = 0; i < this.filterDefinitions.Length; i++)
for (int i = 0; i < filterDefinitions.Length; i++)
{
config.AddFilterDefinition(this.filterDefinitions[i]);
config.AddFilterDefinition(filterDefinitions[i]);
}
}
if (this.hibernateProperties != null)
if (hibernateProperties != null)
{
if (config.GetProperty(Environment.ConnectionProvider) != null &&
hibernateProperties.ContainsKey(Environment.ConnectionProvider))
{
#region Logging
if (log.IsInfoEnabled)
if (log.IsInfoEnabled)
{
log.Info("Overriding use of Spring's Hibernate Connection Provider with [" +
hibernateProperties[Environment.ConnectionProvider] + "]");
}
#endregion
config.Properties.Remove(Environment.ConnectionProvider);
config.Properties.Remove(Environment.ConnectionProvider);
}
Dictionary<string, string> genericHibernateProperties = new Dictionary<string, string>();
@@ -556,7 +514,7 @@ namespace Spring.Data.NHibernate
}
config.AddProperties(genericHibernateProperties);
}
if (this.mappingAssemblies != null)
if (mappingAssemblies != null)
{
foreach (string assemblyName in mappingAssemblies)
{
@@ -564,12 +522,12 @@ namespace Spring.Data.NHibernate
}
}
if (this.mappingResources != null)
if (mappingResources != null)
{
IResourceLoader loader = this.ResourceLoader;
IResourceLoader loader = ResourceLoader;
if (loader == null)
{
loader = this.applicationContext;
loader = applicationContext;
}
foreach (string resourceName in mappingResources)
{
@@ -590,12 +548,12 @@ namespace Spring.Data.NHibernate
PostProcessMappings(config);
config.BuildMappings();
if (this.entityCacheStrategies != null)
if (entityCacheStrategies != null)
{
// Register cache strategies for mapped entities.
foreach (string className in this.entityCacheStrategies.Keys)
foreach (string className in entityCacheStrategies.Keys)
{
string[] strategyAndRegion = StringUtils.CommaDelimitedListToStringArray(this.entityCacheStrategies.GetProperty(className));
string[] strategyAndRegion = StringUtils.CommaDelimitedListToStringArray(entityCacheStrategies.GetProperty(className));
if (strategyAndRegion.Length > 1)
{
config.SetCacheConcurrencyStrategy(className, strategyAndRegion[0], strategyAndRegion[1]);
@@ -607,12 +565,12 @@ namespace Spring.Data.NHibernate
}
}
if (this.collectionCacheStrategies != null)
if (collectionCacheStrategies != null)
{
// Register cache strategies for mapped collections.
foreach (string collRole in collectionCacheStrategies.Keys)
{
string[] strategyAndRegion = StringUtils.CommaDelimitedListToStringArray(this.collectionCacheStrategies.GetProperty(collRole));
string[] strategyAndRegion = StringUtils.CommaDelimitedListToStringArray(collectionCacheStrategies.GetProperty(collRole));
if (strategyAndRegion.Length > 1)
{
throw new Exception("Collection cache concurrency strategy region definition not supported yet");
@@ -625,7 +583,7 @@ namespace Spring.Data.NHibernate
}
}
if (this.eventListeners != null)
if (eventListeners != null)
{
// Register specified NHibernate event listeners.
foreach (DictionaryEntry entry in eventListeners)
@@ -674,8 +632,8 @@ namespace Spring.Data.NHibernate
// Build SessionFactory instance.
log.Info("Building new Hibernate SessionFactory");
this.configuration = config;
this.sessionFactory = NewSessionFactory(config);
configuration = config;
sessionFactory = NewSessionFactory(config);
AfterSessionFactoryCreation();
@@ -690,13 +648,12 @@ namespace Spring.Data.NHibernate
{
if (sessionFactory != null)
{
#region Instrumentation
if (log.IsInfoEnabled)
if (log.IsInfoEnabled)
{
log.Info("Closing Hibernate SessionFactory");
}
#endregion
sessionFactory.Close();
sessionFactory.Close();
}
}
@@ -748,7 +705,7 @@ namespace Spring.Data.NHibernate
/// </summary>
protected virtual void AfterSessionFactoryCreation()
{
if (this.schemaUpdate)
if (schemaUpdate)
{
UpdateDatabaseSchema();
}
@@ -934,31 +891,14 @@ namespace Spring.Data.NHibernate
return sf;
}
#region DbProviderWrapper Helper class
internal class DbProviderWrapper : ConnectionProvider
internal class DbProviderWrapper : ConnectionProvider
{
private IDbProvider _dbProvider;
public IDbProvider DbProvider { get; set; }
public DbProviderWrapper()
#if NH_5
public override async Task<DbConnection> GetConnectionAsync(CancellationToken cancellationToken)
{
}
public IDbProvider DbProvider
{
get { return _dbProvider; }
set { _dbProvider = value; }
}
public override void CloseConnection(IDbConnection conn)
{
base.CloseConnection(conn);
conn.Dispose();
}
public override IDbConnection GetConnection()
{
IDbProvider provider = _dbProvider;
IDbProvider provider = DbProvider;
if (provider == null && configTimeDbProvider != null)
{
// NH 2.1 has a need to access db provider before
@@ -971,17 +911,40 @@ namespace Spring.Data.NHibernate
{
throw new Exception("There was no DB provider available, unable to create connection");
}
IDbConnection dbCon = provider.CreateConnection();
var dbCon = (DbConnection) provider.CreateConnection();
await dbCon.OpenAsync(cancellationToken).ConfigureAwait(false);
return dbCon;
}
#endif
public override void CloseConnection(IDbConnection conn)
{
base.CloseConnection(conn);
conn.Dispose();
}
public override IDbConnection GetConnection()
{
IDbProvider provider = DbProvider;
if (provider == null && configTimeDbProvider != null)
{
// NH 2.1 has a need to access db provider before
// it has been set "the natural way" (it gets the DB's reserved words)
// allow it via configuration time db provider reference
provider = configTimeDbProvider;
}
if (provider == null)
{
throw new Exception("There was no DB provider available, unable to create connection");
}
var dbCon = (IDbConnection) provider.CreateConnection();
dbCon.Open();
return dbCon;
}
}
#endregion // DbProviderWrapper Helper class
#region IPersistenceExceptionTranslator Members
/// <summary>
/// <summary>
/// Implementation of the PersistenceExceptionTranslator interface,
/// as autodetected by Spring's PersistenceExceptionTranslationPostProcessor.
/// Converts the exception if it is a HibernateException;
@@ -1034,7 +997,5 @@ namespace Spring.Data.NHibernate
{
return SessionFactoryUtils.ConvertAdoAccessException(AdoExceptionTranslator, ex);
}
#endregion
}
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,10 +14,6 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Collections;
using System.Collections.Generic;
@@ -39,8 +33,6 @@ using Spring.Threading;
using Spring.Transaction.Support;
using Spring.Util;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>
@@ -51,18 +43,12 @@ namespace Spring.Data.NHibernate
/// <author>Mark Pollack (.NET)</author>
public abstract class SessionFactoryUtils
{
#region Fields
/// <summary>
/// <summary>
/// The <see cref="ILog"/> instance for this class.
/// </summary>
private static readonly ILog log = LogManager.GetLogger(typeof(SessionFactoryUtils));
#endregion
#region Constants
/// <summary>
/// <summary>
/// The ordering value for synchronizaiton this session resources.
/// Set to be lower than ADO.NET synchronization.
/// </summary>
@@ -71,10 +57,7 @@ namespace Spring.Data.NHibernate
private static readonly string DeferredCloseHolderDataSlotName = "Spring.Data.NHibernate:deferredCloseHolder";
#endregion
#region Constructor (s)
/// <summary>
/// <summary>
/// Initializes a new instance of the <see cref="SessionFactoryUtils"/> class.
/// </summary>
public SessionFactoryUtils()
@@ -82,15 +65,7 @@ namespace Spring.Data.NHibernate
}
#endregion
#region Properties
#endregion
#region Methods
/// <summary>
/// <summary>
/// Get a new Hibernate Session from the given SessionFactory.
/// Will return a new Session even if there already is a pre-bound
/// Session for the given SessionFactory.
@@ -401,9 +376,7 @@ namespace Spring.Data.NHibernate
return (sessionHolder != null && sessionHolder.ContainsSession(session));
}
#endregion
/// <summary>
/// <summary>
/// Converts a Hibernate ADOException to a Spring DataAccessExcption, extracting the underlying error code from
/// ADO.NET. Will extract the ADOException Message and SqlString properties and pass them to the translate method
/// of the provided IAdoExceptionTranslator.
@@ -699,6 +672,7 @@ namespace Spring.Data.NHibernate
IList<string> providerNames = ctx.GetObjectNamesForType(typeof(DbProvider), true, false);
string hibCommandAQN = hibCommandType.AssemblyQualifiedName;
string hibCommandAQNWithoutVersion = hibCommandType.FullName + ", " + hibCommandType.Assembly.GetName().Name;
foreach (string providerName in providerNames)
{
IObjectDefinition objectdef = ctx.ObjectFactory.GetObjectDefinition(providerName);
@@ -708,7 +682,7 @@ namespace Spring.Data.NHibernate
ConstructorArgumentValues dbmdCtorArgs = od.ConstructorArgumentValues;
string commandType = dbmdCtorArgs.GetArgumentValue("commandType", typeof(string)).Value as string;
if (hibCommandAQN.Equals(commandType))
if (hibCommandAQN.Equals(commandType) || hibCommandAQNWithoutVersion.Equals(commandType))
{
IDbProvider prov = DbProviderFactory.GetDbProvider(providerName);
return prov;

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,10 +14,6 @@
* limitations under the License.
*/
#endregion
#region Imports
using System.Collections;
using System.Collections.Generic;
using System.Data;
@@ -29,8 +23,6 @@ using NHibernate;
using Spring.Transaction.Support;
using Spring.Util;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>
@@ -44,9 +36,7 @@ namespace Spring.Data.NHibernate
/// <author>Mark Pollack (.NET)</author>
public class SessionHolder : ResourceHolderSupport
{
#region Fields
private static readonly object DEFAULT_KEY = new object();
private static readonly object DEFAULT_KEY = new object();
private readonly object sessionDictionaryLock = new object();
private readonly Dictionary<object, ISession> sessionDictionary = new Dictionary<object, ISession>(1);
@@ -60,16 +50,8 @@ namespace Spring.Data.NHibernate
//needed to see if we actually assigned the enum value...
private bool assignedPreviousFlushMode = false;
#endregion
#region Logging Definition
private static readonly ILog log = LogManager.GetLogger(typeof (SessionHolder));
#endregion
#region Constructor (s)
/// <summary>
/// May be used by derived classes to create an empty SessionHolder.
/// </summary>
@@ -106,12 +88,8 @@ namespace Spring.Data.NHibernate
{
// noop here - but may be overridden to lazily create a session
}
#endregion
#region Properties
/// <summary>
/// <summary>
/// Gets the session using the default key
/// </summary>
/// <value>The hibernate session.</value>
@@ -255,11 +233,7 @@ namespace Spring.Data.NHibernate
}
}
#endregion
#region Methods
/// <summary>
/// <summary>
/// Gets the session given key identifier
/// </summary>
/// <param name="key">The key.</param>
@@ -373,8 +347,5 @@ namespace Spring.Data.NHibernate
assignedPreviousFlushMode = false;
Connection = null;
}
#endregion
}
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,8 +14,6 @@
* limitations under the License.
*/
#endregion
using System;
using NHibernate;
using NHibernate.Context;
@@ -52,8 +48,6 @@ namespace Spring.Data.NHibernate
this.sessionFactory = sessionFactory;
}
#region ICurrentSessionContext Members
/// <summary>
/// Retrieve the Spring-managed Session for the current thread.
/// </summary>
@@ -70,7 +64,5 @@ namespace Spring.Data.NHibernate
throw new HibernateException(ex.Message);
}
}
#endregion
}
}

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,10 +14,6 @@
* limitations under the License.
*/
#endregion
#region Imports
using Common.Logging;
using NHibernate;
using NHibernate.Engine;
@@ -27,23 +21,19 @@ using Spring.Core;
using Spring.Data.Support;
using Spring.Transaction.Support;
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>
/// NHibnerations actions taken during the transaction lifecycle.
/// </summary>
/// <author>Mark Pollack (.NET)</author>
public class SpringSessionSynchronization : TransactionSynchronizationAdapter, IOrdered
{
#region Fields
/// <summary>
/// NHibnerations actions taken during the transaction lifecycle.
/// </summary>
/// <author>Mark Pollack (.NET)</author>
public class SpringSessionSynchronization : TransactionSynchronizationAdapter, IOrdered
{
/// <summary>
/// The <see cref="ILog"/> instance for this class.
/// </summary>
private readonly ILog log = LogManager.GetLogger(typeof(SpringSessionSynchronization));
private readonly SessionHolder sessionHolder;
private readonly ISessionFactory sessionFactory;
@@ -53,24 +43,18 @@ namespace Spring.Data.NHibernate
private readonly bool newSession;
private bool holderActive = true;
#endregion
#region Constructor (s)
/// <summary>
/// Initializes a new instance of the <see cref="SpringSessionSynchronization"/> class.
/// <summary>
/// Initializes a new instance of the <see cref="SpringSessionSynchronization"/> class.
/// </summary>
public SpringSessionSynchronization(SessionHolder sessionHolder, ISessionFactory sessionFactory,
IAdoExceptionTranslator adoExceptionTranslator, bool newSession)
{
public SpringSessionSynchronization(SessionHolder sessionHolder, ISessionFactory sessionFactory,
IAdoExceptionTranslator adoExceptionTranslator, bool newSession)
{
this.sessionHolder = sessionHolder;
this.sessionFactory = sessionFactory;
this.adoExceptionTranslator = adoExceptionTranslator;
this.newSession = newSession;
}
#endregion
#region Properties
}
/// <summary>
/// Return the order value of this object, where a higher value means greater in
@@ -90,104 +74,96 @@ namespace Spring.Data.NHibernate
/// <returns>The order value.</returns>
public int Order
{
get
{
return SessionFactoryUtils.SESSION_SYNCHRONIZATION_ORDER;
}
get { return SessionFactoryUtils.SESSION_SYNCHRONIZATION_ORDER; }
}
#endregion
#region Methods
/// <summary>
/// Suspend this synchronization.
/// </summary>
/// <remarks>
/// <p>
/// Unbind Hibernate resources (SessionHolder) from
/// <see cref="Spring.Transaction.Support.TransactionSynchronizationManager"/>
/// if managing any.
/// </p>
/// </remarks>
public override void Suspend()
{
if (this.holderActive)
/// <summary>
/// Suspend this synchronization.
/// </summary>
/// <remarks>
/// <p>
/// Unbind Hibernate resources (SessionHolder) from
/// <see cref="Spring.Transaction.Support.TransactionSynchronizationManager"/>
/// if managing any.
/// </p>
/// </remarks>
public override void Suspend()
{
if (this.holderActive)
{
TransactionSynchronizationManager.UnbindResource(this.sessionFactory);
}
}
}
/// <summary>
/// Resume this synchronization.
/// </summary>
/// <remarks>
/// <p>
/// Rebind Hibernate resources from
/// <see cref="Spring.Transaction.Support.TransactionSynchronizationManager"/>
/// if managing any.
/// </p>
/// </remarks>
public override void Resume()
{
if (this.holderActive)
/// <summary>
/// Resume this synchronization.
/// </summary>
/// <remarks>
/// <p>
/// Rebind Hibernate resources from
/// <see cref="Spring.Transaction.Support.TransactionSynchronizationManager"/>
/// if managing any.
/// </p>
/// </remarks>
public override void Resume()
{
if (this.holderActive)
{
TransactionSynchronizationManager.BindResource(this.sessionFactory, this.sessionHolder);
}
}
}
/// <summary>
/// Invoked before transaction commit (before
/// <see cref="Spring.Transaction.Support.ITransactionSynchronization.BeforeCompletion"/>)
/// </summary>
/// <param name="readOnly">
/// If the transaction is defined as a read-only transaction.
/// </param>
/// <remarks>
/// <p>
/// Can flush transactional sessions to the database.
/// </p>
/// <p>
/// Note that exceptions will get propagated to the commit caller and
/// cause a rollback of the transaction.
/// </p>
/// </remarks>
public override void BeforeCommit(bool readOnly)
{
if (!readOnly)
{
/// <summary>
/// Invoked before transaction commit (before
/// <see cref="Spring.Transaction.Support.ITransactionSynchronization.BeforeCompletion"/>)
/// </summary>
/// <param name="readOnly">
/// If the transaction is defined as a read-only transaction.
/// </param>
/// <remarks>
/// <p>
/// Can flush transactional sessions to the database.
/// </p>
/// <p>
/// Note that exceptions will get propagated to the commit caller and
/// cause a rollback of the transaction.
/// </p>
/// </remarks>
public override void BeforeCommit(bool readOnly)
{
if (!readOnly)
{
// read-write transaction -> flush the Hibernate Session
log.Debug("Flushing Hibernate Session on transaction synchronization");
log.Debug("Flushing Hibernate Session on transaction synchronization");
ISession session = this.sessionHolder.Session;
//Further check: only flush when not FlushMode.NEVER
if (session.FlushMode != FlushMode.Never)
{
try
try
{
session.Flush();
//TODO can throw System.ObjectDisposedException...
}
catch (ADOException ex)
catch (ADOException ex)
{
if (this.adoExceptionTranslator != null)
if (this.adoExceptionTranslator != null)
{
//TODO investigate how ADOException wraps inner exception.
throw this.adoExceptionTranslator.Translate(
"Hibernate transaction synchronization: " + ex.Message, null, ex.InnerException);
}
else
else
{
throw new HibernateAdoException("ADO.NET Exception", ex);
}
}
catch (HibernateException ex)
catch (HibernateException ex)
{
throw SessionFactoryUtils.ConvertHibernateAccessException(ex);
}
}
}
}
}
}
/// <summary>
/// Invoked before transaction commit (before
@@ -209,67 +185,66 @@ namespace Spring.Data.NHibernate
/// (note: do not throw TransactionException subclasses here!)
/// </para>
/// </remarks>
public override void BeforeCompletion()
{
if (this.newSession)
public override void BeforeCompletion()
{
if (this.newSession)
{
// Default behavior: unbind and close the thread-bound Hibernate Session.
TransactionSynchronizationManager.UnbindResource(this.sessionFactory);
this.holderActive = false;
}
else if (this.sessionHolder.AssignedPreviousFlushMode == true)
else if (this.sessionHolder.AssignedPreviousFlushMode == true)
{
// In case of pre-bound Session, restore previous flush mode.
this.sessionHolder.Session.FlushMode = (this.sessionHolder.PreviousFlushMode);
}
}
}
/// <summary>
/// Invoked after transaction commit/rollback.
/// </summary>
/// <param name="status">
/// Status according to <see cref="Spring.Transaction.Support.TransactionSynchronizationStatus"/>
/// </param>
/// <remarks>
/// Can e.g. perform resource cleanup, in this case after transaction completion.
/// <p>
/// Note that exceptions will get propagated to the commit or rollback
/// caller, although they will not influence the outcome of the transaction.
/// </p>
/// </remarks>
public override void AfterCompletion(TransactionSynchronizationStatus status)
{
if (!newSession)
{
/// <summary>
/// Invoked after transaction commit/rollback.
/// </summary>
/// <param name="status">
/// Status according to <see cref="Spring.Transaction.Support.TransactionSynchronizationStatus"/>
/// </param>
/// <remarks>
/// Can e.g. perform resource cleanup, in this case after transaction completion.
/// <p>
/// Note that exceptions will get propagated to the commit or rollback
/// caller, although they will not influence the outcome of the transaction.
/// </p>
/// </remarks>
public override void AfterCompletion(TransactionSynchronizationStatus status)
{
if (!newSession)
{
ISession session = sessionHolder.Session;
// Provide correct transaction status for releasing the Session's cache locks,
// if possible. Else, closing will release all cache locks assuming a rollback.
ISessionImplementor sessionImplementor = session as ISessionImplementor;
if (sessionImplementor != null)
{
sessionImplementor.AfterTransactionCompletion(status == TransactionSynchronizationStatus.Committed, sessionHolder.Transaction);
}
if (sessionImplementor != null)
{
sessionImplementor.AfterTransactionCompletion(status == TransactionSynchronizationStatus.Committed,
sessionHolder.Transaction);
}
if (newSession)
{
SessionFactoryUtils.CloseSessionOrRegisterDeferredClose(session, sessionFactory);
}
}
}
}
if (!newSession && status != TransactionSynchronizationStatus.Committed)
{
// Clear all pending inserts/updates/deletes in the Session.
// Necessary for pre-bound Sessions, to avoid inconsistent state.
sessionHolder.Session.Clear();
}
if (this.sessionHolder.DoesNotHoldNonDefaultSession) {
sessionHolder.SynchronizedWithTransaction = false;
}
if (this.sessionHolder.DoesNotHoldNonDefaultSession)
{
sessionHolder.SynchronizedWithTransaction = false;
}
}
#endregion
}
}
}

View File

@@ -1,5 +1,3 @@
#region Licence
/*
* Copyright © 2002-2011 the original author or authors.
*
@@ -16,10 +14,6 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using NHibernate;
using Spring.Context;
@@ -27,8 +21,6 @@ using Spring.Context.Support;
using Spring.Objects.Factory.Config;
using Spring.Util;
#endregion
namespace Spring.Data.NHibernate.Support
{
/// <summary>

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,17 +14,11 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using NHibernate;
using Spring.Dao;
using Spring.Dao.Support;
#endregion
namespace Spring.Data.NHibernate.Support
{
/// <summary>
@@ -49,14 +41,9 @@ namespace Spring.Data.NHibernate.Support
/// <author>Mark Pollack (.NET)</author>
public abstract class HibernateDaoSupport : DaoSupport
{
#region Fields
private HibernateTemplate hibernateTemplate;
#endregion
private HibernateTemplate hibernateTemplate;
#region Constructor (s)
/// <summary>
/// <summary>
/// Initializes a new instance of the <see cref="HibernateDaoSupport"/> class.
/// </summary>
public HibernateDaoSupport()
@@ -64,11 +51,7 @@ namespace Spring.Data.NHibernate.Support
}
#endregion
#region Properties
/// <summary>
/// <summary>
/// Gets or sets the hibernate template.
/// </summary>
/// <remarks>Set the HibernateTemplate for this DAO explicitly,
@@ -129,13 +112,7 @@ namespace Spring.Data.NHibernate.Support
}
}
#endregion
#region Methods
/// <summary>
/// <summary>
/// Create a HibernateTemplate for the given ISessionFactory.
/// </summary>
/// <remarks>
@@ -227,10 +204,5 @@ namespace Spring.Data.NHibernate.Support
protected void ReleaseSession(ISession session) {
SessionFactoryUtils.ReleaseSession(session, SessionFactory);
}
#endregion
}
}

View File

@@ -1,5 +1,3 @@
#region Licence
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,10 +14,6 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using System.Reflection;
@@ -29,8 +23,6 @@ using Spring.Threading;
using Spring.Transaction.Support;
using Spring.Util;
#endregion
namespace Spring.Data.NHibernate.Support
{
/// <summary>
@@ -64,8 +56,6 @@ namespace Spring.Data.NHibernate.Support
/// <author>Harald Radi (.NET)</author>
public class SessionScope : IDisposable
{
#region Fields
/// <summary>
/// The logging instance.
/// </summary>
@@ -77,10 +67,6 @@ namespace Spring.Data.NHibernate.Support
private readonly string PARTICIPATE_KEY;
private readonly string ISOPEN_KEY;
#endregion
#region Constructor (s)
/// <summary>
/// Initializes a new instance of the <see cref="SessionScope"/> class in single session mode,
/// associating a session with the thread. The session is opened lazily on demand.
@@ -209,10 +195,6 @@ namespace Spring.Data.NHibernate.Support
}
}
#endregion
#region Properties
/// <summary>
/// Set whether to use a single session for each request. Default is "true".
/// If set to false, each data access operation or transaction will use
@@ -313,10 +295,6 @@ namespace Spring.Data.NHibernate.Support
}
}
#endregion
#region IDisposable Members
/// <summary>
/// Call <code>Close()</code>,
/// </summary>
@@ -325,10 +303,6 @@ namespace Spring.Data.NHibernate.Support
Close();
}
#endregion
#region Methods
/// <summary>
/// Opens a new session or participates in an existing session and
/// registers with spring's <see cref="TransactionSynchronizationManager"/>.
@@ -434,10 +408,6 @@ namespace Spring.Data.NHibernate.Support
return session;
}
#endregion
#region LazySessionHolder utility class
/// <summary>
/// This sessionHolder creates a default session only if it is needed.
/// </summary>
@@ -488,7 +458,5 @@ namespace Spring.Data.NHibernate.Support
if (log.IsDebugEnabled) log.Debug("Closed LazySessionHolder");
}
}
#endregion
}
}

View File

@@ -1,5 +1,3 @@
#region Licence
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,16 +14,10 @@
* limitations under the License.
*/
#endregion
#region Imports
using System;
using NHibernate;
using Spring.Util;
#endregion
namespace Spring.Data.NHibernate.Support
{
/// <summary>
@@ -113,8 +105,6 @@ namespace Spring.Data.NHibernate.Support
this.defaultFlushMode = defaultFlushMode;
}
#region Properties
/// <summary>
/// Gets the configured <see cref="IInterceptor"/> instance to be used.
/// </summary>
@@ -187,8 +177,6 @@ namespace Spring.Data.NHibernate.Support
set { defaultFlushMode = value; }
}
#endregion
/// <summary>
/// Override this method to resolve an <see cref="IInterceptor"/> instance according to your chosen strategy.
/// </summary>

View File

@@ -1,5 +1,3 @@
#region License
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,9 +14,6 @@
* limitations under the License.
*/
#endregion
namespace Spring.Data.NHibernate
{
/// <summary>

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" ?>
<project name="Spring.Data.NHibernate3" default="build" 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">
<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"
>
<arg line="${compiler.args}"/>
<nowarn>
<warning number="${nowarn.numbers},0169,0618" />
<warning number="0219" if="${nant.settings.currentframework=='mono-2.0'}"/>
</nowarn>
<sources failonempty="true">
<include name="**/*.cs" />
<include name="../Spring.Data.NHibernate/Data/**/*.cs" />
<include name="../GenCommonAssemblyInfo.cs" />
</sources>
<references>
<include name="mscorlib.dll"/>
<include name="Microsoft.CSharp.dll"/>
<include name="System.dll"/>
<include name="System.Core.dll"/>
<include name="System.Configuration.dll"/>
<include name="System.Data.dll" />
<include name="System.Transactions.dll" />
<include name="System.Web.dll" />
<include name="System.Xml.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="${nh3.lib.dir}/NHibernate.dll"/>
<include name="${iesi3.lib.dir}/Iesi.Collections.dll"/>
</references>
</csc>
</target>
</project>

View File

@@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyTitle("Spring.Net NHibernate 3.3 support")]
[assembly: AssemblyDescription("Interfaces and classes that provide NHibernate 3.3 support in Spring.Net")]
[assembly: AssemblyTitle("Spring.Net NHibernate 4.0 support")]
[assembly: AssemblyDescription("Interfaces and classes that provide NHibernate 4.0 support in Spring.Net")]

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" ?>
<project name="Spring.Data.NHibernate4" default="build" 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">
<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"
>
<arg line="${compiler.args}"/>
<nowarn>
<warning number="${nowarn.numbers},0169,0618,1684,1701" />
<warning number="0219" if="${nant.settings.currentframework=='mono-2.0'}"/>
</nowarn>
<sources failonempty="true">
<include name="**/*.cs" />
<include name="../Spring.Data.NHibernate/Data/**/*.cs" />
<include name="../GenCommonAssemblyInfo.cs" />
</sources>
<references>
<include name="mscorlib.dll"/>
<include name="Microsoft.CSharp.dll"/>
<include name="System.dll"/>
<include name="System.Core.dll"/>
<include name="System.Configuration.dll"/>
<include name="System.Data.dll" />
<include name="System.Transactions.dll" />
<include name="System.Web.dll" />
<include name="System.Xml.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="${nh4.lib.dir}/NHibernate.dll"/>
<include name="${iesi4.lib.dir}/Iesi.Collections.dll"/>
</references>
</csc>
</target>
</project>

View File

@@ -0,0 +1,4 @@
using System.Reflection;
[assembly: AssemblyTitle("Spring.Net NHibernate 5.0 support")]
[assembly: AssemblyDescription("Interfaces and classes that provide NHibernate 5.0 support in Spring.Net")]

View File

@@ -0,0 +1 @@
sources are linked here from Spring.Data.NHibernate21

View File

@@ -0,0 +1 @@
sources are linked here from Spring.Data.NHibernate

View File

@@ -0,0 +1 @@
sources are linked here from Spring.Data.NHibernate

View File

@@ -0,0 +1,149 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<Description>Interfaces and classes that provide NHibernate 5 support in Spring.Net</Description>
<DefineConstants>$(DefineConstants);NH_5</DefineConstants>
<NoWarn>0618</NoWarn>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Spring.Aop\Spring.Aop.2010.csproj" />
<ProjectReference Include="..\Spring.Core\Spring.Core.2010.csproj" />
<ProjectReference Include="..\Spring.Data\Spring.Data.2010.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NHibernate" Version="5.1.3" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<Reference Include="System.Configuration" />
<Reference Include="System.Transactions" />
<Reference Include="System.Web" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\GenCommonAssemblyInfo.cs">
<Link>GenCommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Bytecode\BytecodeProvider.cs">
<Link>Data\NHibernate\Bytecode\BytecodeProvider.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Bytecode\LazyInitializer.cs">
<Link>Data\NHibernate\Bytecode\LazyInitializer.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Bytecode\ObjectsFactory.cs">
<Link>Data\NHibernate\Bytecode\ObjectsFactory.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Bytecode\ProxyFactory.cs">
<Link>Data\NHibernate\Bytecode\ProxyFactory.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Bytecode\ProxyFactoryFactory.cs">
<Link>Data\NHibernate\Bytecode\ProxyFactoryFactory.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Bytecode\ReflectionOptimizer.cs">
<Link>Data\NHibernate\Bytecode\ReflectionOptimizer.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\DelegatingLocalSessionFactoryObject.cs">
<Link>Data\NHibernate\DelegatingLocalSessionFactoryObject.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\DelegatingSessionFactory.cs">
<Link>Data\NHibernate\DelegatingSessionFactory.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\FilterDefinitionFactoryObject.cs">
<Link>Data\NHibernate\FilterDefinitionFactoryObject.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Generic\FindHibernateDelegate.cs">
<Link>Data\NHibernate\Generic\FindHibernateDelegate.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Generic\HibernateDaoSupport.cs">
<Link>Data\NHibernate\Generic\HibernateDaoSupport.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Generic\HibernateDelegate.cs">
<Link>Data\NHibernate\Generic\HibernateDelegate.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Generic\HibernateTemplate.cs">
<Link>Data\NHibernate\Generic\HibernateTemplate.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Generic\IFindHibernateCallback.cs">
<Link>Data\NHibernate\Generic\IFindHibernateCallback.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Generic\IHibernateCallback.cs">
<Link>Data\NHibernate\Generic\IHibernateCallback.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Generic\IHibernateOperations.cs">
<Link>Data\NHibernate\Generic\IHibernateOperations.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\HibernateAccessor.cs">
<Link>Data\NHibernate\HibernateAccessor.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\HibernateAdoException.cs">
<Link>Data\NHibernate\HibernateAdoException.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\HibernateDelegate.cs">
<Link>Data\NHibernate\HibernateDelegate.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\HibernateObjectRetrievalFailureException.cs">
<Link>Data\NHibernate\HibernateObjectRetrievalFailureException.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\HibernateOptimisticLockingFailureException.cs">
<Link>Data\NHibernate\HibernateOptimisticLockingFailureException.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\HibernateQueryException.cs">
<Link>Data\NHibernate\HibernateQueryException.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\HibernateSystemException.cs">
<Link>Data\NHibernate\HibernateSystemException.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\HibernateTemplate.cs">
<Link>Data\NHibernate\HibernateTemplate.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\HibernateTransactionManager.cs">
<Link>Data\NHibernate\HibernateTransactionManager.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\HibernateTxScopeTransactionManager.cs">
<Link>Data\NHibernate\HibernateTxScopeTransactionManager.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\ICommonHibernateOperations.cs">
<Link>Data\NHibernate\ICommonHibernateOperations.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\IHibernateCallback.cs">
<Link>Data\NHibernate\IHibernateCallback.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\IHibernateOperations.cs">
<Link>Data\NHibernate\IHibernateOperations.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\LocalSessionFactoryObject.cs">
<Link>Data\NHibernate\LocalSessionFactoryObject.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\SessionFactoryUtils.cs">
<Link>Data\NHibernate\SessionFactoryUtils.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\SessionHolder.cs">
<Link>Data\NHibernate\SessionHolder.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\SimpleDelegatingSessionFactory.cs">
<Link>Data\NHibernate\SimpleDelegatingSessionFactory.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\SpringSessionContext.cs">
<Link>Data\NHibernate\SpringSessionContext.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\SpringSessionSynchronization.cs">
<Link>Data\NHibernate\SpringSessionSynchronization.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Support\ConfigSectionSessionScopeSettings.cs">
<Link>Data\NHibernate\Support\ConfigSectionSessionScopeSettings.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Support\HibernateDaoSupport.cs">
<Link>Data\NHibernate\Support\HibernateDaoSupport.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Support\OpenSessionInViewModule.cs" Condition=" '$(TargetFramework)' == 'net461' ">
<Link>Data\NHibernate\Support\OpenSessionInViewModule.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Support\SessionScope.cs">
<Link>Data\NHibernate\Support\SessionScope.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\Support\SessionScopeSettings.cs">
<Link>Data\NHibernate\Support\SessionScopeSettings.cs</Link>
</Compile>
<Compile Include="..\Spring.Data.NHibernate\Data\NHibernate\TemplateFlushMode.cs">
<Link>Data\NHibernate\TemplateFlushMode.cs</Link>
</Compile>
</ItemGroup>
</Project>

View File

@@ -1,5 +1,3 @@
#region Licence
/*
* Copyright <20> 2002-2011 the original author or authors.
*
@@ -16,8 +14,6 @@
* limitations under the License.
*/
#endregion
using System;
using System.Collections.Generic;
@@ -42,8 +38,6 @@ namespace Spring.Data.Common
/// <author>Mark Pollack (.NET)</author>
public class DbProviderFactory
{
#region Constants
/// <summary>
/// The shared log instance for this class (and derived classes).
/// </summary>
@@ -57,15 +51,8 @@ namespace Spring.Data.Common
private static readonly string DBPROVIDER_CONTEXTNAME = "DBPROVIDERFACTORY_CONTEXT";
#endregion
#region Fields
private volatile static XmlApplicationContext ctx;
#endregion
#region Constructor (s)
/// <summary>
/// Initializes a new instance of the <see cref="DbProviderFactory"/> class.
/// </summary>
@@ -73,9 +60,6 @@ namespace Spring.Data.Common
{
}
#endregion
/// <summary>
/// Gets the DbProvider given an identifying name.
/// </summary>
@@ -131,13 +115,12 @@ namespace Spring.Data.Common
if (loader.GetResource(DBPROVIDER_ADDITIONAL_RESOURCE_NAME).Exists)
{
#region Instrumentation
if (log.IsDebugEnabled)
if (log.IsDebugEnabled)
{
log.Debug("Loading additional DbProviders from " + DBPROVIDER_ADDITIONAL_RESOURCE_NAME);
}
#endregion
ctx = new XmlApplicationContext(DBPROVIDER_CONTEXTNAME, true, new string[] { DBPROVIDER_DEFAULT_RESOURCE_NAME,
ctx = new XmlApplicationContext(DBPROVIDER_CONTEXTNAME, true, new string[] { DBPROVIDER_DEFAULT_RESOURCE_NAME,
DBPROVIDER_ADDITIONAL_RESOURCE_NAME});
}
else
@@ -148,7 +131,7 @@ namespace Spring.Data.Common
IList<string> dbProviderNames = ctx.GetObjectNames<IDbProvider>();
if (log.IsInfoEnabled)
{
log.Info(String.Format("{0} DbProviders Available. [{1}]", dbProviderNames.Count, StringUtils.CollectionToCommaDelimitedString(dbProviderNames)));
log.Info(string.Format("{0} DbProviders Available. [{1}]", dbProviderNames.Count, StringUtils.CollectionToCommaDelimitedString(dbProviderNames)));
}
}
catch (Exception e)

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.

View File

@@ -3,7 +3,10 @@
<!--
- Database Provider definitions.
-->
<objects xmlns='http://www.springframework.net'>
<objects
xmlns="http://www.springframework.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
<!-- SQL SERVER -->

View File

@@ -0,0 +1,298 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Database Provider definitions for .NET Core.
-->
<objects
xmlns="http://www.springframework.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
<!-- SQL SERVER -->
<alias name="SqlServer" alias="System.Data.SqlClient"/>
<object id="SqlServer" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false">
<constructor-arg name="dbMetaData">
<object type="Spring.Data.Common.DbMetadata">
<constructor-arg name="productName" value="Microsoft SQL Server" />
<constructor-arg name="assemblyName" value="System.Data.SqlClient"/>
<constructor-arg name="connectionType" value="System.Data.SqlClient.SqlConnection, System.Data.SqlClient"/>
<constructor-arg name="commandType" value="System.Data.SqlClient.SqlCommand, System.Data.SqlClient"/>
<constructor-arg name="parameterType" value="System.Data.SqlClient.SqlParameter, System.Data.SqlClient"/>
<constructor-arg name="dataAdapterType" value="System.Data.SqlClient.SqlDataAdapter, System.Data.SqlClient"/>
<constructor-arg name="commandBuilderType" value="System.Data.SqlClient.SqlCommandBuilder, System.Data.SqlClient"/>
<constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/>
<constructor-arg name="parameterDbType" value="System.Data.SqlDbType, System.Data.SqlClient"/>
<constructor-arg name="parameterDbTypeProperty" value="SqlDbType"/>
<constructor-arg name="parameterIsNullableProperty" value="IsNullable"/>
<constructor-arg name="parameterNamePrefix" value="@"/>
<constructor-arg name="exceptionType" value="System.Data.SqlClient.SqlException, System.Data.SqlClient"/>
<constructor-arg name="useParameterNamePrefixInParameterCollection" value="true"/>
<constructor-arg name="useParameterPrefixInSql" value="true"/>
<constructor-arg name="bindByName" value="true"/>
<!-- this is only true for .net 1.1 kept it here just in case we want to revert back to this strategy for
obtaining error codes-->
<constructor-arg name="errorCodeExceptionExpression" value="Errors[0].Number.ToString()"/>
<!-- TODO select form system db all errors that have 'incorrect syntax' at the start of the error string-->
<property name="ErrorCodes.BadSqlGrammarCodes">
<value>102,156,170,207,208</value>
</property>
<property name="ErrorCodes.PermissionDeniedCodes">
<value>229</value>
</property>
<property name="ErrorCodes.DataIntegrityViolationCodes">
<value>544,2627,8114,8115</value>
</property>
<property name="ErrorCodes.DeadlockLoserCodes">
<value>1205</value>
</property>
</object>
</constructor-arg>
</object>
<!-- ORACLE -->
<alias name="Oracle" alias="System.Data.OracleClient"/>
<object id="Oracle" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false">
<constructor-arg name="dbMetaData">
<object type="Spring.Data.Common.DbMetadata">
<constructor-arg name="productName" value="Oracle, Oracle Managed provider V4.121.1.0" />
<constructor-arg name="assemblyName" value="Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
<constructor-arg name="connectionType" value="Oracle.ManagedDataAccess.Client.OracleConnection, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
<constructor-arg name="commandType" value="Oracle.ManagedDataAccess.Client.OracleCommand, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
<constructor-arg name="parameterType" value="Oracle.ManagedDataAccess.Client.OracleParameter, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
<constructor-arg name="dataAdapterType" value="Oracle.ManagedDataAccess.Client.OracleDataAdapter, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
<constructor-arg name="commandBuilderType" value="Oracle.ManagedDataAccess.Client.OracleCommandBuilder, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
<constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/>
<constructor-arg name="parameterDbType" value="Oracle.ManagedDataAccess.Client.OracleDbType, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
<constructor-arg name="parameterDbTypeProperty" value="OracleDbType"/>
<constructor-arg name="parameterIsNullableProperty" value="IsNullable"/>
<constructor-arg name="parameterNamePrefix" value=":"/>
<constructor-arg name="exceptionType" value="Oracle.ManagedDataAccess.Client.OracleException, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
<constructor-arg name="useParameterNamePrefixInParameterCollection" value="false"/>
<constructor-arg name="useParameterPrefixInSql" value="true"/>
<constructor-arg name="bindByName" value="true"/>
<!-- this is only true for .net 1.1 kept it here just in case we want to revert back to this strategy for
obtaining error codes-->
<constructor-arg name="errorCodeExceptionExpression" value="Number.ToString()"/>
<property name="ErrorCodes.BadSqlGrammarCodes">
<value>900,903,904,917,936,942,17006</value>
</property>
<property name="ErrorCodes.InvalidResultSetAccessCodes">
<value>17003</value>
</property>
<property name="ErrorCodes.DuplicateKeyCodes">
<value>1</value>
</property>
<property name="ErrorCodes.DataAccessResourceFailureCodes">
<value>17002,17447</value>
</property>
<property name="ErrorCodes.DataIntegrityViolationCodes">
<value>1,1400,1722,2291,2292</value>
</property>
<property name="ErrorCodes.CannotAcquireLockCodes">
<value>54</value>
</property>
<property name="ErrorCodes.CannotSerializeTransactionCodes">
<value>8177</value>
</property>
<property name="ErrorCodes.DeadlockLoserCodes">
<value>60</value>
</property>
</object>
</constructor-arg>
</object>
<!-- My Sql -->
<alias name="MySql" alias="MySql.Data.MySqlClient"/>
<object id="MySql" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false">
<constructor-arg name="dbMetaData">
<object type="Spring.Data.Common.DbMetadata">
<constructor-arg name="productName" value="MySQL" />
<constructor-arg name="assemblyName" value="MySql.Data"/>
<constructor-arg name="connectionType" value="MySql.Data.MySqlClient.MySqlConnection, MySql.Data"/>
<constructor-arg name="commandType" value="MySql.Data.MySqlClient.MySqlCommand, MySql.Data"/>
<constructor-arg name="parameterType" value="MySql.Data.MySqlClient.MySqlParameter, MySql.Data"/>
<constructor-arg name="dataAdapterType" value="MySql.Data.MySqlClient.MySqlDataAdapter, MySql.Data"/>
<constructor-arg name="commandBuilderType" value="MySql.Data.MySqlClient.MySqlCommandBuilder, MySql.Data"/>
<constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/>
<constructor-arg name="parameterDbType" value="MySql.Data.MySqlClient.MySqlDbType, MySql.Data"/>
<constructor-arg name="parameterDbTypeProperty" value="MySqlDbType"/>
<constructor-arg name="parameterIsNullableProperty" value="IsNullable"/>
<constructor-arg name="parameterNamePrefix" value="@"/>
<constructor-arg name="exceptionType" value="MySql.Data.MySqlClient.MySqlException, MySql.Data"/>
<constructor-arg name="useParameterNamePrefixInParameterCollection" value="true"/>
<constructor-arg name="useParameterPrefixInSql" value="true"/>
<constructor-arg name="bindByName" value="true"/>
<!-- this is only true for .net 1.1 kept it here just in case we want to revert back to this strategy for
obtaining error codes-->
<constructor-arg name="errorCodeExceptionExpression" value="Number.ToString()"/>
<property name="ErrorCodes.badSqlGrammarCodes">
<value>1054,1064,1146</value>
</property>
<property name="ErrorCodes.DataAccessResourceFailureCodes">
<value>1</value>
</property>
<property name="ErrorCodes.DataIntegrityViolationCodes">
<value>630,839,840,893,1062,1169,1215,1216,1217,1451,1452,1557</value>
</property>
<property name="ErrorCodes.CannotAcquireLockCodes">
<value>1205</value>
</property>
<property name="ErrorCodes.DeadlockLoserCodes">
<value>1213</value>
</property>
</object>
</constructor-arg>
</object>
<object id="Npgsql" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false">
<constructor-arg name="dbMetaData">
<object type="Spring.Data.Common.DbMetadata, Spring.Data">
<constructor-arg name="productName" value="Npgsql" />
<constructor-arg name="assemblyName" value="Npgsql"/>
<constructor-arg name="connectionType" value="Npgsql.NpgsqlConnection, Npgsql"/>
<constructor-arg name="commandType" value="Npgsql.NpgsqlCommand, Npgsql"/>
<constructor-arg name="parameterType" value="Npgsql.NpgsqlParameter, Npgsql"/>
<constructor-arg name="dataAdapterType" value="Npgsql.NpgsqlDataAdapter, Npgsql"/>
<constructor-arg name="commandBuilderType" value="Npgsql.NpgsqlCommandBuilder, Npgsql"/>
<constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/>
<constructor-arg name="parameterDbType" value="NpgsqlTypes.NpgsqlDbType, Npgsql"/>
<constructor-arg name="parameterDbTypeProperty" value="NpgsqlDbType"/>
<constructor-arg name="parameterIsNullableProperty" value="IsNullable"/>
<constructor-arg name="parameterNamePrefix" value=":"/>
<constructor-arg name="exceptionType" value="Npgsql.NpgsqlException, Npgsql"/>
<constructor-arg name="useParameterNamePrefixInParameterCollection" value="true"/>
<constructor-arg name="useParameterPrefixInSql" value="true"/>
<constructor-arg name="bindByName" value="true"/>
<!-- this is only true for .net 1.1 kept it here just in case we want to revert back to this strategy for
obtaining error codes-->
<constructor-arg name="errorCodeExceptionExpression" value="Errors[0].Code"/>
<!-- error codes taken from http://www.postgresql.org/docs/8.1/static/errcodes-appendix.html -->
<property name="ErrorCodes.badSqlGrammarCodes">
<value>03000,42000,42601,42602,42622,42804,42P01</value>
</property>
<property name="ErrorCodes.DataAccessResourceFailureCodes">
<value>53000,53100,53200,53300</value>
</property>
<property name="ErrorCodes.DataIntegrityViolationCodes">
<value>23000,23502,23503,23505,23514</value>
</property>
<property name="ErrorCodes.CannotAcquireLockCodes">
<value>55P03</value>
</property>
<property name="ErrorCodes.CannotSerializeTransactionCodes">
<value>40001</value>
</property>
<property name="ErrorCodes.DeadlockLoserCodes">
<value>40P01</value>
</property>
</object>
</constructor-arg>
</object>
<alias name="SQLite" alias="System.Data.SQLite"/>
<!--
from http://system.data.sqlite.org
* NuGet distributions: http://system.data.sqlite.org/index.html/doc/trunk/www/faq.wiki#q5
* NuGet page: http://www.nuget.org/packages/System.Data.SQLite
* Error code docs: http://www.sqlite.org/capi3ref.html#SQLITE_ABORT
-->
<object id="SQLite" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false">
<constructor-arg name="dbMetaData">
<object type="Spring.Data.Common.DbMetadata">
<constructor-arg name="productName" value="SQLite"/>
<constructor-arg name="assemblyName" value="System.Data.SQLite"/>
<constructor-arg name="connectionType" value="System.Data.SQLite.SQLiteConnection, System.Data.SQLite"/>
<constructor-arg name="commandType" value="System.Data.SQLite.SQLiteCommand, System.Data.SQLite"/>
<constructor-arg name="parameterType" value="System.Data.SQLite.SQLiteParameter, System.Data.SQLite"/>
<constructor-arg name="dataAdapterType" value="System.Data.SQLite.SQLiteDataAdapter , System.Data.SQLite"/>
<constructor-arg name="commandBuilderType" value="System.Data.SQLite.SQLiteCommandBuilder, System.Data.SQLite"/>
<constructor-arg name="commandBuilderDeriveParametersMethod" value="not supported"/>
<constructor-arg name="parameterDbType" value="System.Data.SQLite.TypeAffinity, System.Data.SQLite"/>
<constructor-arg name="parameterDbTypeProperty" value="DbType"/>
<constructor-arg name="parameterIsNullableProperty" value="IsNullable"/>
<constructor-arg name="parameterNamePrefix" value=":"/>
<constructor-arg name="exceptionType" value="System.Data.SQLite.SQLiteException, System.Data.SQLite"/>
<constructor-arg name="useParameterNamePrefixInParameterCollection" value="true"/>
<constructor-arg name="useParameterPrefixInSql" value="true"/>
<constructor-arg name="bindByName" value="true"/>
<!-- this is only true for .net 1.1 kept it here just in case we want to revert back to this strategy for
obtaining error codes-->
<constructor-arg name="errorCodeExceptionExpression" value="ErrorCode.ToString('D')"/>
<property name="ErrorCodes.badSqlGrammarCodes">
<value></value>
</property>
<property name="ErrorCodes.DataAccessResourceFailureCodes">
<value>1</value>
</property>
<property name="ErrorCodes.DataIntegrityViolationCodes">
<value></value>
</property>
<property name="ErrorCodes.CannotAcquireLockCodes">
<value>15</value>
</property>
<property name="ErrorCodes.DeadlockLoserCodes">
<value>5,6</value>
</property>
</object>
</constructor-arg>
</object>
<!-- Firebird -->
<alias name="Firebird" alias="FirebirdSql.Data.FirebirdClient"/>
<object id="Firebird" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false">
<constructor-arg name="dbMetaData">
<object type="Spring.Data.Common.DbMetadata">
<constructor-arg name="productName" value="Firebird Server" />
<constructor-arg name="assemblyName" value="FirebirdSql.Data.FirebirdClient"/>
<constructor-arg name="connectionType" value="FirebirdSql.Data.FirebirdClient.FbConnection, FirebirdSql.Data.FirebirdClient"/>
<constructor-arg name="commandType" value="FirebirdSql.Data.FirebirdClient.FbCommand, FirebirdSql.Data.FirebirdClient"/>
<constructor-arg name="parameterType" value="FirebirdSql.Data.FirebirdClient.FbParameter, FirebirdSql.Data.FirebirdClient"/>
<constructor-arg name="dataAdapterType" value="FirebirdSql.Data.FirebirdClient.FbDataAdapter, FirebirdSql.Data.FirebirdClient"/>
<constructor-arg name="commandBuilderType" value="FirebirdSql.Data.FirebirdClient.FbCommandBuilder, FirebirdSql.Data.FirebirdClient"/>
<constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/>
<constructor-arg name="parameterDbType" value="FirebirdSql.Data.FirebirdClient.FbDbType, FirebirdSql.Data.FirebirdClient"/>
<constructor-arg name="parameterDbTypeProperty" value="FbDbType"/>
<constructor-arg name="parameterIsNullableProperty" value="IsNullable"/>
<constructor-arg name="parameterNamePrefix" value="@"/>
<constructor-arg name="exceptionType" value="FirebirdSql.Data.FirebirdClient.FbException, FirebirdSql.Data.FirebirdClient"/>
<constructor-arg name="useParameterNamePrefixInParameterCollection" value="true"/>
<constructor-arg name="useParameterPrefixInSql" value="true"/>
<constructor-arg name="bindByName" value="true"/>
<!-- this is only true for .net 1.1 kept it here just in case we want to revert back to this strategy for
obtaining error codes-->
<constructor-arg name="errorCodeExceptionExpression" value="Errors[0].Number.ToString()"/>
<!-- TODO select form system db all errors that have 'incorrect syntax' at the start of the error string-->
<property name="ErrorCodes.BadSqlGrammarCodes">
<value>-104</value>
</property>
<property name="ErrorCodes.PermissionDeniedCodes">
<value>-901</value>
</property>
<property name="ErrorCodes.DataIntegrityViolationCodes">
<value>-530</value>
</property>
<property name="ErrorCodes.DeadlockLoserCodes">
<value>-913</value>
</property>
</object>
</constructor-arg>
</object>
</objects>

View File

@@ -21,15 +21,20 @@
<None Include="Data\Config\spring-database-1.3.xsx">
<DependentUpon>spring-database-1.3.xsd</DependentUpon>
</None>
<EmbeddedResource Include="Data\Common\dbproviders.xml" />
<EmbeddedResource Include="Data\Common\dbproviders_netcore.xml" Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<LogicalName>Spring.Data.Common.dbproviders.xml</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Data\Common\dbproviders.xml" Condition=" '$(TargetFramework)' == '$(TargetFullFrameworkVersion)' ">
<LogicalName>Spring.Data.Common.dbproviders.xml</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Data\Config\spring-database-1.1.xsd" />
<EmbeddedResource Include="Transaction\Config\spring-tx-1.1.xsd" />
<EmbeddedResource Include="Data\Config\spring-database-1.3.xsd" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<Compile Remove="Data\Core\ServiceDomainPlatformTransactionManager.cs" />
<Compile Remove="Data\Support\DefaultServiceDomainAdapter.cs" />
<Compile Remove="Data\Support\IServiceDomainAdapter.cs" />
<Compile Remove="Data\Support\SimpleServiceConfig.cs" />
<Compile Remove="Data\Core\ServiceDomainPlatformTransactionManager.cs" />
<Compile Remove="Data\Support\DefaultServiceDomainAdapter.cs" />
<Compile Remove="Data\Support\IServiceDomainAdapter.cs" />
<Compile Remove="Data\Support\SimpleServiceConfig.cs" />
</ItemGroup>
</Project>

View File

@@ -1,66 +0,0 @@
<?xml version="1.0" ?>
<project name="Spring.Data" default="build" 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 -->
<call target="copycommonlogginglibtobin" />
<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"
>
<arg line="${compiler.args}"/>
<nowarn>
<warning number="${nowarn.numbers}" />
<warning number="1591,0169,0168" />
<warning number="0414,1584" if="${nant.settings.currentframework=='mono-2.0'}"/>
</nowarn>
<sources failonempty="true">
<include name="**/*.cs" />
<include name="../GenCommonAssemblyInfo.cs" />
</sources>
<resources basedir="." prefix="Spring.Data.Common" failonempty="true">
<include name="Data/Common/dbproviders.xml" />
</resources>
<resources basedir="." prefix="Spring.Data.Config" failonempty="true">
<include name="Data/Config/spring-database-1.1.xsd" />
<include name="Data/Config/spring-database-1.3.xsd" />
</resources>
<resources basedir="." prefix="Spring.Transaction.Config" failonempty="true">
<include name="Transaction/Config/spring-tx-1.1.xsd" />
</resources>
<resources basedir="Resources">
<include name="**/*" />
</resources>
<references>
<include name="mscorlib.dll"/>
<include name="Microsoft.CSharp.dll"/>
<include name="System.dll"/>
<include name="System.Core.dll"/>
<include name="System.Configuration.dll"/>
<include name="System.Data.dll" />
<include name="System.EnterpriseServices.dll" />
<include name="System.Transactions.dll" />
<include name="System.Xml.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" />
</references>
</csc>
</target>
</project>

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"/>