springnet-commits Mailing List for Spring Framework .NET (Page 33)
Brought to you by:
aseovic,
markpollack
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(33) |
Aug
(163) |
Sep
(491) |
Oct
(289) |
Nov
(336) |
Dec
(84) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(227) |
Feb
(413) |
Mar
(128) |
Apr
(232) |
May
(92) |
Jun
(299) |
Jul
(386) |
Aug
(228) |
Sep
(237) |
Oct
(426) |
Nov
(325) |
Dec
(405) |
2006 |
Jan
(315) |
Feb
(311) |
Mar
(152) |
Apr
(177) |
May
(443) |
Jun
(92) |
Jul
(88) |
Aug
(80) |
Sep
(288) |
Oct
(515) |
Nov
(1049) |
Dec
(440) |
2007 |
Jan
(179) |
Feb
(406) |
Mar
(294) |
Apr
(80) |
May
(432) |
Jun
(242) |
Jul
(452) |
Aug
(710) |
Sep
(206) |
Oct
(240) |
Nov
(65) |
Dec
(227) |
2008 |
Jan
(80) |
Feb
(90) |
Mar
(98) |
Apr
(136) |
May
(101) |
Jun
(12) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Mark P. <mar...@us...> - 2007-11-20 04:03:46
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Data/NHibernate In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4367 Modified Files: HibernateTransactionManager.cs SessionFactoryUtils.cs Log Message: SPRNET-778 - AdoExceptionTranslator in HibernateTransactionManager did not have a default value Index: SessionFactoryUtils.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Data/NHibernate/SessionFactoryUtils.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SessionFactoryUtils.cs 19 Sep 2007 22:58:22 -0000 1.3 --- SessionFactoryUtils.cs 20 Nov 2007 04:03:43 -0000 1.4 *************** *** 453,456 **** --- 453,468 ---- } + if (ex is PropertyValueException) + { + return new DataIntegrityViolationException(ex.Message, ex); + } + if (ex is PersistentObjectException) + { + return new InvalidDataAccessApiUsageException(ex.Message, ex); + } + if (ex is NonUniqueResultException) + { + return new IncorrectResultSizeDataAccessException(ex.Message, 1); + } // fallback return new HibernateSystemException(ex); Index: HibernateTransactionManager.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTransactionManager.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HibernateTransactionManager.cs 19 Sep 2007 22:58:22 -0000 1.5 --- HibernateTransactionManager.cs 20 Nov 2007 04:03:43 -0000 1.6 *************** *** 79,82 **** --- 79,84 ---- private IAdoExceptionTranslator adoExceptionTranslator; + private IAdoExceptionTranslator defaultExceptionTranslator; + /// <summary> /// Just needed for entityInterceptorBeanName. *************** *** 201,204 **** --- 203,231 ---- /// <summary> + /// Gets the default IAdoException translator, lazily creating it if nece + /// </summary> + /// <value>The default IAdoException translator.</value> + public IAdoExceptionTranslator DefaultAdoExceptionTranslator + { + get + { lock(this) + { + if (defaultExceptionTranslator == null) + { + if (dbProvider != null) + { + defaultExceptionTranslator = new ErrorCodeExceptionTranslator(dbProvider); + } + else + { + defaultExceptionTranslator = SessionFactoryUtils.NewAdoExceptionTranslator(SessionFactory); + } + } + return defaultExceptionTranslator; + } + } + } + + /// <summary> /// Gets or sets the SessionFactory that this instance should manage transactions for. /// </summary> *************** *** 518,522 **** { txObject.SessionHolder.Transaction.Commit(); - } // Note, unfortunate collision of namespaces/classname for NHibernate.TransactionException --- 545,548 ---- *************** *** 533,547 **** if (hibEx != null) { throw ConvertHibernateAccessException(hibEx); } throw; ! } ! ! /*catch (HibernateException ex) ! { ! // assumably failed to flush changes to database ! throw ConvertHibernateAccessException(ex); ! }*/ ! } --- 559,567 ---- if (hibEx != null) { + // assumably failed to flush changes to database throw ConvertHibernateAccessException(hibEx); } throw; ! } } *************** *** 650,656 **** protected virtual DataAccessException ConvertHibernateAccessException(HibernateException ex) { ! if (ex is ADOException) { ! return ConvertAdoAccessException((ADOException) ex); } return SessionFactoryUtils.ConvertHibernateAccessException(ex); --- 670,680 ---- protected virtual DataAccessException ConvertHibernateAccessException(HibernateException ex) { ! if (AdoExceptionTranslator != null && ex is ADOException) { ! return ConvertAdoAccessException((ADOException) ex, AdoExceptionTranslator); ! } ! else if (ex is ADOException) ! { ! return ConvertAdoAccessException((ADOException)ex, DefaultAdoExceptionTranslator); } return SessionFactoryUtils.ConvertHibernateAccessException(ex); *************** *** 666,674 **** /// The corresponding DataAccessException instance /// </returns> ! protected virtual DataAccessException ConvertAdoAccessException(ADOException ex) { //TODO should be pass in innerexception or just exception? ! return AdoExceptionTranslator.Translate( ! "Hibernate operation: " + ex.Message, null, ex.InnerException); } --- 690,697 ---- /// The corresponding DataAccessException instance /// </returns> ! protected virtual DataAccessException ConvertAdoAccessException(ADOException ex, IAdoExceptionTranslator translator) { //TODO should be pass in innerexception or just exception? ! return translator.Translate("Hibernate flusing: " + ex.Message, null, ex.InnerException); } |
From: Mark P. <mar...@us...> - 2007-11-15 20:25:14
|
Update of /cvsroot/springnet/Spring.Net/doc/reference/src In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv18762 Modified Files: web.xml Log Message: SPRNET-708 - Remove "UniqueID" based usercontrol DI sample from web reference docs Index: web.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/web.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** web.xml 10 Oct 2007 03:03:28 -0000 1.25 --- web.xml 15 Nov 2007 20:25:11 -0000 1.26 *************** *** 42,46 **** framework and much of that experience and added value can be transliterated to help developers be more productive when using .NET ! upcoming MVC support. </para> <para>As we said earlier, event handlers in code-behind classes really --- 42,46 ---- framework and much of that experience and added value can be transliterated to help developers be more productive when using .NET ! upcoming MVC support.</para> <para>As we said earlier, event handlers in code-behind classes really *************** *** 488,500 **** <para>Spring.Web also allows application developers to inject dependencies into controls (both user controls and standard controls) ! that are contained within a page. This can be accomplished in two ways - ! either globally for all the controls of a particular ! <classname>Type</classname>, or locally, for a specific control within a ! page.</para> ! ! <para>In order to inject dependencies globally, the location of the ! <literal>.ascx</literal> control needs to be used as the object type ! identifier. This is similar to injecting into <literal>.aspx</literal> ! pages shown above:</para> <programlisting><object type="~/controls/MyControl.ascx" abstract="true"> --- 488,496 ---- <para>Spring.Web also allows application developers to inject dependencies into controls (both user controls and standard controls) ! that are contained within a page. This can be accomplished globally for ! all controls of a particular <literal>Type</literal> by using the ! location of the <literal>.ascx</literal> as the object type identifier. ! This is similar to injecting into <literal>.aspx </literal>pages shown ! above.</para> <programlisting><object type="~/controls/MyControl.ascx" abstract="true"> *************** *** 502,532 **** </object></programlisting> - <para>In order to inject dependencies locally, the control's - <literal>UniqueID</literal> needs to used as the object definition - identifier:</para> - - <programlisting><object id="myContainerControl:myTargetControl" abstract="true"> - <!-- inject dependencies here... --> - </object></programlisting> - <para>In either case, be sure to mark the object definition as <literal>abstract</literal> (by adding <literal>abstract="true"</literal> to the attribute list of the <literal><object/></literal> element).</para> - - <para>The easiest way to obtain a control's <literal>UniqueID</literal> - is by turning tracing on for the application and looking for the - <literal>UniqueID</literal> in the control hierarchy section of the - resulting page trace. Yes, this is... unfortunate.</para> - - <para>Please note that both global and local definitions for the same - control can be specified, in which case the resulting definitions will - be merged, with values from the local definition overriding values from - the global definition as necessary. Due to context scoping issues, you - will probably want to define global control definitions in the root - context so that dependencies are injected consistently throughout the - web application. In contrast, local control definitions are better - defined within the child context for the component, in order to avoid - naming conflicts between different components.</para> </sect2> --- 498,505 ---- *************** *** 555,570 **** HttpApplicationConfigurer' ModuleTemplates property.</para> ! <programlisting> <object name="HttpApplicationConfigurer" type="Spring.Context.Support.HttpApplicationConfigurer, Spring.Web"> ! <property name="ModuleTemplates"> ! <dictionary> ! <entry key="HtmlCommentAppender"> <!-- this name must match the module name --> ! <object> ! <!-- select "view source" in your browser on any page to see the appended html comment --> ! <property name="AppendText" value="My configured comment!" /> ! </object> ! </entry> ! </dictionary> ! </property> ! </object></programlisting> <para>You can see this example in action in the Web Quickstart.</para> --- 528,543 ---- HttpApplicationConfigurer' ModuleTemplates property.</para> ! <programlisting><object name="HttpApplicationConfigurer" type="Spring.Context.Support.HttpApplicationConfigurer, Spring.Web"> ! <property name="ModuleTemplates"> ! <dictionary> ! <entry key="HtmlCommentAppender"> <!-- this name must match the module name --> ! <object> ! <!-- select "view source" in your browser on any page to see the appended html comment --> ! <property name="AppendText" value="My configured comment!" /> ! </object> ! </entry> ! </dictionary> ! </property> ! </object></programlisting> <para>You can see this example in action in the Web Quickstart.</para> |
From: Bruno B. <bb...@us...> - 2007-11-13 03:44:55
|
Update of /cvsroot/springnet/Spring.Net In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv19442 Modified Files: Spring.build Log Message: Removed System.Web.Extensions.dll from the bin directory. Index: Spring.build =================================================================== RCS file: /cvsroot/springnet/Spring.Net/Spring.build,v retrieving revision 1.189 retrieving revision 1.190 diff -C2 -d -r1.189 -r1.190 *** Spring.build 10 Sep 2007 02:23:35 -0000 1.189 --- Spring.build 13 Nov 2007 03:44:48 -0000 1.190 *************** *** 874,883 **** <include name="**/antlr.runtime.dll"/> - <include name="**/System.Web.Extensions.dll"/> <include name="**/Common.Logging.dll"/> <include name="**/Common.Logging.*.dll"/> <exclude name="**/examples/**"/> <exclude name="**/results/**"/> ! <exclude name="mono/**"/> </fileset> </copy> --- 874,882 ---- <include name="**/antlr.runtime.dll"/> <include name="**/Common.Logging.dll"/> <include name="**/Common.Logging.*.dll"/> <exclude name="**/examples/**"/> <exclude name="**/results/**"/> ! <exclude name="mono/**"/> </fileset> </copy> *************** *** 892,896 **** <include name="**/Spring.*.pdb"/> <include name="**/antlr.runtime.dll"/> - <include name="**/System.Web.Extensions.dll"/> <include name="**/log4net.dll"/> <include name="**/log4net.xml"/> --- 891,894 ---- |
From: Bruno B. <bb...@us...> - 2007-11-13 03:43:53
|
Update of /cvsroot/springnet/Spring.Net/lib/Net/2.0 In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv19053 Added Files: Common.Logging.EntLib.dll Log Message: Added Common.Logging.EntLib.dll to the lib/net/2.0 directory. --- NEW FILE: Common.Logging.EntLib.dll --- (This appears to be a binary file; contents omitted.) |
From: Bruno B. <bb...@us...> - 2007-11-13 03:17:53
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Services/Web/Services In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv10172 Modified Files: WebServiceProxyFactory.cs Log Message: Fix in WebServiceProxyFactory to support XmlRootAttribute. Index: WebServiceProxyFactory.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Services/Web/Services/WebServiceProxyFactory.cs,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** WebServiceProxyFactory.cs 7 Sep 2007 01:03:30 -0000 1.25 --- WebServiceProxyFactory.cs 13 Nov 2007 03:17:49 -0000 1.26 *************** *** 574,578 **** { XmlMemberMapping outMemberMapping = outputMembersMapping[0]; ! if (outMemberMapping.MemberName != operation.Name + "Result") { ParameterBuilder parameterBuilder = methodBuilder.DefineParameter(0, ParameterAttributes.Retval, null); --- 574,580 ---- { XmlMemberMapping outMemberMapping = outputMembersMapping[0]; ! bool useMemberName = (outMemberMapping.MemberName != operation.Name + "Result"); ! bool useNamespace = outMemberMapping.Namespace != outputMembersMapping.Namespace; ! if (useMemberName || useNamespace) { ParameterBuilder parameterBuilder = methodBuilder.DefineParameter(0, ParameterAttributes.Retval, null); *************** *** 580,584 **** CustomAttributeBuilderBuilder cabb = new CustomAttributeBuilderBuilder(typeof(XmlElementAttribute)); ! cabb.AddPropertyValue("ElementName", outMemberMapping.MemberName); parameterBuilder.SetCustomAttribute(cabb.Build()); --- 582,593 ---- CustomAttributeBuilderBuilder cabb = new CustomAttributeBuilderBuilder(typeof(XmlElementAttribute)); ! if (useMemberName) ! { ! cabb.AddPropertyValue("ElementName", outMemberMapping.MemberName); ! } ! if (useNamespace) ! { ! cabb.AddPropertyValue("Namespace", outMemberMapping.Namespace); ! } parameterBuilder.SetCustomAttribute(cabb.Build()); *************** *** 589,592 **** --- 598,622 ---- } #endif + /* + protected override void ApplyMethodParameterAttributes(MethodBuilder methodBuilder, MethodInfo targetMethod) + { + base.ApplyMethodParameterAttributes(methodBuilder, targetMethod); + + foreach (ParameterInfo paramInfo in targetMethod.GetParameters()) + { + XmlMemberMapping inMemberMapping = inputMembersMapping[paramInfo.Position]; + if (inMemberMapping.Namespace != inputMembersMapping.Namespace) + { + ParameterBuilder parameterBuilder = methodBuilder.DefineParameter((paramInfo.Position + 1), paramInfo.Attributes, paramInfo.Name); + + CustomAttributeBuilderBuilder cabb = + new CustomAttributeBuilderBuilder(typeof(XmlElementAttribute)); + cabb.AddPropertyValue("Namespace", inMemberMapping.Namespace); + + parameterBuilder.SetCustomAttribute(cabb.Build()); + } + } + } + */ protected override IList GetTypeAttributes(Type type) |
From: Mark P. <mar...@us...> - 2007-11-12 19:58:24
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Data In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23289 Modified Files: AdoPlatformTransactionManagerTests.cs Log Message: SPRNET-770 Nested RequiresNew propagaion options not working in AdoPlatformTransaction manager SPRNET-769 Resume and throw exception if exception is thrown at start of transaction. Index: AdoPlatformTransactionManagerTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Data/AdoPlatformTransactionManagerTests.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AdoPlatformTransactionManagerTests.cs 16 Oct 2007 00:28:49 -0000 1.4 --- AdoPlatformTransactionManagerTests.cs 12 Nov 2007 19:58:13 -0000 1.5 *************** *** 55,60 **** public void TransactionCommit() { ! IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); ! IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); IDbTransaction transaction = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); --- 55,60 ---- public void TransactionCommit() { ! IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); ! IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); IDbTransaction transaction = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); *************** *** 66,74 **** Expect.Call(connection.BeginTransaction(IsolationLevel.Unspecified)).Return(transaction); //standard tx timeout. - - transaction.Commit(); LastCall.On(transaction).Repeat.Once(); - connection.Dispose(); } --- 66,71 ---- *************** *** 77,80 **** --- 74,78 ---- AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + TransactionTemplate tt = new TransactionTemplate(tm); *************** *** 88,92 **** mocks.VerifyAll(); - } --- 86,89 ---- *************** *** 94,100 **** public void TransactionRollback() { ! IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); ! IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); ! IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); using (mocks.Ordered()) --- 91,97 ---- public void TransactionRollback() { ! IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); ! IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); ! IDbTransaction transaction = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); using (mocks.Ordered()) *************** *** 131,135 **** Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); Assert.IsTrue(!TransactionSynchronizationManager.SynchronizationActive, "Synchronizations not active"); ! mocks.VerifyAll(); --- 128,132 ---- Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); Assert.IsTrue(!TransactionSynchronizationManager.SynchronizationActive, "Synchronizations not active"); ! mocks.VerifyAll(); *************** *** 137,155 **** [Test] - [Ignore] public void ParticipatingTransactionWithRollbackOnly() { ! IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); ! IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); ! IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); ! Expect.Call(dbProvider.CreateConnection()).Return(connection); ! connection.Open(); ! LastCall.On(connection).Repeat.Once(); ! Expect.Call(connection.BeginTransaction(IsolationLevel.Unspecified)).Return(transaction); ! //standard tx timeout. ! transaction.Rollback(); ! LastCall.On(transaction).Repeat.Once(); ! connection.Dispose(); AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); --- 134,155 ---- [Test] public void ParticipatingTransactionWithRollbackOnly() { ! IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); ! IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); ! IDbTransaction transaction = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); ! using (mocks.Ordered()) ! { ! Expect.Call(dbProvider.CreateConnection()).Return(connection); ! connection.Open(); ! LastCall.On(connection).Repeat.Once(); ! Expect.Call(connection.BeginTransaction(IsolationLevel.Unspecified)).Return(transaction); ! //standard tx timeout. ! transaction.Rollback(); ! LastCall.On(transaction).Repeat.Once(); ! connection.Dispose(); ! } ! mocks.ReplayAll(); AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); *************** *** 172,176 **** outerTransactionBoundaryReached = true; tm.Commit(ts); ! } catch (UnexpectedRollbackException) { // expected --- 172,178 ---- outerTransactionBoundaryReached = true; tm.Commit(ts); ! Assert.Fail("Should have thrown UnexpectedRollbackException"); ! } ! catch (UnexpectedRollbackException) { // expected *************** *** 182,188 **** --- 184,531 ---- } + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + Assert.IsFalse(synch.beforeCommitCalled); + Assert.IsTrue(synch.beforeCompletionCalled); + Assert.IsFalse(synch.afterCommitCalled); + Assert.IsTrue(synch.afterCompletionCalled); + + mocks.VerifyAll(); + } + + [Test] + [Ignore] + public void ParticipatingTransactionWithTransactionStartedFromSynch() + { + } + + [Test] + [Ignore] + public void ParticipatingTransactionWithRollbackOnlyAndInnerSynch() + { + } + + [Test] + public void PropagationRequiresNewWithExistingTransaction() + { + IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); + IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); + IDbTransaction transaction = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); + + Expect.Call(dbProvider.CreateConnection()).Return(connection).Repeat.Twice(); + connection.Open(); + LastCall.On(connection).Repeat.Twice(); + Expect.Call(connection.BeginTransaction(IsolationLevel.Unspecified)).Return(transaction).Repeat.Twice(); + //standard tx timeout. + transaction.Rollback(); + LastCall.On(transaction).Repeat.Once(); + + transaction.Commit(); + LastCall.On(transaction).Repeat.Once(); + + connection.Dispose(); + LastCall.On(connection).Repeat.Twice(); + //} + mocks.ReplayAll(); + + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + + TransactionTemplate tt = new TransactionTemplate(tm); + tt.PropagationBehavior = TransactionPropagation.RequiresNew; + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + Assert.IsTrue(!TransactionSynchronizationManager.SynchronizationActive, "Synchronizations not active"); + + tt.Execute(new PropagationRequiresNewWithExistingTransactionCallback(tt, dbProvider)); + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + + mocks.VerifyAll(); + } + + [Test] + public void PropagationRequiresNewWithExistingTransactionAndUnrelatedDataSource() + { + IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); + IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); + IDbTransaction transaction = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); + + Expect.Call(dbProvider.CreateConnection()).Return(connection); + connection.Open(); + LastCall.On(connection).Repeat.Once(); + Expect.Call(connection.BeginTransaction(IsolationLevel.Unspecified)).Return(transaction); + transaction.Commit(); + LastCall.On(transaction).Repeat.Once(); + connection.Dispose(); + + IDbProvider dbProvider2 = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); + IDbConnection connection2 = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); + IDbTransaction transaction2 = (IDbTransaction) mocks.CreateMock(typeof (IDbTransaction)); + + Expect.Call(dbProvider2.CreateConnection()).Return(connection2); + connection2.Open(); + LastCall.On(connection2).Repeat.Once(); + Expect.Call(connection2.BeginTransaction(IsolationLevel.Unspecified)).Return(transaction2); + transaction2.Rollback(); + LastCall.On(transaction2).Repeat.Once(); + connection2.Dispose(); + + mocks.ReplayAll(); + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + TransactionTemplate tt = new TransactionTemplate(tm); + tt.PropagationBehavior = TransactionPropagation.RequiresNew; + + AdoPlatformTransactionManager tm2 = new AdoPlatformTransactionManager(dbProvider2); + TransactionTemplate tt2 = new TransactionTemplate(tm2); + tt2.PropagationBehavior = TransactionPropagation.RequiresNew; + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider2), "Hasn't thread db provider"); + Assert.IsTrue(!TransactionSynchronizationManager.SynchronizationActive, "Synchronizations not active"); + + + tt.Execute(new PropagationRequiresNewWithExistingTransactionCallback(tt2, dbProvider)); + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider2), "Hasn't thread db provider"); + + mocks.VerifyAll(); + } + + [Test] + public void PropagationRequiresNewWithExistingTransactionAndUnrelatedFailingDataSource() + { + #region Mock Setup + IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); + IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); + IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + + Expect.Call(dbProvider.CreateConnection()).Return(connection); + connection.Open(); + LastCall.On(connection).Repeat.Once(); + Expect.Call(connection.BeginTransaction(IsolationLevel.Unspecified)).Return(transaction); + transaction.Rollback(); + LastCall.On(transaction).Repeat.Once(); + connection.Dispose(); + + IDbProvider dbProvider2 = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); + IDbConnection connection2 = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); + IDbTransaction transaction2 = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + + Expect.Call(dbProvider2.CreateConnection()).Return(connection2); + connection2.Open(); + Exception failure = new Exception("can't open connection"); + LastCall.On(connection2).Throw(failure); + + #endregion + + mocks.ReplayAll(); + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + TransactionTemplate tt = new TransactionTemplate(tm); + tt.PropagationBehavior = TransactionPropagation.RequiresNew; + + AdoPlatformTransactionManager tm2 = new AdoPlatformTransactionManager(dbProvider2); + tm2.TransactionSynchronization = TransactionSynchronizationState.Never; + TransactionTemplate tt2 = new TransactionTemplate(tm2); + tt2.PropagationBehavior = TransactionPropagation.RequiresNew; + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider2), "Hasn't thread db provider"); + Assert.IsTrue(!TransactionSynchronizationManager.SynchronizationActive, "Synchronizations not active"); + + try + { + tt.Execute( + new PropagationRequiresNewWithExistingTransactionAndUnrelatedFailingDataSourceCallback(tt2)); + Assert.Fail("Should have thrown CannotCreateTransactionException"); + } catch(CannotCreateTransactionException ex) + { + Assert.AreSame(failure, ex.InnerException); + } + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider2), "Hasn't thread db provider"); + mocks.VerifyAll(); + } + + [Test] + public void PropagationNotSupportedWithExistingTransaction() + { + #region Mock Setup + IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); + IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); + IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + + using (mocks.Ordered()) + { + Expect.Call(dbProvider.CreateConnection()).Return(connection); + connection.Open(); + LastCall.On(connection).Repeat.Once(); + Expect.Call(connection.BeginTransaction(IsolationLevel.Unspecified)).Return(transaction); + //standard tx timeout. + transaction.Commit(); + LastCall.On(transaction).Repeat.Once(); + connection.Dispose(); + } + #endregion + + mocks.ReplayAll(); + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + TransactionTemplate tt = new TransactionTemplate(tm); + tt.PropagationBehavior = TransactionPropagation.RequiresNew; + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + Assert.IsTrue(!TransactionSynchronizationManager.SynchronizationActive, "Synchronizations not active"); + + tt.Execute(new PropagationNotSupportedWithExistingTransactionCallback(tt, dbProvider)); + + mocks.VerifyAll(); + } + + [Test] + public void PropagationNeverWithExistingTransaction() + { + + } + } + + #region Supporting classes for PropagationNotSupportedWithExistingTransaction + + internal class PropagationNotSupportedWithExistingTransactionCallback : ITransactionCallback + { + private TransactionTemplate innerTxTemplate; + private IDbProvider dbProvider; + + public PropagationNotSupportedWithExistingTransactionCallback(TransactionTemplate transactionTemplate, IDbProvider provider) + { + innerTxTemplate = transactionTemplate; + dbProvider = provider; + } + + public object DoInTransaction(ITransactionStatus status) + { + Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); + Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive, "Synchronization active"); + Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly); + innerTxTemplate.PropagationBehavior = TransactionPropagation.NotSupported; + innerTxTemplate.Execute(new PropagationNotSupportedWithExistingTransactionCallback2(dbProvider)); + Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); + Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly); + Assert.IsTrue(TransactionSynchronizationManager.ActualTransactionActive); + return null; + } + } + + internal class PropagationNotSupportedWithExistingTransactionCallback2 : ITransactionCallback + { + private IDbProvider provider; + + public PropagationNotSupportedWithExistingTransactionCallback2(IDbProvider provider) + { + this.provider = provider; + } + + public object DoInTransaction(ITransactionStatus status) + { + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(provider), "Hasn't thread db provider"); + Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive); + Assert.IsTrue(!status.IsNewTransaction, "Isn't new transaction"); + Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly); + Assert.IsFalse(TransactionSynchronizationManager.ActualTransactionActive); + status.RollbackOnly = true; + return null; + } + } + + #endregion + + #region Supporting class for PropagationRequiresNewWithExistingTransactionAndUnrelatedFailingDataSource + + internal class PropagationRequiresNewWithExistingTransactionAndUnrelatedFailingDataSourceCallback : ITransactionCallback + { + private TransactionTemplate innerTxTemplate; + + + public PropagationRequiresNewWithExistingTransactionAndUnrelatedFailingDataSourceCallback(TransactionTemplate transactionTemplate) + { + innerTxTemplate = transactionTemplate; + } + + public object DoInTransaction(ITransactionStatus status) + { + Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); + Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive, "Synchronization active"); + Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly); + Assert.IsTrue(TransactionSynchronizationManager.ActualTransactionActive); + innerTxTemplate.Execute(new PropagationRequiresNewWithExistingTransactionAndUnrelatedFailingDataSourceCallback2()); + return null; + } + } + + internal class PropagationRequiresNewWithExistingTransactionAndUnrelatedFailingDataSourceCallback2 : ITransactionCallback + { + public object DoInTransaction(ITransactionStatus status) + { + status.RollbackOnly = true; + return null; + } + } + + #endregion + + #region Supporting class for PropagationRequiresNewWithExistingTransaction + + internal class PropagationRequiresNewWithExistingTransactionCallback : ITransactionCallback + { + private TransactionTemplate innerTxTemplate; + private IDbProvider dbProvider; + + public PropagationRequiresNewWithExistingTransactionCallback(TransactionTemplate transactionTemplate, + IDbProvider provider) + { + innerTxTemplate = transactionTemplate; + dbProvider = provider; + } + + public object DoInTransaction(ITransactionStatus status) + { + Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); + Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive, "Synchronization active"); + Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly); + Assert.IsTrue(TransactionSynchronizationManager.ActualTransactionActive); + innerTxTemplate.Execute(new PropagationRequiresNewWithExistingTransactionCallback2(dbProvider)); + + Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); + Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly); + Assert.IsTrue(TransactionSynchronizationManager.ActualTransactionActive); + return null; + } + } + + internal class PropagationRequiresNewWithExistingTransactionCallback2 : ITransactionCallback + { + private IDbProvider dbProvider; + + public PropagationRequiresNewWithExistingTransactionCallback2(IDbProvider dbProvider) + { + this.dbProvider = dbProvider; + } + + public object DoInTransaction(ITransactionStatus status) + { + Assert.IsTrue(TransactionSynchronizationManager.HasResource(dbProvider), "Has thread connection"); + Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive, "Synchronization active"); + Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); + Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly); + Assert.IsTrue(TransactionSynchronizationManager.ActualTransactionActive); + status.RollbackOnly = true; + return null; } } + #endregion + #region Supporting class for TransactionCommit test *************** *** 201,207 **** Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive); Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly); return null; - } } --- 544,550 ---- Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive); Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); + Assert.IsTrue(TransactionSynchronizationManager.ActualTransactionActive); Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly); return null; } } *************** *** 250,254 **** { Assert.IsTrue(!status.IsNewTransaction, "Is existing transaction"); ! Assert.IsFalse(status.RollbackOnly,"Is not rollback-only"); innerTxTemplate.Execute(new ParticipatingTxWithRollbackOnlyTxCallback2(dbProvider)); Assert.IsTrue(!status.IsNewTransaction, "Is existing transaction"); --- 593,597 ---- { Assert.IsTrue(!status.IsNewTransaction, "Is existing transaction"); ! Assert.IsFalse(status.RollbackOnly, "Is not rollback-only"); innerTxTemplate.Execute(new ParticipatingTxWithRollbackOnlyTxCallback2(dbProvider)); Assert.IsTrue(!status.IsNewTransaction, "Is existing transaction"); *************** *** 272,276 **** Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive, "Synchronization active"); Assert.IsTrue(!status.IsNewTransaction, "Is existing transaction"); ! //status.RollbackOnly; return null; } --- 615,619 ---- Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive, "Synchronization active"); Assert.IsTrue(!status.IsNewTransaction, "Is existing transaction"); ! status.RollbackOnly = true; return null; } *************** *** 291,295 **** public bool afterCompletionCalled; ! public TestTransactionSynchronization(IDbProvider provider, TransactionSynchronizationStatus synchronizationStatus) { this.provider = provider; --- 634,639 ---- public bool afterCompletionCalled; ! public TestTransactionSynchronization(IDbProvider provider, ! TransactionSynchronizationStatus synchronizationStatus) { this.provider = provider; *************** *** 300,309 **** public void Suspend() { - } public void Resume() { - } --- 644,651 ---- |
From: Mark P. <mar...@us...> - 2007-11-12 19:58:18
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Transaction/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22984 Modified Files: AbstractPlatformTransactionManager.cs Log Message: SPRNET-770 Nested RequiresNew propagaion options not working in AdoPlatformTransaction manager SPRNET-769 Resume and throw exception if exception is thrown at start of transaction. Index: AbstractPlatformTransactionManager.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Transaction/Support/AbstractPlatformTransactionManager.cs,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** AbstractPlatformTransactionManager.cs 7 Sep 2007 04:46:53 -0000 1.24 --- AbstractPlatformTransactionManager.cs 12 Nov 2007 19:58:06 -0000 1.25 *************** *** 290,296 **** /// <see cref="Spring.Transaction.Support.AbstractPlatformTransactionManager.DoResume"/>.) /// </returns> - /// <remarks> - /// Transaction synchronization will already have been suspended. - /// </remarks> /// <exception cref="Spring.Transaction.IllegalTransactionStateException"> /// If suspending is not supported by the transaction manager implementation. --- 290,293 ---- *************** *** 322,328 **** /// <see cref="Spring.Transaction.Support.AbstractPlatformTransactionManager.DoSuspend"/>. /// </param> - /// <remarks> - /// Transaction synchronization will be resumed afterwards. - /// </remarks> /// <exception cref="Spring.Transaction.IllegalTransactionStateException"> /// If suspending is not supported by the transaction manager implementation. --- 319,322 ---- *************** *** 504,508 **** log.Debug("Creating new transaction with name [" + definition.Name + "]:" + definition); } ! DoBegin(transaction, definition); newSynchronization = (_transactionSyncState != TransactionSynchronizationState.Never); return NewTransactionStatus(definition, transaction, true, newSynchronization, debugEnabled, --- 498,509 ---- log.Debug("Creating new transaction with name [" + definition.Name + "]:" + definition); } ! try ! { ! DoBegin(transaction, definition); ! } catch (TransactionException) ! { ! Resume(null, suspendedResources); ! throw; ! } newSynchronization = (_transactionSyncState != TransactionSynchronizationState.Never); return NewTransactionStatus(definition, transaction, true, newSynchronization, debugEnabled, *************** *** 566,569 **** --- 567,571 ---- throw; } + throw; } bool newSynchronization = (_transactionSyncState != TransactionSynchronizationState.Never); |
From: Mark P. <mar...@us...> - 2007-11-12 19:58:08
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22925 Modified Files: AdoPlatformTransactionManager.cs Log Message: SPRNET-770 Nested RequiresNew propagaion options not working in AdoPlatformTransaction manager SPRNET-769 Resume and throw exception if exception is thrown at start of transaction. Index: AdoPlatformTransactionManager.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core/AdoPlatformTransactionManager.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AdoPlatformTransactionManager.cs 30 Oct 2007 15:24:44 -0000 1.5 --- AdoPlatformTransactionManager.cs 12 Nov 2007 19:57:58 -0000 1.6 *************** *** 145,149 **** try { ! if (txMgrStateObject.ConnectionHolder == null) { IDbConnection newCon = DbProvider.CreateConnection(); --- 145,149 ---- try { ! if (txMgrStateObject.ConnectionHolder == null || txMgrStateObject.ConnectionHolder.SynchronizedWithTransaction) { IDbConnection newCon = DbProvider.CreateConnection(); *************** *** 197,204 **** } ! ! // ********************************* ! // TODO consider DoSuspend/DoResume/DoSetRollbackOnly functionality.... ! // ********************************* /// <summary> --- 197,250 ---- } ! ! /// <summary> ! /// Suspend the resources of the current transaction. ! /// </summary> ! /// <param name="transaction">Transaction object returned by ! /// <see cref="Spring.Transaction.Support.AbstractPlatformTransactionManager.DoGetTransaction"/>.</param> ! /// <returns> ! /// An object that holds suspended resources (will be kept unexamined for passing it into ! /// <see cref="Spring.Transaction.Support.AbstractPlatformTransactionManager.DoResume"/>.) ! /// </returns> ! /// <remarks> ! /// Transaction synchronization will already have been suspended. ! /// </remarks> ! /// <exception cref="Spring.Transaction.IllegalTransactionStateException"> ! /// If suspending is not supported by the transaction manager implementation. ! /// </exception> ! /// <exception cref="Spring.Transaction.TransactionException"> ! /// in case of system errors. ! /// </exception> ! protected override object DoSuspend(object transaction) ! { ! DbProviderTransactionObject txMgrStateObject = (DbProviderTransactionObject)transaction; ! txMgrStateObject.ConnectionHolder = null; ! ConnectionHolder conHolder = (ConnectionHolder) TransactionSynchronizationManager.UnbindResource(DbProvider); ! return conHolder; ! } ! ! ! /// <summary> ! /// Resume the resources of the current transaction. ! /// </summary> ! /// <param name="transaction">Transaction object returned by ! /// <see cref="Spring.Transaction.Support.AbstractPlatformTransactionManager.DoGetTransaction"/>.</param> ! /// <param name="suspendedResources">The object that holds suspended resources as returned by ! /// <see cref="Spring.Transaction.Support.AbstractPlatformTransactionManager.DoSuspend"/>.</param> ! /// <remarks> ! /// Transaction synchronization will be resumed afterwards. ! /// </remarks> ! /// <exception cref="Spring.Transaction.IllegalTransactionStateException"> ! /// If suspending is not supported by the transaction manager implementation. ! /// </exception> ! /// <exception cref="Spring.Transaction.TransactionException"> ! /// In the case of system errors. ! /// </exception> ! protected override void DoResume(object transaction, object suspendedResources) ! { ! ConnectionHolder conHolder = (ConnectionHolder)suspendedResources; ! TransactionSynchronizationManager.BindResource(DbProvider, conHolder); ! } ! /// <summary> |
From: Bruno B. <bb...@us...> - 2007-11-09 15:42:52
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Web/Services In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv3046/src/Spring/Spring.Web/Web/Services Modified Files: WebServiceExporter.cs Log Message: Small optimization to the WebServiceExporter. Index: WebServiceExporter.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Web/Web/Services/WebServiceExporter.cs,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** WebServiceExporter.cs 11 Oct 2007 05:57:33 -0000 1.25 --- WebServiceExporter.cs 9 Nov 2007 15:42:48 -0000 1.26 *************** *** 232,235 **** --- 232,242 ---- public object GetObject() { + // no sense to call this method, because the web service type + // will be instantiated by the .NET infrastructure. (ObjectType is used instead) + if (proxyConstructor == null) + { + proxyConstructor = proxyType.GetConstructor(Type.EmptyTypes); + } + return proxyConstructor.Invoke(ObjectUtils.EmptyObjects); } *************** *** 318,323 **** proxyType = builder.BuildProxyType(); - - proxyConstructor = proxyType.GetConstructor(Type.EmptyTypes); } --- 325,328 ---- |
From: Bruno B. <bb...@us...> - 2007-11-07 19:03:12
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Services/Remoting In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4922/src/Spring/Spring.Services/Remoting Modified Files: CaoExporter.cs Log Message: Fixed CaoRemoteFactory.GetObject() bug in CaoExporter. Index: CaoExporter.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Services/Remoting/CaoExporter.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** CaoExporter.cs 31 Jul 2007 03:48:20 -0000 1.11 --- CaoExporter.cs 7 Nov 2007 19:03:09 -0000 1.12 *************** *** 243,247 **** public object GetObject() { ! remoteObjectFactory.Target = objectFactory.GetObject(targetName, ObjectUtils.EmptyObjects); return remoteObjectFactory.GetObject(); --- 243,247 ---- public object GetObject() { ! remoteObjectFactory.Target = objectFactory.GetObject(targetName); return remoteObjectFactory.GetObject(); |
From: Mark P. <mar...@us...> - 2007-10-30 16:38:12
|
Update of /cvsroot/springnet/Spring.Net/doc/reference/src In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4801 Modified Files: ado.xml Log Message: add docs on adotemplate properties Index: ado.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/ado.xml,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ado.xml 11 Oct 2007 06:02:13 -0000 1.18 --- ado.xml 30 Oct 2007 16:38:03 -0000 1.19 *************** *** 864,867 **** --- 864,910 ---- type-safety.</para> </sect2> + + <sect2> + <title>Quick Guide to AdoTemplate Properties</title> + + <para>AdoTemplate has the following properties that you can + configure</para> + + <itemizedlist> + <listitem> + <para><literal>LazyInit</literal> - Indicates if the + IAdoExceptionTranslator should be created on first encounter of an + exception from the data provider or when AdoTemplate is created. + Default is true, i.e. to lazily instantiate.</para> + </listitem> + + <listitem> + <para><literal>ExceptionTranslator</literal> - Gets or sets the + implementation of IAdoExceptionTranslator ot use. If no custom + translator is provided, a default ErrorCodeExceptionTranslator is + used.</para> + </listitem> + + <listitem> + <para><literal>DbProvider</literal> - Gets or sets the IDbProvider + instance to use.</para> + </listitem> + + <listitem> + <para><literal>DataReaderWrapperType</literal> - Gets or set the + System.Type to use to create an instance of IDataReaderWrapper for + the purpose of having defaults values to use in case of DBNull + values read from IDataReader. See the section <link + linkend="ado-dbnull">mapping DbNull values</link> for more + information.</para> + </listitem> + + <listitem> + <para><literal>CommandTimeout</literal> - Gets or sets the command + timeout for IDbCommands that this AdoTemplate executes. Default is + 0, indicating to use the database provider's default.</para> + </listitem> + </itemizedlist> + </sect2> </sect1> *************** *** 1047,1051 **** </sect1> ! <sect1> <title>Mapping DBNull values</title> --- 1090,1094 ---- </sect1> ! <sect1 id="ado-dbnull"> <title>Mapping DBNull values</title> |
From: Mark P. <mar...@us...> - 2007-10-30 15:29:13
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate12/Data/NHibernate In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv9733 Modified Files: LocalSessionFactoryObject.cs Log Message: SPRNET-759 - Wrong assembly named used to configure NHibernate12's SessionFactory property ExposeTransactionAwareSessionFactory Index: LocalSessionFactoryObject.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate12/Data/NHibernate/LocalSessionFactoryObject.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** LocalSessionFactoryObject.cs 19 Sep 2007 22:58:11 -0000 1.7 --- LocalSessionFactoryObject.cs 30 Oct 2007 15:29:10 -0000 1.8 *************** *** 248,252 **** // Can be overridden by a custom value for the corresponding Hibernate property config.SetProperty(Environment.CurrentSessionContextClass, ! "Spring.Data.NHibernate.SpringSessionContext, Spring.Data.NHibernate"); } --- 248,252 ---- // Can be overridden by a custom value for the corresponding Hibernate property config.SetProperty(Environment.CurrentSessionContextClass, ! "Spring.Data.NHibernate.SpringSessionContext, Spring.Data.NHibernate12"); } |
From: Mark P. <mar...@us...> - 2007-10-30 15:24:51
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7705 Modified Files: IDataReaderWrapper.cs Log Message: SPRNET-756 - Add protected method to ErrorCodeExceptionTranslator to allow for a subclass to first attempt exception translation. Add additional code documentation Index: IDataReaderWrapper.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/IDataReaderWrapper.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IDataReaderWrapper.cs 1 Aug 2007 23:32:35 -0000 1.1 --- IDataReaderWrapper.cs 30 Oct 2007 15:24:44 -0000 1.2 *************** *** 32,39 **** --- 32,48 ---- /// the framework. /// </summary> + /// <remarks>Implementations will typically add behavior to standard IDataReader methods, + /// for example, by providing default values for DbNull values. + /// See <see cref="Spring.Data.Support.NullMappingDataReader"/> as an example. + /// </remarks> /// <author>Mark Pollack (.NET)</author> /// <version>$Id$</version> public interface IDataReaderWrapper : IDataReader { + /// <summary> + /// The underlying reader implementation to delegate to for accessing data + /// from a returned result sets. + /// </summary> + /// <value>The wrapped reader.</value> IDataReader WrappedReader { |
From: Mark P. <mar...@us...> - 2007-10-30 15:24:51
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Generic In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7705/Generic Modified Files: AdoTemplate.cs Log Message: SPRNET-756 - Add protected method to ErrorCodeExceptionTranslator to allow for a subclass to first attempt exception translation. Add additional code documentation Index: AdoTemplate.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Generic/AdoTemplate.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** AdoTemplate.cs 11 Oct 2007 06:03:20 -0000 1.16 --- AdoTemplate.cs 30 Oct 2007 15:24:44 -0000 1.17 *************** *** 115,118 **** --- 115,126 ---- } + /// <summary> + /// Gets or sets a value indicating whether to lazily initialize the + /// IAdoExceptionTranslator for this accessor, on first encounter of a + /// exception from the data provider. Default is "true"; can be switched to + /// "false" for initialization on startup. + /// </summary> + /// <value><c>true</c> if to lazy initialize the IAdoExceptionTranslator; + /// otherwise, <c>false</c>.</value> public override bool LazyInit { *************** *** 121,124 **** --- 129,137 ---- } + /// <summary> + /// Gets or sets the exception translator. If no custom translator is provided, a default + /// <see cref="ErrorCodeExceptionTranslator"/> is used. + /// </summary> + /// <value>The exception translator.</value> public override IAdoExceptionTranslator ExceptionTranslator { *************** *** 129,132 **** --- 142,157 ---- /// <summary> + /// Gets or set the System.Type to use to create an instance of IDataReaderWrapper + /// for the purpose of having defaults values to use in case of DBNull values read + /// from IDataReader. + /// </summary> + /// <value>The type of the data reader wrapper.</value> + public override Type DataReaderWrapperType + { + get { return classicAdoTemplate.DataReaderWrapperType; } + set { classicAdoTemplate.DataReaderWrapperType = value; } + } + + /// <summary> /// Gets the 'Classic' AdoTemplate in Spring.Data /// </summary> *************** *** 964,967 **** --- 989,997 ---- } + /// <summary> + /// Creates the data reader wrapper for use in AdoTemplate callback methods. + /// </summary> + /// <param name="readerToWrap">The reader to wrap.</param> + /// <returns>The data reader used in AdoTemplate callbacks</returns> public override IDataReader CreateDataReaderWrapper(IDataReader readerToWrap) { *************** *** 969,982 **** } - public override Type DataReaderWrapperType - { - get { return classicAdoTemplate.DataReaderWrapperType; } - set { classicAdoTemplate.DataReaderWrapperType = value; } - } - #endregion #region Parameter Creation Helper Methods public override IDataParameter[] DeriveParameters(string procedureName, bool includeReturnParameter) { --- 999,1012 ---- } #endregion #region Parameter Creation Helper Methods + /// <summary> + /// Derives the parameters of a stored procedure including the return parameter + /// </summary> + /// <param name="procedureName">Name of the procedure.</param> + /// <param name="includeReturnParameter">if set to <c>true</c> to include return parameter.</param> + /// <returns>The stored procedure parameters</returns> public override IDataParameter[] DeriveParameters(string procedureName, bool includeReturnParameter) { |
From: Mark P. <mar...@us...> - 2007-10-30 15:24:49
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7705/Core Modified Files: AdoAccessor.cs AdoPlatformTransactionManager.cs AdoTemplate.cs Log Message: SPRNET-756 - Add protected method to ErrorCodeExceptionTranslator to allow for a subclass to first attempt exception translation. Add additional code documentation Index: AdoAccessor.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core/AdoAccessor.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AdoAccessor.cs 7 Aug 2007 23:21:53 -0000 1.2 --- AdoAccessor.cs 30 Oct 2007 15:24:44 -0000 1.3 *************** *** 37,40 **** --- 37,42 ---- private int commandTimeout; + #region Properties + /// <summary> /// An instance of a DbProvider implementation. *************** *** 47,50 **** --- 49,61 ---- + + /// <summary> + /// Gets or sets a value indicating whether to lazily initialize the + /// IAdoExceptionTranslator for this accessor, on first encounter of a + /// exception from the data provider. Default is "true"; can be switched to + /// "false" for initialization on startup. + /// </summary> + /// <value><c>true</c> if to lazy initialize the IAdoExceptionTranslator; + /// otherwise, <c>false</c>.</value> public abstract bool LazyInit { *************** *** 54,57 **** --- 65,73 ---- + /// <summary> + /// Gets or sets the exception translator. If no custom translator is provided, a default + /// <see cref="ErrorCodeExceptionTranslator"/> is used. + /// </summary> + /// <value>The exception translator.</value> public abstract IAdoExceptionTranslator ExceptionTranslator { *************** *** 61,64 **** --- 77,108 ---- + /// <summary> + /// Gets or set the System.Type to use to create an instance of IDataReaderWrapper + /// for the purpose of having defaults values to use in case of DBNull values read + /// from IDataReader. + /// </summary> + /// <value>The type of the data reader wrapper.</value> + public abstract Type DataReaderWrapperType + { + get; + set; + } + + /// <summary> + /// Gets or sets the command timeout for IDbCommands that this AdoTemplate executes. + /// </summary> + /// <remarks>Default is 0, indicating to use the database provider's default. + /// Any timeout specified here will be overridden by the remaining + /// transaction timeout when executing within a transaction that has a + /// timeout specified at the transaction level. + /// </remarks> + /// <value>The command timeout.</value> + public int CommandTimeout + { + get { return commandTimeout; } + set { commandTimeout = value; } + } + + #endregion /// <summary> *************** *** 68,74 **** protected void ApplyCommandSettings(IDbCommand command) { - //TODO investigate setting of FetchSize in a portable way - used on by - //native oracle provider. - //TODO investigate maximum row limit settings. ConnectionUtils.ApplyTransactionTimeout(command, DbProvider, CommandTimeout ); } --- 112,115 ---- *************** *** 116,142 **** public abstract void AfterPropertiesSet(); public abstract IDataReader CreateDataReaderWrapper(IDataReader readerToWrap); - public abstract Type DataReaderWrapperType - { - get; - set; - } - /// <summary> ! /// Gets or sets the command timeout for IDbCommands that this AdoTemplate executes. /// </summary> ! /// <remarks>Default is 0, indicating to use the database provider's default. ! /// Any timeout specified here will be overridden by the remaining ! /// transaction timeout when executing within a transaction that has a ! /// timeout specified at the transaction level. ! /// </remarks> ! /// <value>The command timeout.</value> ! public int CommandTimeout ! { ! get { return commandTimeout; } ! set { commandTimeout = value; } ! } ! protected IDbParameters CreateDbParameters(string name, Enum dbType, int size, object parameterValue) { --- 157,178 ---- public abstract void AfterPropertiesSet(); + /// <summary> + /// Creates the data reader wrapper for use in AdoTemplate callback methods. + /// </summary> + /// <param name="readerToWrap">The reader to wrap.</param> + /// <returns>The data reader used in AdoTemplate callbacks</returns> public abstract IDataReader CreateDataReaderWrapper(IDataReader readerToWrap); /// <summary> ! /// Creates the a db parameters collection, adding to the collection a parameter created from ! /// the method parameters. /// </summary> ! /// <param name="name">The name of the parameter</param> ! /// <param name="dbType">The type of the parameter.</param> ! /// <param name="size">The size of the parameter, for use in defining lengths of string values. Use ! /// 0 if not applicable.</param> ! /// <param name="parameterValue">The parameter value.</param> ! /// <returns>A collection of db parameters with a single parameter in the collection based ! /// on the method parameters</returns> protected IDbParameters CreateDbParameters(string name, Enum dbType, int size, object parameterValue) { *************** *** 149,152 **** --- 185,192 ---- #region Parameter Creation Helper Methods + /// <summary> + /// Creates a new instance of <see cref="DbParameters"/> + /// </summary> + /// <returns>a new instance of <see cref="DbParameters"/></returns> public virtual IDbParameters CreateDbParameters() { *************** *** 154,157 **** --- 194,202 ---- } + /// <summary> + /// Derives the parameters of a stored procedure, not including the return parameter. + /// </summary> + /// <param name="procedureName">Name of the procedure.</param> + /// <returns>The stored procedure parameters.</returns> public virtual IDataParameter[] DeriveParameters(string procedureName) { *************** *** 159,162 **** --- 204,213 ---- } + /// <summary> + /// Derives the parameters of a stored procedure including the return parameter + /// </summary> + /// <param name="procedureName">Name of the procedure.</param> + /// <param name="includeReturnParameter">if set to <c>true</c> to include return parameter.</param> + /// <returns>The stored procedure parameters</returns> public abstract IDataParameter[] DeriveParameters(string procedureName, bool includeReturnParameter); Index: AdoPlatformTransactionManager.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core/AdoPlatformTransactionManager.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AdoPlatformTransactionManager.cs 9 Oct 2007 22:25:15 -0000 1.4 --- AdoPlatformTransactionManager.cs 30 Oct 2007 15:24:44 -0000 1.5 *************** *** 164,176 **** IDbTransaction newTrans = newCon.BeginTransaction(definition.TransactionIsolationLevel); - #region Instrumentation - - if (LOG.IsDebugEnabled) - { - LOG.Debug("Acquired Connection [ " + newCon + "] for ADO.NET transaction"); - } - - #endregion - txMgrStateObject.SetConnectionHolder(new ConnectionHolder(newCon, newTrans), true); --- 164,167 ---- *************** *** 300,303 **** --- 291,300 ---- } IDbConnection con = txMgrStateObject.ConnectionHolder.Connection; + + if (log.IsDebugEnabled) + { + log.Debug("Releasing ADO.NET Connection [" + con + ", " + con.ConnectionString + "] after transaction"); + } + ConnectionUtils.DisposeConnection(con, DbProvider); //TODO clear out IDbTransaction object? Index: AdoTemplate.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core/AdoTemplate.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AdoTemplate.cs 11 Oct 2007 04:40:59 -0000 1.4 --- AdoTemplate.cs 30 Oct 2007 15:24:44 -0000 1.5 *************** *** 133,136 **** --- 133,144 ---- } + /// <summary> + /// Gets or sets a value indicating whether to lazily initialize the + /// IAdoExceptionTranslator for this accessor, on first encounter of a + /// exception from the data provider. Default is "true"; can be switched to + /// "false" for initialization on startup. + /// </summary> + /// <value><c>true</c> if to lazy initialize the IAdoExceptionTranslator; + /// otherwise, <c>false</c>.</value> public override bool LazyInit { *************** *** 139,142 **** --- 147,155 ---- } + /// <summary> + /// Gets or sets the exception translator. If no custom translator is provided, a default + /// <see cref="ErrorCodeExceptionTranslator"/> is used. + /// </summary> + /// <value>The exception translator.</value> public override IAdoExceptionTranslator ExceptionTranslator { *************** *** 152,155 **** --- 165,174 ---- } + /// <summary> + /// Gets or set the System.Type to use to create an instance of IDataReaderWrapper + /// for the purpose of having defaults values to use in case of DBNull values read + /// from IDataReader. + /// </summary> + /// <value>The type of the data reader wrapper.</value> public override Type DataReaderWrapperType { *************** *** 197,208 **** } - #region Experimental methods. - /* - public object ExecuteTypedAdapter(object adapter, ITypedAdapterCallback callback) - { - return Execute(new ExecuteTypeDataAdapterCallback(adapter, callback)); - } - */ - #endregion #region General Execute Callback Methods --- 216,219 ---- *************** *** 3116,3119 **** --- 3127,3135 ---- #endregion + /// <summary> + /// Creates the data reader wrapper for use in AdoTemplate callback methods. + /// </summary> + /// <param name="readerToWrap">The reader to wrap.</param> + /// <returns>The data reader used in AdoTemplate callbacks</returns> public override IDataReader CreateDataReaderWrapper(IDataReader readerToWrap) { |
From: Mark P. <mar...@us...> - 2007-10-30 15:24:48
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv7705/Support Modified Files: ErrorCodeExceptionTranslator.cs Log Message: SPRNET-756 - Add protected method to ErrorCodeExceptionTranslator to allow for a subclass to first attempt exception translation. Add additional code documentation Index: ErrorCodeExceptionTranslator.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Support/ErrorCodeExceptionTranslator.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ErrorCodeExceptionTranslator.cs 1 Jan 2007 22:22:50 -0000 1.9 --- ErrorCodeExceptionTranslator.cs 30 Oct 2007 15:24:44 -0000 1.10 *************** *** 63,74 **** #region Constructor (s) ! public ErrorCodeExceptionTranslator(IDbProvider provider) { DbProvider = provider; } ! ! ! public ErrorCodeExceptionTranslator(IDbProvider provider, ErrorCodes ec) { --- 63,83 ---- #region Constructor (s) ! ! /// <summary> ! /// Initializes a new instance of the <see cref="ErrorCodeExceptionTranslator"/> class. ! /// </summary> ! /// <param name="provider">The data provider.</param> public ErrorCodeExceptionTranslator(IDbProvider provider) { DbProvider = provider; } ! ! ! ! /// <summary> ! /// Initializes a new instance of the <see cref="ErrorCodeExceptionTranslator"/> class. ! /// </summary> ! /// <param name="provider">The data provider.</param> ! /// <param name="ec">The error code collection.</param> public ErrorCodeExceptionTranslator(IDbProvider provider, ErrorCodes ec) { *************** *** 83,86 **** --- 92,99 ---- #region Properties + /// <summary> + /// Sets the db provider. + /// </summary> + /// <value>The db provider.</value> public IDbProvider DbProvider { *************** *** 94,110 **** } ! /* ! public string ProductName ! { ! set ! { ! //TODO would need a DbProvider registry or group together ! //error code with dbprovider definition in order to ! //configure this class based on product name ! errorCodes = ErrorCodesFactory.Instance.GetErrorCodes(value); ! } ! } ! */ ! public ErrorCodes ErrorCodes { --- 107,114 ---- } ! /// <summary> ! /// Gets the error codes for the provider ! /// </summary> ! /// <value>The error codes.</value> public ErrorCodes ErrorCodes { *************** *** 116,120 **** #endregion ! public IAdoExceptionTranslator FallbackTranslator { --- 120,129 ---- #endregion ! ! /// <summary> ! /// Gets or sets the fallback translator to use in case error code based translation ! /// fails. ! /// </summary> ! /// <value>The fallback translator.</value> public IAdoExceptionTranslator FallbackTranslator { *************** *** 146,150 **** /// <paramref name="exception"/>. /// </returns> ! public DataAccessException Translate(string task, string sql, Exception exception) { if (task == null) --- 155,159 ---- /// <paramref name="exception"/>. /// </returns> ! public virtual DataAccessException Translate(string task, string sql, Exception exception) { if (task == null) *************** *** 157,161 **** } string errorCode = ExtractErrorCode(exception); ! if (this.errorCodes != null) { --- 166,179 ---- } string errorCode = ExtractErrorCode(exception); ! ! // First, try custom translation from overridden method. ! DataAccessException dex = TranslateException(task, sql, errorCode, exception); ! if (dex != null) ! { ! return dex; ! } ! ! ! if (errorCodes != null) { *************** *** 208,224 **** log.Debug("Unable to translate exception eith errorCode '" + errorCode + "', will use the fallback translator"); } ! return this.fallbackTranslator.Translate(task, sql, exception); } ! public bool IsValidDataAccessException(Exception e) { ! return dbProvider.IsDataAccessException(e); ! } ! private string BuildMessage(string task, string sql, Exception exception) { return task + "; SQL [" + sql + "]; " + exception.Message; } private void LogTranslation(string task, string sql, string errorCode, Exception exception, bool b) { --- 226,285 ---- log.Debug("Unable to translate exception eith errorCode '" + errorCode + "', will use the fallback translator"); } ! return fallbackTranslator.Translate(task, sql, exception); } ! /// <summary> ! /// Subclasses can override this method to attempt a custom mapping from a data access Exception ! /// to DataAccessException. ! /// </summary> ! /// <param name="task">Readable text describing the task being attempted.</param> ! /// <param name="sql">SQL query or update that caused the problem. May be <code>null</code>.</param> ! /// <param name="errorCode">The error code extracted from the generic data access exception for ! /// a particular provider.</param> ! /// <param name="exception">The exception thrown from a data access operation.</param> ! /// <returns> ! /// null if no custom translation was possible, otherwise a DataAccessException ! /// resulting from custom translation. This exception should include the exception parameter ! /// as a nested root cause. This implementation always returns null, meaning that ! /// the translator always falls back to the default error codes. ! /// </returns> ! protected virtual DataAccessException TranslateException(string task, string sql, string errorCode, Exception exception) { ! return null; ! } ! ! /// <summary> ! /// Builds the message. ! /// </summary> ! /// <param name="task">The task.</param> ! /// <param name="sql">The SQL.</param> ! /// <param name="exception">The exception.</param> ! /// <returns></returns> ! protected virtual string BuildMessage(string task, string sql, Exception exception) { return task + "; SQL [" + sql + "]; " + exception.Message; } + /// <summary> + /// Determines whether the specified exception is valid data access exception. + /// </summary> + /// <param name="e">The exception.</param> + /// <returns> + /// <c>true</c> if is valid data access exception; otherwise, <c>false</c>. + /// </returns> + public bool IsValidDataAccessException(Exception e) + { + return dbProvider.IsDataAccessException(e); + } + + /// <summary> + /// Logs the translation. + /// </summary> + /// <param name="task">The task.</param> + /// <param name="sql">The SQL.</param> + /// <param name="errorCode">The error code.</param> + /// <param name="exception">The exception.</param> + /// <param name="b">if set to <c>true</c> [b].</param> private void LogTranslation(string task, string sql, string errorCode, Exception exception, bool b) { |
From: Mark P. <mar...@us...> - 2007-10-21 18:32:45
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Data In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv10635 Modified Files: TestObjectMgr.cs Log Message: fix to compile on .net 1.0,1.1 Index: TestObjectMgr.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Data/TestObjectMgr.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestObjectMgr.cs 21 Oct 2007 18:16:53 -0000 1.2 --- TestObjectMgr.cs 21 Oct 2007 18:32:41 -0000 1.3 *************** *** 22,26 **** using System; - using System.Transactions; using Common.Logging; using Spring.Objects; --- 22,25 ---- *************** *** 66,78 **** LOG.Debug("TransactionActive = " + TransactionSynchronizationManager.ActualTransactionActive); } ! [Transaction(TransactionPropagation.Required, IsolationLevel.Unspecified, Timeout = 50, RollbackFor = new Type[]{typeof(ArgumentNullException)}, ReadOnly = false, ! #if NET_2_0 ! EnterpriseServicesInteropOption = EnterpriseServicesInteropOption.Automatic, #endif - NoRollbackFor = new Type[]{typeof(ArithmeticException), typeof(NotSupportedException)})] - //[Transaction()] public void DeleteTwoTestObjects(string name1, string name2) { --- 65,80 ---- LOG.Debug("TransactionActive = " + TransactionSynchronizationManager.ActualTransactionActive); } ! #if !NET_1_0 && !NET_1_1 [Transaction(TransactionPropagation.Required, IsolationLevel.Unspecified, Timeout = 50, RollbackFor = new Type[]{typeof(ArgumentNullException)}, ReadOnly = false, ! EnterpriseServicesInteropOption = System.Transactions.EnterpriseServicesInteropOption.Automatic, ! NoRollbackFor = new Type[] { typeof(ArithmeticException), typeof(NotSupportedException) })] ! #else ! [Transaction(TransactionPropagation.Required, IsolationLevel.Unspecified, Timeout = 50, ! RollbackFor = new Type[]{typeof(ArgumentNullException)}, ! ReadOnly = false, ! NoRollbackFor = new Type[] { typeof(ArithmeticException), typeof(NotSupportedException) })] #endif public void DeleteTwoTestObjects(string name1, string name2) { |
From: Mark P. <mar...@us...> - 2007-10-21 18:17:44
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4749 Modified Files: LogFactoryObject.cs Log Message: remove old ref to log4net in code comments Index: LogFactoryObject.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config/LogFactoryObject.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LogFactoryObject.cs 16 Mar 2007 04:01:38 -0000 1.2 --- LogFactoryObject.cs 21 Oct 2007 18:17:41 -0000 1.3 *************** *** 39,43 **** /// <see cref="LogFactoryObject.LogName"/> /// property determines the name of the ! /// <a href="http://logging.apache.org/log4net/">Log4Net</a> logger. /// </p> /// </remarks> --- 39,43 ---- /// <see cref="LogFactoryObject.LogName"/> /// property determines the name of the ! /// <a href="http://netcommon.sourceforge.net/">Common.Logging</a> logger. /// </p> /// </remarks> |
From: Mark P. <mar...@us...> - 2007-10-21 18:17:11
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4334/Spring.Core.Tests Modified Files: Spring.Core.Tests.2005.csproj Log Message: SPRNET-606 Problems with Attributes in proxy generation - fix for regression bug copying Spring Transaction attributes, add unit test for this case. Clean up misc documentation in code. Index: Spring.Core.Tests.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2005.csproj,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** Spring.Core.Tests.2005.csproj 14 Sep 2007 15:45:50 -0000 1.68 --- Spring.Core.Tests.2005.csproj 21 Oct 2007 18:16:45 -0000 1.69 *************** *** 102,105 **** --- 102,106 ---- <Reference Include="System.EnterpriseServices" /> <Reference Include="System.Runtime.Serialization.Formatters.Soap" /> + <Reference Include="System.Transactions" /> <Reference Include="System.Web" /> <Reference Include="System.Web.Services" /> |
From: Mark P. <mar...@us...> - 2007-10-21 18:17:11
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Transaction/Interceptor In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4372 Modified Files: AbstractTransactionAspectTests.cs TransactionInterceptorTests.cs Log Message: SPRNET-606 Problems with Attributes in proxy generation - fix for regression bug copying Spring Transaction attributes, add unit test for this case. Clean up misc documentation in code. Index: TransactionInterceptorTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Transaction/Interceptor/TransactionInterceptorTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TransactionInterceptorTests.cs 17 Aug 2007 02:43:30 -0000 1.2 --- TransactionInterceptorTests.cs 21 Oct 2007 18:16:58 -0000 1.3 *************** *** 39,43 **** protected override object Advised(object target, IPlatformTransactionManager ptm, ! MethodMapTransactionAttributeSource tas) { TransactionInterceptor ti = new TransactionInterceptor(); --- 39,43 ---- protected override object Advised(object target, IPlatformTransactionManager ptm, ! ITransactionAttributeSource tas) { TransactionInterceptor ti = new TransactionInterceptor(); Index: AbstractTransactionAspectTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Transaction/Interceptor/AbstractTransactionAspectTests.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AbstractTransactionAspectTests.cs 9 Oct 2007 22:25:20 -0000 1.4 --- AbstractTransactionAspectTests.cs 21 Oct 2007 18:16:58 -0000 1.5 *************** *** 25,28 **** --- 25,29 ---- using NUnit.Framework; using Rhino.Mocks; + using Spring.Data; using Spring.Objects; *************** *** 48,51 **** --- 49,65 ---- [Test] + public void CopyAttributes() + { + + IPlatformTransactionManager ptm = PlatformTxManagerForNewTransaction(); + AttributesTransactionAttributeSource tas = new AttributesTransactionAttributeSource(); + TestObjectMgr to = new TestObjectMgr(); + ITestObjectMgr ito = (ITestObjectMgr)Advised(to, ptm, tas); + + ito.DeleteTwoTestObjects("foo", "bar"); + + } + + [Test] public void CannotCommitTransaction() { *************** *** 209,213 **** protected abstract object Advised(object target, IPlatformTransactionManager ptm, ! MethodMapTransactionAttributeSource tas); } --- 223,227 ---- protected abstract object Advised(object target, IPlatformTransactionManager ptm, ! ITransactionAttributeSource tas); } |
From: Mark P. <mar...@us...> - 2007-10-21 18:17:11
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Data In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4352 Modified Files: TestObjectMgr.cs Log Message: SPRNET-606 Problems with Attributes in proxy generation - fix for regression bug copying Spring Transaction attributes, add unit test for this case. Clean up misc documentation in code. Index: TestObjectMgr.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Data/TestObjectMgr.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestObjectMgr.cs 16 Jul 2007 21:06:45 -0000 1.1 --- TestObjectMgr.cs 21 Oct 2007 18:16:53 -0000 1.2 *************** *** 22,29 **** --- 22,32 ---- using System; + using System.Transactions; using Common.Logging; using Spring.Objects; + using Spring.Transaction; using Spring.Transaction.Interceptor; using Spring.Transaction.Support; + using IsolationLevel=System.Data.IsolationLevel; #endregion *************** *** 64,68 **** } ! [Transaction()] public void DeleteTwoTestObjects(string name1, string name2) { --- 67,78 ---- } ! [Transaction(TransactionPropagation.Required, IsolationLevel.Unspecified, Timeout = 50, ! RollbackFor = new Type[]{typeof(ArgumentNullException)}, ! ReadOnly = false, ! #if NET_2_0 ! EnterpriseServicesInteropOption = EnterpriseServicesInteropOption.Automatic, ! #endif ! NoRollbackFor = new Type[]{typeof(ArithmeticException), typeof(NotSupportedException)})] ! //[Transaction()] public void DeleteTwoTestObjects(string name1, string name2) { |
From: Mark P. <mar...@us...> - 2007-10-21 18:16:51
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Transaction/Interceptor In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4322 Modified Files: DefaultTransactionAttribute.cs TransactionAttribute.cs Log Message: SPRNET-606 Problems with Attributes in proxy generation - fix for regression bug copying Spring Transaction attributes, add unit test for this case. Clean up misc documentation in code. Index: DefaultTransactionAttribute.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Transaction/Interceptor/DefaultTransactionAttribute.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DefaultTransactionAttribute.cs 1 Aug 2007 18:53:14 -0000 1.7 --- DefaultTransactionAttribute.cs 21 Oct 2007 18:16:38 -0000 1.8 *************** *** 25,29 **** { /// <summary> ! /// Transaction attribute approach to rolling back on system exceptions, no other /// exceptions by default. /// </summary> --- 25,29 ---- { /// <summary> ! /// Transaction attribute approach to rolling back on all exceptions, no other /// exceptions by default. /// </summary> Index: TransactionAttribute.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Transaction/Interceptor/TransactionAttribute.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TransactionAttribute.cs 8 Aug 2007 20:59:50 -0000 1.6 --- TransactionAttribute.cs 21 Oct 2007 18:16:38 -0000 1.7 *************** *** 33,38 **** /// .NET Attribute for describing transactional behavior of methods in a class. /// </summary> ! /// <remarks>Defines metadata that is used to create a ! /// <see cref="RuleBasedTransactionAttribute"/>.</remarks> /// <author>Mark Pollack (.NET)</author> /// <version>$Id$</version> --- 33,51 ---- /// .NET Attribute for describing transactional behavior of methods in a class. /// </summary> ! /// <remarks>This attribute type is generally directly comparable ! /// to Spring's <see cref="RuleBasedTransactionAttribute"/> class and ! /// in fact <see cref="AttributesTransactionAttributeSource"/> will ! /// directly convert the data to a <see cref="RuleBasedTransactionAttribute"/> ! /// so that Spring's transaction support code does not have to know about ! /// attributes. If no rules are relevant to the exception it will be treaded ! /// like DefaultTransactionAttribute, (rolling back on all exceptions). ! /// <para> ! /// The default property values are TransactionPropagation.Required, IsolationLevel.Unspecified, ! /// DefaultTransactionDefinition.TIMEOUT_DEFAULT (can be changed, by default is the default ! /// value of the underlying transaction subsystem) ! /// ReadOnly = false, and Type.EmtptyTypes specified for Rollbackfor and NoRollbackFor exception ! /// types. ! /// </para> ! /// </remarks> /// <author>Mark Pollack (.NET)</author> /// <version>$Id$</version> *************** *** 50,54 **** private Type[] _noRollbackTypes = Type.EmptyTypes; #if NET_2_0 ! private System.Transactions.EnterpriseServicesInteropOption _esInteropOption; #endif --- 63,68 ---- private Type[] _noRollbackTypes = Type.EmptyTypes; #if NET_2_0 ! private System.Transactions.EnterpriseServicesInteropOption _esInteropOption = ! System.Transactions.EnterpriseServicesInteropOption.Automatic; #endif *************** *** 58,62 **** /// <summary> /// Initializes a new instance of the <see cref="TransactionAttribute"/> class. ! /// </summary> public TransactionAttribute() { --- 72,76 ---- /// <summary> /// Initializes a new instance of the <see cref="TransactionAttribute"/> class. ! /// </summary> public TransactionAttribute() { *************** *** 64,72 **** } public TransactionAttribute(TransactionPropagation transactionPropagation) : this() { _transactionPropagation = transactionPropagation; ! } ! public TransactionAttribute(TransactionPropagation transactionPropagation, IsolationLevel isolationLevel) : this(transactionPropagation) --- 78,95 ---- } + /// <summary> + /// Initializes a new instance of the <see cref="TransactionAttribute"/> class. + /// </summary> + /// <param name="transactionPropagation">The transaction propagation.</param> public TransactionAttribute(TransactionPropagation transactionPropagation) : this() { _transactionPropagation = transactionPropagation; ! } ! ! /// <summary> ! /// Initializes a new instance of the <see cref="TransactionAttribute"/> class. ! /// </summary> ! /// <param name="transactionPropagation">The transaction propagation.</param> ! /// <param name="isolationLevel">The isolation level.</param> public TransactionAttribute(TransactionPropagation transactionPropagation, IsolationLevel isolationLevel) : this(transactionPropagation) *************** *** 75,82 **** --- 98,119 ---- } + /// <summary> + /// Initializes a new instance of the <see cref="TransactionAttribute"/> class. + /// </summary> + /// <param name="isolationLevel">The isolation level.</param> + public TransactionAttribute(IsolationLevel isolationLevel) + { + _isolationLevel = isolationLevel; + } + #endregion #region Properties + /// <summary> + /// Gets the transaction propagation. + /// </summary> + /// <remarks>Defaults to TransactionPropagation.Required</remarks> + /// <value>The transaction propagation.</value> public TransactionPropagation TransactionPropagation { *************** *** 84,87 **** --- 121,129 ---- } + /// <summary> + /// Gets the isolation level. + /// </summary> + /// <remarks>Defaults to IsolationLevel.Unspecified</remarks> + /// <value>The isolation level.</value> public IsolationLevel IsolationLevel { *************** *** 89,92 **** --- 131,139 ---- } + /// <summary> + /// Gets or sets the timeout. + /// </summary> + /// <remarks>Defaults to the default timeout of the underlying transaction system.</remarks> + /// <value>The timeout.</value> public int Timeout { *************** *** 95,98 **** --- 142,150 ---- } + /// <summary> + /// Gets or sets a value indicating whether the transaction is readonly. + /// </summary> + /// <remarks>Defaults to false</remarks> + /// <value><c>true</c> if read-only; otherwise, <c>false</c>.</value> public bool ReadOnly { *************** *** 101,104 **** --- 153,164 ---- } + /// <summary> + /// Gets or sets the zero or more exception types which + /// indicating which exception types must cause a transaction + /// rollback. + /// </summary> + /// <remarks>This is the preferred way to construct a rollback rule, + /// matching the exception class and subclasses.</remarks> + /// <value>The rollback types.</value> public Type[] RollbackFor { *************** *** 107,110 **** --- 167,178 ---- } + /// <summary> + /// Gets or sets zero or more exceptions types which + /// indicationg which exception type must <c>not</c> + /// cause a transaction rollback. + /// </summary> + /// <remarks>This is the preferred way to construct a rollback rule, + /// matching the exception type.</remarks> + /// <value>The no rollback for.</value> public Type[] NoRollbackFor { *************** *** 115,118 **** --- 183,190 ---- #if NET_2_0 + /// <summary> + /// Gets or sets the enterprise services interop option. + /// </summary> + /// <value>The enterprise services interop option.</value> public System.Transactions.EnterpriseServicesInteropOption EnterpriseServicesInteropOption { |
From: Mark P. <mar...@us...> - 2007-10-21 18:16:44
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Util In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4311 Modified Files: AttributeUtils.cs Log Message: SPRNET-606 Problems with Attributes in proxy generation - fix for regression bug copying Spring Transaction attributes, add unit test for this case. Clean up misc documentation in code. Index: AttributeUtils.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Util/AttributeUtils.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AttributeUtils.cs 16 Oct 2007 00:28:49 -0000 1.2 --- AttributeUtils.cs 21 Oct 2007 18:16:32 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- using System.Collections; using System.Collections.Generic; + using System.Collections.ObjectModel; using System.Globalization; using System.Reflection; *************** *** 264,268 **** { propertiesToSet.Add(attributeProperties[j]); ! namedParameterValues[k++] = namedArgument.TypedValue.Value; // The bellow few lines are only for testing purposes --- 265,269 ---- { propertiesToSet.Add(attributeProperties[j]); ! namedParameterValues[k++] = ResolveValues(namedArgument.TypedValue.Value); // The bellow few lines are only for testing purposes *************** *** 300,303 **** --- 301,350 ---- } + private static object ResolveValues(object value) + { + if (value == null) return value; + + // We are only hunting for the case of the ReadOnlyCollection<T> here. + ReadOnlyCollection<CustomAttributeTypedArgument> sourceArray = + value as ReadOnlyCollection<CustomAttributeTypedArgument>; + + if (sourceArray == null) return value; + + Type underlyingType = null; // type to be used for arguments + Type listType = null; + object list = null; + List<int> prototypeList = new List<int>(); + + foreach (CustomAttributeTypedArgument typedArgument in sourceArray) + { + if (underlyingType == null) + { + underlyingType = typedArgument.ArgumentType; + + listType = + Type.GetType("System.Collections.Generic.List`1[[" + underlyingType.AssemblyQualifiedName + "]], " + prototypeList.GetType().Assembly.FullName, true, false); + list = Activator.CreateInstance(listType); + + + } + if (!underlyingType.Equals(typedArgument.ArgumentType)) + { + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, + "Types for the same named parameter of array type are expected to be same")); + } + + MethodInfo addMethod = listType.GetMethod("Add"); + object[] addMethodParameters = new object[1]; + addMethodParameters[0] = typedArgument.Value; + addMethod.Invoke(list, addMethodParameters); + + + } + MethodInfo toArrayMethod = listType.GetMethod("ToArray"); + + return toArrayMethod.Invoke(list, new object[]{}); + + } + |
From: Bruno B. <bb...@us...> - 2007-10-18 09:52:22
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv21022 Modified Files: dbproviders.xml Log Message: Fix SqlServerCE 3.1 provider for now. Index: dbproviders.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common/dbproviders.xml,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** dbproviders.xml 16 Oct 2007 16:08:18 -0000 1.23 --- dbproviders.xml 18 Oct 2007 09:52:18 -0000 1.24 *************** *** 106,110 **** <constructor-arg name="dataAdapterType" value="System.Data.SqlServerCe.SqlCeDataAdapter, System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/> <constructor-arg name="commandBuilderType" value="System.Data.SqlServerCe.SqlCeCommandBuilder, System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/> ! <constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/> <constructor-arg name="parameterDbType" value="System.Data.SqlDbType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> <constructor-arg name="parameterDbTypeProperty" value="SqlDbType"/> --- 106,110 ---- <constructor-arg name="dataAdapterType" value="System.Data.SqlServerCe.SqlCeDataAdapter, System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/> <constructor-arg name="commandBuilderType" value="System.Data.SqlServerCe.SqlCeCommandBuilder, System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/> ! <constructor-arg name="commandBuilderDeriveParametersMethod" value="InitializeCommand"/> <constructor-arg name="parameterDbType" value="System.Data.SqlDbType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> <constructor-arg name="parameterDbTypeProperty" value="SqlDbType"/> |
From: Mark P. <mar...@us...> - 2007-10-17 17:51:19
|
Update of /cvsroot/springnet/Spring.Net/doc/reference/src In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv27411 Modified Files: tx-quickstart.xml Log Message: update exception advice syntax... Index: tx-quickstart.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/tx-quickstart.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tx-quickstart.xml 9 Aug 2007 06:30:17 -0000 1.5 --- tx-quickstart.xml 17 Oct 2007 17:51:07 -0000 1.6 *************** *** 168,172 **** 'wired' together. The top level object for the purposes of this quick start is the account manager, which is retrieved from Spring's application ! context and the method DoTransfer is executed. </para> <para>Note, future releases will instead have as the driver program a --- 168,172 ---- 'wired' together. The top level object for the purposes of this quick start is the account manager, which is retrieved from Spring's application ! context and the method DoTransfer is executed.</para> <para>Note, future releases will instead have as the driver program a *************** *** 328,332 **** <property name="exceptionHandlers"> <list> ! <value>on ArithmeticException log 'Logging an exception thrown from method ' + #method.Name </value> </list> </property> --- 328,332 ---- <property name="exceptionHandlers"> <list> ! <value>on exception name ArithmeticException log 'Logging an exception thrown from method ' + #method.Name </value> </list> </property> |