Merge branch 'master' of https://github.com/ynauls/spring-net into ynauls-master

This commit is contained in:
Steve Bohlen
2015-03-27 10:39:30 -04:00
20 changed files with 1740 additions and 57 deletions

View File

@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F04753EF-7A1B-4837-AB63-8C0821E8155D}"
ProjectSection(SolutionItems) = preProject
@@ -105,6 +105,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate4.Tes
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.NHibernate4.Integration.Tests.2010", "test\Spring\Spring.Data.NHibernate4.Integration.Tests\Spring.Data.NHibernate4.Integration.Tests.2010.csproj", "{46F8B5E9-ABCF-4306-BC05-FF05B0FAC151}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.SessionFactoryImplError.Tests", "test\Spring\Spring.SessionFactoryImplError.Tests\Spring.SessionFactoryImplError.Tests.csproj", "{DE276F7C-4564-49EC-AABC-B964EC3D1626}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET = Debug|.NET
@@ -383,26 +385,6 @@ Global
{7321149A-47C6-4FBA-9D1A-26FD6815381B}.Release|Any CPU.Build.0 = Release|Any CPU
{7321149A-47C6-4FBA-9D1A-26FD6815381B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{7321149A-47C6-4FBA-9D1A-26FD6815381B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Debug|.NET.ActiveCfg = Debug|Any CPU
{9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Release|.NET.ActiveCfg = Release|Any CPU
{9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Release|Any CPU.Build.0 = Release|Any CPU
{9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{9F0F739C-876E-4C4B-AA55-9AC9242C25C8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C33C6A06-885D-49D2-8029-422D38CBC6D7}.Debug|.NET.ActiveCfg = Debug|Any CPU
{C33C6A06-885D-49D2-8029-422D38CBC6D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C33C6A06-885D-49D2-8029-422D38CBC6D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C33C6A06-885D-49D2-8029-422D38CBC6D7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{C33C6A06-885D-49D2-8029-422D38CBC6D7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{C33C6A06-885D-49D2-8029-422D38CBC6D7}.Release|.NET.ActiveCfg = Release|Any CPU
{C33C6A06-885D-49D2-8029-422D38CBC6D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C33C6A06-885D-49D2-8029-422D38CBC6D7}.Release|Any CPU.Build.0 = Release|Any CPU
{C33C6A06-885D-49D2-8029-422D38CBC6D7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C33C6A06-885D-49D2-8029-422D38CBC6D7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D546EFB7-9F6C-4C11-B2F8-B85FAD135399}.Debug|.NET.ActiveCfg = Debug|Any CPU
{D546EFB7-9F6C-4C11-B2F8-B85FAD135399}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D546EFB7-9F6C-4C11-B2F8-B85FAD135399}.Debug|Any CPU.Build.0 = Debug|Any CPU
@@ -475,16 +457,6 @@ Global
{FA934E92-C8C2-428A-BE2A-26818F17A787}.Release|.NET.ActiveCfg = Release|Any CPU
{FA934E92-C8C2-428A-BE2A-26818F17A787}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA934E92-C8C2-428A-BE2A-26818F17A787}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{CD6A49DE-745C-4360-AADF-3539CFEC6639}.Debug|.NET.ActiveCfg = Debug|Any CPU
{CD6A49DE-745C-4360-AADF-3539CFEC6639}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD6A49DE-745C-4360-AADF-3539CFEC6639}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD6A49DE-745C-4360-AADF-3539CFEC6639}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{CD6A49DE-745C-4360-AADF-3539CFEC6639}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{CD6A49DE-745C-4360-AADF-3539CFEC6639}.Release|.NET.ActiveCfg = Release|Any CPU
{CD6A49DE-745C-4360-AADF-3539CFEC6639}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD6A49DE-745C-4360-AADF-3539CFEC6639}.Release|Any CPU.Build.0 = Release|Any CPU
{CD6A49DE-745C-4360-AADF-3539CFEC6639}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{CD6A49DE-745C-4360-AADF-3539CFEC6639}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6B7DA759-F46D-4860-AF03-E7AC7498E003}.Debug|.NET.ActiveCfg = Debug|Any CPU
{6B7DA759-F46D-4860-AF03-E7AC7498E003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B7DA759-F46D-4860-AF03-E7AC7498E003}.Debug|Any CPU.Build.0 = Debug|Any CPU
@@ -515,16 +487,6 @@ Global
{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Release|Any CPU.Build.0 = Release|Any CPU
{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{8CF0F34A-CC93-4D87-AE14-A2DEEF072F26}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Debug|.NET.ActiveCfg = Debug|Any CPU
{64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Release|.NET.ActiveCfg = Release|Any CPU
{64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Release|Any CPU.Build.0 = Release|Any CPU
{64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{64400FF8-2E9F-4809-B5F4-0C7EB8ABFF87}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{CF375928-B6D5-485C-B04D-2BC41D9DBF1E}.Debug|.NET.ActiveCfg = Debug|Any CPU
{CF375928-B6D5-485C-B04D-2BC41D9DBF1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF375928-B6D5-485C-B04D-2BC41D9DBF1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
@@ -535,16 +497,6 @@ Global
{CF375928-B6D5-485C-B04D-2BC41D9DBF1E}.Release|Any CPU.Build.0 = Release|Any CPU
{CF375928-B6D5-485C-B04D-2BC41D9DBF1E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{CF375928-B6D5-485C-B04D-2BC41D9DBF1E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{2FB16852-22AD-4A5B-885A-97136265CC46}.Debug|.NET.ActiveCfg = Debug|Any CPU
{2FB16852-22AD-4A5B-885A-97136265CC46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2FB16852-22AD-4A5B-885A-97136265CC46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FB16852-22AD-4A5B-885A-97136265CC46}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{2FB16852-22AD-4A5B-885A-97136265CC46}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{2FB16852-22AD-4A5B-885A-97136265CC46}.Release|.NET.ActiveCfg = Release|Any CPU
{2FB16852-22AD-4A5B-885A-97136265CC46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FB16852-22AD-4A5B-885A-97136265CC46}.Release|Any CPU.Build.0 = Release|Any CPU
{2FB16852-22AD-4A5B-885A-97136265CC46}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{2FB16852-22AD-4A5B-885A-97136265CC46}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C57B05EA-FD1A-40EC-BB60-D2E45AB1A86A}.Debug|.NET.ActiveCfg = Debug|Any CPU
{C57B05EA-FD1A-40EC-BB60-D2E45AB1A86A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C57B05EA-FD1A-40EC-BB60-D2E45AB1A86A}.Debug|Any CPU.Build.0 = Debug|Any CPU
@@ -605,6 +557,16 @@ Global
{46F8B5E9-ABCF-4306-BC05-FF05B0FAC151}.Release|Any CPU.Build.0 = Release|Any CPU
{46F8B5E9-ABCF-4306-BC05-FF05B0FAC151}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{46F8B5E9-ABCF-4306-BC05-FF05B0FAC151}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{DE276F7C-4564-49EC-AABC-B964EC3D1626}.Debug|.NET.ActiveCfg = Debug|Any CPU
{DE276F7C-4564-49EC-AABC-B964EC3D1626}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE276F7C-4564-49EC-AABC-B964EC3D1626}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE276F7C-4564-49EC-AABC-B964EC3D1626}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{DE276F7C-4564-49EC-AABC-B964EC3D1626}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{DE276F7C-4564-49EC-AABC-B964EC3D1626}.Release|.NET.ActiveCfg = Release|Any CPU
{DE276F7C-4564-49EC-AABC-B964EC3D1626}.Release|Any CPU.ActiveCfg = Release|Any CPU
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -342,10 +342,12 @@ namespace Spring.Data.NHibernate
/// </exception>
protected override bool IsExistingTransaction(object transaction)
{
return
((HibernateTransactionObject)transaction).PromotableTxScopeTransactionObject.TxScopeAdapter.
IsExistingTransaction;
//return ((HibernateTransactionObject) transaction).HasTransaction();
var hibernateTransactionObject = ((HibernateTransactionObject) transaction);
var hasExistingPromotableTxScopeTransaction = hibernateTransactionObject.PromotableTxScopeTransactionObject.TxScopeAdapter.IsExistingTransaction;
var hasExistingTransaction = hibernateTransactionObject.HasTransaction();
return hasExistingPromotableTxScopeTransaction && hasExistingTransaction;
}
/// <summary>
@@ -951,12 +953,14 @@ namespace Spring.Data.NHibernate
}
*/
ISession session = txObject.SessionHolder.Session;
if (txObject.NewSessionHolder)
{
if (log.IsDebugEnabled)
{
log.Debug("Closing Hibernate Session [" + session + "] after transaction");
}
SessionFactoryUtils.CloseSessionOrRegisterDeferredClose(session, SessionFactory);
}
else
@@ -970,9 +974,8 @@ namespace Spring.Data.NHibernate
session.FlushMode = txObject.SessionHolder.PreviousFlushMode;
}
}
txObject.SessionHolder.Clear();
}
private class HibernateTransactionObject : AdoTransactionObjectSupport

View File

@@ -0,0 +1,64 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core"/>
</sectionGroup>
<section name="connectionStringProperties" type="System.Configuration.NameValueSectionHandler"/>
<section name="nHibernateConfigProperties" type="System.Configuration.NameValueSectionHandler"/>
<section name="timeoutProperties" type="System.Configuration.NameValueSectionHandler" />
</configSections>
<spring>
<context>
<resource uri="config://spring/objects"/>
<resource uri="assembly://Spring.SessionFactoryImplError.Tests/Spring.SessionFactoryImplError.Tests/Spring.Configuration.xml"/>
<resource uri="assembly://Spring.SessionFactoryImplError.Tests/Spring.SessionFactoryImplError.Tests/Spring.NHibernate.xml"/>
</context>
<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>
<objects xmlns="http://www.springframework.net">
<object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
<property name="Order" value="1"/>
<property name="ConfigSections" value="connectionStringProperties,nHibernateConfigProperties,timeoutProperties" />
</object>
</objects>
</spring>
<appSettings>
<remove key="saltKey"/>
<add key="saltKey" value="" lockItem="true"/>
</appSettings>
<connectionStringProperties>
<add key="provider.active" value="SqlServer-4.0" />
<add key="conn.active" value="server=localhost\SQL2008;database=nhibernate;integrated security=SSPI;"/>
</connectionStringProperties>
<nHibernateConfigProperties>
<add key="hibernate.default_schema" value="dbo" />
<add key="hibernate.command_timeout" value="360" />
</nHibernateConfigProperties>
<timeoutProperties>
<add key="timeout.sqlCommand.ado" value="150" />
<add key="timeout.sqlCommand.nhibernate" value="150" />
</timeoutProperties>
<system.web>
</system.web>
<runtime>
</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

View File

@@ -0,0 +1,10 @@
using System;
namespace Spring.SessionFactoryImplError.Tests
{
public class Container : IContainer
{
public Guid Id { get; set; }
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
/*
Script used to create table SQL Server
*/
CREATE TABLE [dbo].[Container](
[Id] [uniqueidentifier] NOT NULL,
[Name] [nvarchar](50) NOT NULL
) ON [PRIMARY]

View File

@@ -0,0 +1,10 @@
using System;
namespace Spring.SessionFactoryImplError.Tests
{
public interface IContainer
{
Guid Id { get; set; }
string Name { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
namespace Spring.SessionFactoryImplError.Tests
{
public interface IService1
{
void ServiceMethodWithNotSupported1();
void ServiceMethodWithNotSupported2();
void ServiceMethodWithNotSupported3();
void ServiceMethodWithNotSupported4();
void ServiceMethodWithRequired();
}
}

View File

@@ -0,0 +1,9 @@
namespace Spring.SessionFactoryImplError.Tests
{
public interface IService2
{
void ServiceMethodWithNotSupported();
void ServiceMethodWithRequiresNew();
}
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="true" assembly="Spring.SessionFactoryImplError.Tests" namespace="Spring.SessionFactoryImplError.Tests">
<class name="Container" proxy="IContainer">
<id name="Id">
<generator class="guid.comb" />
</id>
<property name="Name" />
</class>
</hibernate-mapping>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Spring.SessionFactoryImplError.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Spring.SessionFactoryImplError.Tests")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3f4ca2dc-e2e6-40cc-90d3-0fdda9912e50")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,45 @@
using Spring.Data.NHibernate.Generic;
using Spring.Transaction;
namespace Spring.SessionFactoryImplError.Tests
{
[Transaction.Interceptor.Transaction(TransactionPropagation.Supports, ReadOnly = true)]
public class Service1 : IService1
{
#region DI
public HibernateTemplate HibernateTemplate { get; set; }
#endregion
[Transaction.Interceptor.Transaction(TransactionPropagation.NotSupported)]
public virtual void ServiceMethodWithNotSupported1()
{
ServiceMethodWithNotSupported2();
}
[Transaction.Interceptor.Transaction(TransactionPropagation.NotSupported)]
public virtual void ServiceMethodWithNotSupported2()
{
// do some stuff
}
[Transaction.Interceptor.Transaction(TransactionPropagation.NotSupported)]
public virtual void ServiceMethodWithNotSupported3()
{
ServiceMethodWithNotSupported4();
}
[Transaction.Interceptor.Transaction(TransactionPropagation.NotSupported)]
public virtual void ServiceMethodWithNotSupported4()
{
ServiceMethodWithRequired();
}
[Transaction.Interceptor.Transaction(TransactionPropagation.Required)]
public virtual void ServiceMethodWithRequired()
{
// do some stuff
}
}
}

View File

@@ -0,0 +1,27 @@
using Spring.Data.NHibernate.Generic;
using Spring.Transaction;
namespace Spring.SessionFactoryImplError.Tests
{
[Transaction.Interceptor.Transaction(TransactionPropagation.Supports, ReadOnly = true)]
public class Service2 : IService2
{
#region DI
public HibernateTemplate HibernateTemplate { get; set; }
#endregion
[Transaction.Interceptor.Transaction(TransactionPropagation.NotSupported)]
public virtual void ServiceMethodWithNotSupported()
{
ServiceMethodWithRequiresNew();
}
[Transaction.Interceptor.Transaction(TransactionPropagation.RequiresNew)]
public virtual void ServiceMethodWithRequiresNew()
{
// do stuff
}
}
}

View File

@@ -0,0 +1,36 @@
<?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">
<db:provider id="ActiveDbProvider" connectionString="${conn.active}" provider="${provider.active}" />
<object id="Spring.Data.NHibernate.Generic.HibernateTemplate" type="Spring.Data.NHibernate.Generic.HibernateTemplate, Spring.Data.NHibernate4">
<property name="SessionFactory" ref="Spring.Data.NHibernate.LocalSessionFactoryObject" />
<property name="TemplateFlushMode" value="Auto" />
<property name="CacheQueries" value="true" />
</object>
<tx:advice id="transactionAdvice" transaction-manager="Spring.Transaction.IPlatformTransactionManager" />
<object type="Spring.Aop.Framework.AutoProxy.InheritanceBasedAopConfigurer, Spring.Aop">
<property name="Order" value="2" />
<property name="ProxyDeclaredMembersOnly" value="false" />
<property name="ObjectNames">
<list>
<value>*Service*</value>
</list>
</property>
<property name="InterceptorNames">
<list>
<value>transactionAdvice</value>
</list>
</property>
</object>
<object id="IService1" type="Spring.SessionFactoryImplError.Tests.Service1, Spring.SessionFactoryImplError.Tests">
<property name="HibernateTemplate" ref="Spring.Data.NHibernate.Generic.HibernateTemplate" />
</object>
<object id="IService2" type="Spring.SessionFactoryImplError.Tests.Service2, Spring.SessionFactoryImplError.Tests">
<property name="HibernateTemplate" ref="Spring.Data.NHibernate.Generic.HibernateTemplate" />
</object>
</objects>

View File

@@ -0,0 +1,11 @@
<?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">
<object id="Spring.Transaction.IPlatformTransactionManager" type="Spring.SessionFactoryImplError.Tests.CustomSpring132HibernateTxScopeTransactionManager, Spring.SessionFactoryImplError.Tests">
<property name="DbProvider" ref="ActiveDbProvider"/>
<property name="SessionFactory" ref="Spring.Data.NHibernate.LocalSessionFactoryObject"/>
</object>
</objects>

View File

@@ -0,0 +1,11 @@
<?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">
<object id="Spring.Transaction.IPlatformTransactionManager" type="Spring.Data.NHibernate.HibernateTxScopeTransactionManager, Spring.Data.NHibernate4">
<property name="DbProvider" ref="ActiveDbProvider"/>
<property name="SessionFactory" ref="Spring.Data.NHibernate.LocalSessionFactoryObject"/>
</object>
</objects>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net" xmlns:db="http://www.springframework.net/database">
<description>Dependency Injection for NHibernate Session</description>
<object id="Spring.Data.NHibernate.LocalSessionFactoryObject" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate4">
<property name="DbProvider" ref="ActiveDbProvider"/>
<property name="HibernateProperties">
<dictionary>
<entry key="dialect" value="NHibernate.Dialect.MsSql2008Dialect" />
<entry key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
<entry key="connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<entry key="connection.isolation" value="ReadCommitted" />
<entry key="adonet.batch_size" value="10" />
<entry key="show_sql" value="false" />
<entry key="prepare_sql" value="true" />
<entry key="command_timeout" value="360" />
<entry key="max_fetch_depth" value="3" />
<entry key="default_schema" value="dbo" />
<entry key="bytecode.provider" value="lcg" />
<entry key="proxyfactory.factory_class" value="NHibernate.Bytecode.DefaultProxyFactoryFactory, NHibernate"/>
<entry key="transaction.factory_class" value="NHibernate.Transaction.AdoNetTransactionFactory, NHibernate"/>
</dictionary>
</property>
<property name="ExposeTransactionAwareSessionFactory" value="true" />
<property name="MappingResources">
<list>
<value>assembly://Spring.SessionFactoryImplError.Tests/Spring.SessionFactoryImplError.Tests/Mappings.hbm.xml</value>
</list>
</property>
</object>
<object id="NHibernate.Cfg.Configuration" type="Spring.Objects.Factory.Config.PropertyRetrievingFactoryObject, Spring.Core">
<property name="TargetObject" ref="&amp;Spring.Data.NHibernate.LocalSessionFactoryObject"/>
<property name="TargetProperty" value="Configuration"/>
</object>
</objects>

View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DE276F7C-4564-49EC-AABC-B964EC3D1626}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spring.SessionFactoryImplError.Tests</RootNamespace>
<AssemblyName>Spring.SessionFactoryImplError.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Common.Logging, Version=3.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Common.Logging.3.0.0\lib\net40\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Common.Logging.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Common.Logging.Core.3.0.0\lib\net40\Common.Logging.Core.dll</HintPath>
</Reference>
<Reference Include="NHibernate">
<HintPath>..\..\..\packages\NHibernate.4.0.3.4000\lib\net40\NHibernate.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Container.cs" />
<Compile Include="TestUsingCustomHibernateTxScopeTransactionManager.cs" />
<Compile Include="CustomSpring132HibernateTxScopeTransactionManager.cs" />
<Compile Include="IContainer.cs" />
<Compile Include="IService1.cs" />
<Compile Include="IService2.cs" />
<Compile Include="TestUsingHibernateTxScopeTransactionManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Service1.cs" />
<Compile Include="Service2.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\Spring\Spring.Aop\Spring.Aop.2010.csproj">
<Project>{3a3a4e65-45a6-4b20-b460-0bedc302c02c}</Project>
<Name>Spring.Aop.2010</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.2010.csproj">
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
<Name>Spring.Core.2010</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Data.NHibernate4\Spring.Data.NHibernate4.2010.csproj">
<Project>{d9c45177-0d80-4133-ab46-58f142db92aa}</Project>
<Name>Spring.Data.NHibernate4.2010</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Data\Spring.Data.2010.csproj">
<Project>{ae00e5ab-c39a-436f-86d2-33bfe33e2e40}</Project>
<Name>Spring.Data.2010</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Testing.NUnit\Spring.Testing.NUnit.2010.csproj">
<Project>{ed204a7b-832f-44c7-bfe3-504aebe1bcc8}</Project>
<Name>Spring.Testing.NUnit.2010</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Mappings.hbm.xml" />
<EmbeddedResource Include="Spring.Configuration.xml" />
<EmbeddedResource Include="Spring.NHibernate.xml" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="CreateTable.sql" />
<EmbeddedResource Include="Spring.CustomHibernateTxScopeTransactionManager.xml" />
<EmbeddedResource Include="Spring.HibernateTxScopeTransactionManager.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,50 @@
using NUnit.Framework;
using Spring.Data.NHibernate.Generic;
using Spring.Testing.NUnit;
namespace Spring.SessionFactoryImplError.Tests
{
[TestFixture]
public class TestUsingCustomHibernateTxScopeTransactionManager : AbstractTransactionalSpringContextTests
{
#region DI
public HibernateTemplate HibernateTemplate { get; set; }
public IService1 Service1 { get; set; }
public IService2 Service2 { get; set; }
#endregion
protected override string[] ConfigLocations
{
get
{
return new[]
{
"config://spring/objects",
"assembly://Spring.SessionFactoryImplError.Tests/Spring.SessionFactoryImplError.Tests/Spring.Configuration.xml",
"assembly://Spring.SessionFactoryImplError.Tests/Spring.SessionFactoryImplError.Tests/Spring.NHibernate.xml",
"assembly://Spring.SessionFactoryImplError.Tests/Spring.SessionFactoryImplError.Tests/Spring.CustomHibernateTxScopeTransactionManager.xml"
};
}
}
[Test(Description = "This is failing test case in my unit test with original NH TX Scope Manager, but not Custom TX Scope Manager, Not Supported -> Not Supported")]
public void TestSuspendTransactionOnNotSupported()
{
Service1.ServiceMethodWithNotSupported1();
}
[Test(Description = "This is also failing with NH TX Scope manager, but nto with Custom TX Scope Manager, Not Supported -> Requires New")]
public void TestSuspendTransactionOnNotSupportedWithNestedRequiresNew()
{
Service2.ServiceMethodWithNotSupported();
}
[Test(Description = "This is failing test case in my unit test with Custom TX Scope Manager (this is the original bug reported), Not Supported -> Not Supported -> Required")]
public void TestSuspendTransactionOnNotSupportedWithNestedRequired()
{
Service1.ServiceMethodWithNotSupported3();
}
}
}

View File

@@ -0,0 +1,51 @@
using NUnit.Framework;
using Spring.Data.NHibernate.Generic;
using Spring.Testing.NUnit;
namespace Spring.SessionFactoryImplError.Tests
{
[TestFixture]
public class TestUsingHibernateTxScopeTransactionManager : AbstractTransactionalSpringContextTests
{
#region DI
public HibernateTemplate HibernateTemplate { get; set; }
public IService1 Service1 { get; set; }
public IService2 Service2 { get; set; }
#endregion
protected override string[] ConfigLocations
{
get
{
return new[]
{
"config://spring/objects",
"assembly://Spring.SessionFactoryImplError.Tests/Spring.SessionFactoryImplError.Tests/Spring.Configuration.xml",
"assembly://Spring.SessionFactoryImplError.Tests/Spring.SessionFactoryImplError.Tests/Spring.NHibernate.xml",
"assembly://Spring.SessionFactoryImplError.Tests/Spring.SessionFactoryImplError.Tests/Spring.HibernateTxScopeTransactionManager.xml"
};
}
}
[Test(Description = "This is failing test case in my unit test with original NH TX Scope Manager, but not Custom TX Scope Manager, Not Supported -> Not Supported")]
public void TestSuspendTransactionOnNotSupported()
{
Service1.ServiceMethodWithNotSupported1();
}
[Test(Description = "This is also failing with NH TX Scope manager, but not with Custom TX Scope Manager, Not Supported -> Requires New")]
public void TestSuspendTransactionOnNotSupportedWithNestedRequiresNew()
{
Service2.ServiceMethodWithNotSupported();
}
[Test(Description = "This is failing test case in my unit test with Custom TX Scope Manager (this is the original bug reported), Not Supported -> Not Supported -> Required")]
public void TestSuspendTransactionOnNotSupportedWithNestedRequired()
{
Service1.ServiceMethodWithNotSupported3();
}
}
}