springnet-commits Mailing List for Spring Framework .NET (Page 32)
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-28 05:55:02
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23657/Support Modified Files: TestDbProvider.cs Log Message: SPRNET-776 - Unit tests for AdoPlatformTransactionManager update docs to reflect limitations of AdoPlatformTransactionManager for nested transactions. code cleanup in AdoTemplate, ConnectionUtils Index: TestDbProvider.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Support/TestDbProvider.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TestDbProvider.cs 20 Nov 2007 04:04:05 -0000 1.9 --- TestDbProvider.cs 28 Nov 2007 05:54:56 -0000 1.10 *************** *** 37,40 **** --- 37,41 ---- { private string connectionString; + private IDbConnection connection; protected IDbMetadata dbMetadata; *************** *** 72,76 **** public IDbConnection CreateConnection() { ! throw new NotImplementedException(); } --- 73,77 ---- public IDbConnection CreateConnection() { ! return connection; } *************** *** 135,138 **** } } ! } } --- 136,147 ---- } } ! ! #region Stub method to set behavior ! ! public IDbConnection ConnectionToCreate ! { ! set { connection = value;} ! } ! #endregion ! } } |
From: Mark P. <mar...@us...> - 2007-11-28 05:55:02
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Data In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23657/Data Modified Files: AdoPlatformTransactionManagerTests.cs Log Message: SPRNET-776 - Unit tests for AdoPlatformTransactionManager update docs to reflect limitations of AdoPlatformTransactionManager for nested transactions. code cleanup in AdoTemplate, ConnectionUtils Index: AdoPlatformTransactionManagerTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Data/AdoPlatformTransactionManagerTests.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AdoPlatformTransactionManagerTests.cs 12 Nov 2007 19:58:13 -0000 1.5 --- AdoPlatformTransactionManagerTests.cs 28 Nov 2007 05:54:56 -0000 1.6 *************** *** 23,30 **** --- 23,34 ---- using System; using System.Data; + using System.Threading; using NUnit.Framework; using Rhino.Mocks; + using Spring.Dao; using Spring.Data.Common; using Spring.Data.Core; + using Spring.Data.Support; + using Spring.Support; using Spring.Transaction; using Spring.Transaction.Support; *************** *** 35,39 **** { /// <summary> ! /// This calss contains tests for /// </summary> /// <author>Mark Pollack</author> --- 39,43 ---- { /// <summary> ! /// This class contains tests for AdoPlatformTransactionManager /// </summary> /// <author>Mark Pollack</author> *************** *** 50,58 **** } ! // todo test tx sync calls. [Test] public void TransactionCommit() { IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); --- 54,70 ---- } ! [TearDown] ! public void TearDown() ! { ! Assert.IsTrue(TransactionSynchronizationManager.ResourceDictionary.Count == 0); ! Assert.IsFalse(TransactionSynchronizationManager.SynchronizationActive); ! Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly); ! Assert.IsFalse(TransactionSynchronizationManager.ActualTransactionActive); ! } [Test] public void TransactionCommit() { + #region Mock setup IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); *************** *** 71,74 **** --- 83,88 ---- } + #endregion + mocks.ReplayAll(); *************** *** 91,94 **** --- 105,110 ---- public void TransactionRollback() { + #region Mock Setup + IDbProvider dbProvider = (IDbProvider) mocks.CreateMock(typeof (IDbProvider)); IDbConnection connection = (IDbConnection) mocks.CreateMock(typeof (IDbConnection)); *************** *** 107,110 **** --- 123,129 ---- connection.Dispose(); } + + #endregion + mocks.ReplayAll(); *************** *** 388,395 **** --- 407,1182 ---- public void PropagationNeverWithExistingTransaction() { + #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.Rollback(); + 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"); + + try + { + tt.Execute(new PropagationNeverWithExistingTransactionCallback(tt)); + Assert.Fail("Should have thrown IllegalTransactionStateException"); + } catch (IllegalTransactionStateException) + { + //expected. + } + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + + mocks.VerifyAll(); + } + + [Test] + public void PropagationRequiresNewWithExistingConnection() + { + #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(); + connection.Dispose(); + + IDbConnection connection2 = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); + IDbTransaction transaction2 = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + + Expect.Call(dbProvider.CreateConnection()).Return(connection2); + connection2.Open(); + LastCall.On(connection2).Repeat.Once(); + Expect.Call(connection2.BeginTransaction(IsolationLevel.Unspecified)).Return(transaction2); + transaction2.Commit(); + LastCall.On(transaction2).Repeat.Once(); + connection2.Dispose(); + + #endregion + + mocks.ReplayAll(); + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + TransactionTemplate tt = new TransactionTemplate(tm); + tt.PropagationBehavior = TransactionPropagation.Supports; + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + Assert.IsTrue(!TransactionSynchronizationManager.SynchronizationActive, "Synchronizations not active"); + + tt.Execute(new PropagationRequiresNewWithExistingConnectionCallback(tt, connection, connection2, dbProvider)); + + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + + mocks.VerifyAll(); + } + + [Test] + public void TransactionWithIsolation() + { + #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.Serializable)).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; + tt.TransactionIsolationLevel = IsolationLevel.Serializable; + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + + tt.Execute(new TransactionCommitTxCallback(dbProvider)); + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + + mocks.VerifyAll(); + } + + [Test] + public void TransactionWithLongTimeout() + { + DoTransactionWithTimeout(10); + } + + [Test] + public void TransactionWithShortTimeout() + { + DoTransactionWithTimeout(1); + } + + private void DoTransactionWithTimeout(int timeout) + { + #region Mock setup + + IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); + IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); + IDbTransaction transaction = (IDbTransaction)mocks.CreateMock(typeof(IDbTransaction)); + IDbCommand command = (IDbCommand) mocks.CreateMock(typeof (IDbCommand)); + + using (mocks.Ordered()) + { + Expect.Call(dbProvider.CreateConnection()).Return(connection); + connection.Open(); + + LastCall.On(connection).Repeat.Once(); + Expect.Call(connection.BeginTransaction(IsolationLevel.Unspecified)).Return(transaction); + Expect.Call(connection.CreateCommand()).Return(command); + command.CommandText = "some SQL statement"; + LastCall.On(command).Repeat.Once(); + if (timeout > 1) + { + command.CommandTimeout = (timeout - 1); + transaction.Commit(); + } else + { + transaction.Rollback(); + } + LastCall.On(transaction).Repeat.Once(); + connection.Dispose(); + } + + #endregion + + mocks.ReplayAll(); + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + TransactionTemplate tt = new TransactionTemplate(tm); + tt.TransactionTimeout = timeout; + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + + try + { + tt.Execute(new TransactionWithTimeoutCallback(dbProvider)); + if (timeout <= 1) + { + Assert.Fail("Should have thrown TransactionTimedOutException"); + } + } catch (TransactionTimedOutException) + { + if (timeout <=1 ) + { + //expected + } else + { + throw; + } + } + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + + mocks.VerifyAll(); + } + + [Test] + public void TransactionWithExceptionOnBegin() + { + #region Mock setup + IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); + + // CreateConnection is called in AdoPlatformTransactionManager.DoBegin + Expect.Call(dbProvider.CreateConnection()).Throw(new TestSqlException("Cannot begin", "314")); + + + #endregion + + mocks.ReplayAll(); + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + TransactionTemplate tt = new TransactionTemplate(tm); + try + { + tt.Execute(new TransactionDelegate(TransactionWithExceptionNoOp)); + } catch (CannotCreateTransactionException) + { + // expected + } + + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + + mocks.VerifyAll(); + } + + private object TransactionWithExceptionNoOp(ITransactionStatus status) + { + return null; + } + + [Test] + public void TransactionWithExceptionOnCommit() + { + #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).Throw(new TestSqlException("Cannot commit", "314")); + connection.Dispose(); + } + + #endregion + + mocks.ReplayAll(); + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + TransactionTemplate tt = new TransactionTemplate(tm); + + try + { + tt.Execute(new TransactionDelegate(TransactionWithExceptionNoOp)); + } catch (TransactionSystemException) + { + //expected + } + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + mocks.VerifyAll(); } + + + [Test] + public void TransactionWithExceptionOnCommitAndRollbackOnCommitFailure() + { + #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); + transaction.Commit(); + LastCall.On(transaction).Throw(new TestSqlException("Cannot commit", "314")); + + transaction.Rollback(); + LastCall.On(transaction).Repeat.Once(); + + connection.Dispose(); + } + #endregion + mocks.ReplayAll(); + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + tm.RollbackOnCommitFailure = true; + TransactionTemplate tt = new TransactionTemplate(tm); + + try + { + tt.Execute(new TransactionDelegate(TransactionWithExceptionNoOp)); + } + catch (TransactionSystemException) + { + //expected + } + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + + mocks.VerifyAll(); + } + + [Test] + public void TransactionWithExceptionOnRollback() + { + #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.Rollback(); + LastCall.On(transaction).Throw(new TestSqlException("Cannot commit", "314")); + + connection.Dispose(); + } + + #endregion + + mocks.ReplayAll(); + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + TransactionTemplate tt = new TransactionTemplate(tm); + + try + { + tt.Execute(new TransactionDelegate(TransactionWithExceptionOnRollbackMethod)); + } + catch (TransactionSystemException) + { + //expected + } + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + + mocks.VerifyAll(); + + } + + private object TransactionWithExceptionOnRollbackMethod(ITransactionStatus status) + { + status.RollbackOnly = true; + return null; + } + + [Test] + public void TransactionWithPropagationSupports() + { + IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); + + mocks.ReplayAll(); + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + TransactionTemplate tt = new TransactionTemplate(tm); + tt.PropagationBehavior = TransactionPropagation.Supports; + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + + tt.Execute(new TransactionWithPropagationSupportsCallback(dbProvider)); + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + mocks.VerifyAll(); + } + + [Test] + public void TransactionWithPropagationNotSupported() + { + IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); + + mocks.ReplayAll(); + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + TransactionTemplate tt = new TransactionTemplate(tm); + tt.PropagationBehavior = TransactionPropagation.NotSupported; + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + + tt.Execute(new TransactionWithPropagationNotSupportedCallback(dbProvider)); + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + mocks.VerifyAll(); + } + + [Test] + public void TransactionWithPropagationNever() + { + IDbProvider dbProvider = (IDbProvider)mocks.CreateMock(typeof(IDbProvider)); + + mocks.ReplayAll(); + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + TransactionTemplate tt = new TransactionTemplate(tm); + tt.PropagationBehavior = TransactionPropagation.Never; + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + + tt.Execute(new TransactionWithPropagationNotSupportedCallback(dbProvider)); + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + mocks.VerifyAll(); + } + + [Test] + public void ExistingTransactionWithPropagationNestedNotSupported() + { + #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); + + transaction.Rollback(); + LastCall.On(transaction).Repeat.Once(); + connection.Dispose(); + } + + #endregion + + mocks.ReplayAll(); + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + TransactionTemplate tt = new TransactionTemplate(tm); + tt.PropagationBehavior = TransactionPropagation.Nested; + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + Assert.IsTrue(!TransactionSynchronizationManager.SynchronizationActive, "Synchronizations not active"); + + try + { + tt.Execute(new ExistingTransactionWithPropagationNestedCallback(dbProvider, tt)); + Assert.Fail("Should have thrown NestedTransactionNotSupportedException"); + } catch (NestedTransactionNotSupportedException) + { + // expected + } + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + mocks.VerifyAll(); + } + + [Test] + public void TransactionWithPropagationNested() + { + #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); + + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + Assert.IsTrue(!TransactionSynchronizationManager.SynchronizationActive, "Synchronizations not active"); + + + tt.Execute(new TransactionDelegate(TransactionWithPropagationNestedMethod)); + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + mocks.VerifyAll(); + + + } + + private object TransactionWithPropagationNestedMethod(ITransactionStatus status) + { + Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); + return null; + } + + [Test] + public void TransactionWithPropagationNestedAndRollback() + { + #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); + transaction.Rollback(); + LastCall.On(transaction).Repeat.Once(); + connection.Dispose(); + } + + #endregion + + mocks.ReplayAll(); + + AdoPlatformTransactionManager tm = new AdoPlatformTransactionManager(dbProvider); + TransactionTemplate tt = new TransactionTemplate(tm); + + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + Assert.IsTrue(!TransactionSynchronizationManager.SynchronizationActive, "Synchronizations not active"); + + + tt.Execute(new TransactionDelegate(TransactionWithPropagationNestedAndRollbackMethod)); + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(dbProvider), "Hasn't thread db provider"); + mocks.VerifyAll(); + + + } + + private object TransactionWithPropagationNestedAndRollbackMethod(ITransactionStatus status) + { + Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); + status.RollbackOnly = true; + return null; + } } + internal class ExistingTransactionWithPropagationNestedCallback : ITransactionCallback + { + private IDbProvider dbProvider; + private TransactionTemplate tt; + + public ExistingTransactionWithPropagationNestedCallback(IDbProvider dbProvider, TransactionTemplate transactionTemplate) + { + this.dbProvider = dbProvider; + tt = transactionTemplate; + } + + public object DoInTransaction(ITransactionStatus status) + { + Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); + //TODO: Note no support for savepoints at this time (1.1), so can't check that a savepoint isn't present. + + tt.Execute(new ExistingTransactionWithPropagationNestedCallback2(dbProvider)); + + Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); + //TODO: Note no support for savepoints at this time (1.1), so can't check that a savepoint isn't present. + return null; + } + } + + internal class ExistingTransactionWithPropagationNestedCallback2 : ITransactionCallback + { + private IDbProvider dbProvider; + + public ExistingTransactionWithPropagationNestedCallback2(IDbProvider provider) + { + dbProvider = provider; + } + + public object DoInTransaction(ITransactionStatus status) + { + Assert.IsTrue(TransactionSynchronizationManager.HasResource(dbProvider), "Has thread db provider"); + Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive, "Synchronizations active"); + Assert.IsTrue(!status.IsNewTransaction, "Isn't new transaction"); + //TODO: Note no support for savepoints at this time (1.1), so can't check that a savepoint is present. + return null; + } + } + + #region Supporting class for TransactionWithPropagationNotSupported + internal class TransactionWithPropagationNotSupportedCallback : ITransactionCallback + { + private IDbProvider provider; + + public TransactionWithPropagationNotSupportedCallback(IDbProvider provider) + { + this.provider = provider; + } + + public object DoInTransaction(ITransactionStatus status) + { + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(provider), "Hasn't thread db provider"); + Assert.IsTrue(!status.IsNewTransaction, "Is not new transaction"); + return null; + } + } + #endregion + + #region Supporting class for TransactionWithPropagationSupports + internal class TransactionWithPropagationSupportsCallback : ITransactionCallback + { + private IDbProvider provider; + + public TransactionWithPropagationSupportsCallback(IDbProvider provider) + { + this.provider = provider; + } + + public object DoInTransaction(ITransactionStatus status) + { + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(provider), "Hasn't thread db provider"); + Assert.IsTrue(!status.IsNewTransaction,"Is not new transaction"); + Assert.IsFalse(TransactionSynchronizationManager.CurrentTransactionReadOnly); + Assert.IsFalse(TransactionSynchronizationManager.ActualTransactionActive); + return null; + } + } + #endregion + + + #region Supporting class for TransactionWithTimeout + + internal class TransactionWithTimeoutCallback : ITransactionCallback + { + private IDbProvider provider; + public TransactionWithTimeoutCallback(IDbProvider provider) + { + this.provider = provider; + } + + public object DoInTransaction(ITransactionStatus status) + { + try + { + Thread.Sleep(1500); + } catch (Exception) + { + + } + try + { + IDbConnection con = ConnectionUtils.GetConnection(provider); + IDbCommand cmd = con.CreateCommand(); + cmd.CommandText = "some SQL statement"; + ConnectionUtils.ApplyTransactionTimeout(cmd, provider); + + } catch (Exception e) + { + if (e.GetType() != typeof(TransactionTimedOutException)) + { + throw new DataAccessResourceFailureException("", e); + } + throw; + } + return null; + } + } + #endregion + + #region Supporting class for PropagationRequiresNewWithExistingConnection + + internal class PropagationRequiresNewWithExistingConnectionCallback : ITransactionCallback + { + private TransactionTemplate tt; + private IDbProvider dbProvider; + private IDbConnection connection; + private IDbConnection connection2; + + public PropagationRequiresNewWithExistingConnectionCallback(TransactionTemplate transactionTemplate, IDbConnection connection, IDbConnection connection2, IDbProvider provider) + { + tt = transactionTemplate; + this.connection = connection; + this.connection2 = connection2; + dbProvider = provider; + } + + public object DoInTransaction(ITransactionStatus status) + { + Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive, "Synchronizations active"); + Assert.AreSame(connection, ConnectionUtils.GetConnection(dbProvider)); + Assert.AreSame(connection, ConnectionUtils.GetConnection(dbProvider)); + tt.PropagationBehavior = TransactionPropagation.RequiresNew; + tt.ReadOnly = true; + tt.Execute(new PropagationRequiresNewWithExistingConnectionCallback2(dbProvider, connection2)); + Assert.AreSame(connection, ConnectionUtils.GetConnection(dbProvider)); + return null; + } + } + + internal class PropagationRequiresNewWithExistingConnectionCallback2 : ITransactionCallback + { + private IDbProvider dbProvider; + private IDbConnection connection2; + + + public PropagationRequiresNewWithExistingConnectionCallback2(IDbProvider dbProvider, IDbConnection connection2) + { + this.dbProvider = dbProvider; + this.connection2 = connection2; + } + + public object DoInTransaction(ITransactionStatus status) + { + Assert.IsTrue(TransactionSynchronizationManager.HasResource(dbProvider), "Has thread db provider"); + Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive, "Synchronizations active"); + Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); + Assert.AreSame(connection2, ConnectionUtils.GetConnection(dbProvider)); + Assert.AreSame(connection2, ConnectionUtils.GetConnection(dbProvider)); + + return null; + } + } + + #endregion + + #region Supporting classes for PropagationNeverWithExistingTransaction + + internal class PropagationNeverWithExistingTransactionCallback : ITransactionCallback + { + private TransactionTemplate innerTxTemplate; + + public PropagationNeverWithExistingTransactionCallback(TransactionTemplate transactionTemplate) + { + innerTxTemplate = transactionTemplate; + } + + + public object DoInTransaction(ITransactionStatus status) + { + Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); + innerTxTemplate.PropagationBehavior = TransactionPropagation.Never; + innerTxTemplate.Execute(new PropagationNeverWithExistingTransactionCallback2()); + Assert.Fail("Should have thrown IllegalTransactionStateException"); + return null; + } + } + + internal class PropagationNeverWithExistingTransactionCallback2 : ITransactionCallback + { + + public object DoInTransaction(ITransactionStatus status) + { + Assert.Fail("Should have thrown IllegalTransactionStateException"); + return null; + } + } + + #endregion + #region Supporting classes for PropagationNotSupportedWithExistingTransaction *************** *** 541,545 **** public object DoInTransaction(ITransactionStatus status) { ! Assert.IsTrue(TransactionSynchronizationManager.HasResource(provider), "Hasn't thread db provider"); Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive); Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); --- 1328,1332 ---- public object DoInTransaction(ITransactionStatus status) { ! Assert.IsTrue(TransactionSynchronizationManager.HasResource(provider), "Has thread db provider"); Assert.IsTrue(TransactionSynchronizationManager.SynchronizationActive); Assert.IsTrue(status.IsNewTransaction, "Is new transaction"); *************** *** 622,625 **** --- 1409,1414 ---- #endregion + + #region Helper class |
From: Mark P. <mar...@us...> - 2007-11-28 05:54:51
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23634/Support Modified Files: AdoTransactionObjectSupport.cs ConnectionUtils.cs Log Message: SPRNET-776 - Unit tests for AdoPlatformTransactionManager update docs to reflect limitations of AdoPlatformTransactionManager for nested transactions. code cleanup in AdoTemplate, ConnectionUtils Index: AdoTransactionObjectSupport.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Support/AdoTransactionObjectSupport.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AdoTransactionObjectSupport.cs 29 Aug 2007 03:42:13 -0000 1.6 --- AdoTransactionObjectSupport.cs 28 Nov 2007 05:54:47 -0000 1.7 *************** *** 31,47 **** namespace Spring.Data.Support { ! /// <summary> ! /// Convenient base class for ADO.NET transaction aware objects. ! /// </summary> ! /// <remarks> ! /// Can contain a ConnectionHolder object. ! /// </remarks> ! /// <author>Mark Pollack (.NET)</author> ! /// <version>$Id$</version> ! public abstract class AdoTransactionObjectSupport : ISavepointManager, ISmartTransactionObject ! { ! #region Fields ! private ConnectionHolder connectionHolder; private IsolationLevel previousIsolationLevel; --- 31,47 ---- namespace Spring.Data.Support { ! /// <summary> ! /// Convenient base class for ADO.NET transaction aware objects. ! /// </summary> ! /// <remarks> ! /// Can contain a ConnectionHolder object. ! /// </remarks> ! /// <author>Mark Pollack (.NET)</author> ! /// <version>$Id$</version> ! public abstract class AdoTransactionObjectSupport : ISavepointManager, ISmartTransactionObject ! { ! #region Fields ! private ConnectionHolder connectionHolder; private IsolationLevel previousIsolationLevel; *************** *** 49,65 **** private bool savepointAllowed; ! #endregion ! #region Constants ! /// <summary> ! /// The shared log instance for this class (and derived classes). ! /// </summary> ! protected static readonly ILog log = ! LogManager.GetLogger(typeof (AdoTransactionObjectSupport)); ! #endregion - #region Properties public ConnectionHolder ConnectionHolder { --- 49,66 ---- private bool savepointAllowed; ! #endregion ! #region Constants ! /// <summary> ! /// The shared log instance for this class (and derived classes). ! /// </summary> ! protected static readonly ILog log = ! LogManager.GetLogger(typeof (AdoTransactionObjectSupport)); ! #endregion ! ! #region Properties public ConnectionHolder ConnectionHolder { *************** *** 70,77 **** public bool HasConnectionHolder { ! get ! { ! return (connectionHolder != null); ! } } --- 71,75 ---- public bool HasConnectionHolder { ! get { return (connectionHolder != null); } } *************** *** 95,169 **** public abstract bool RollbackOnly { get; } ! #endregion ! ! /// <summary> ! /// Create a new savepoint. ! /// </summary> ! /// <param name="savepointName"> ! /// The name of the savepoint to create. ! /// </param> ! /// <remarks> ! /// You can roll back to a specific savepoint ! /// via <see cref="Spring.Transaction.ISavepointManager.RollbackToSavepoint"/>, ! /// and explicitly release a savepoint that you don't need anymore via ! /// <see cref="Spring.Transaction.ISavepointManager.ReleaseSavepoint"/>. ! /// <p> ! /// Note that most transaction managers will automatically release ! /// savepoints at transaction completion. ! /// </p> ! /// </remarks> ! /// <exception cref="Spring.Transaction.TransactionException"> ! /// If the savepoint could not be created, ! /// either because the backend does not support it or because the ! /// transaction is not in an appropriate state. ! /// </exception> ! /// <returns> ! /// A savepoint object, to be passed into ! /// <see cref="Spring.Transaction.ISavepointManager.RollbackToSavepoint"/> ! /// or <see cref="Spring.Transaction.ISavepointManager.ReleaseSavepoint"/>. ! /// </returns> ! public virtual void CreateSavepoint(string savepointName) ! { ! throw new NotImplementedException(); ! } ! ! /// <summary> ! /// Roll back to the given savepoint. ! /// </summary> ! /// <remarks> ! /// The savepoint will be automatically released afterwards. ! /// </remarks> ! /// <param name="savepoint">The savepoint to roll back to.</param> ! /// <exception cref="Spring.Transaction.TransactionException"> ! /// If the rollback failed. ! /// </exception> ! public virtual void RollbackToSavepoint(string savepoint) ! { ! throw new NotImplementedException(); ! } ! /// <summary> ! /// Explicitly release the given savepoint. ! /// </summary> ! /// <remarks> ! /// <p> ! /// Note that most transaction managers will automatically release ! /// savepoints at transaction completion. ! /// </p> ! /// <p> ! /// Implementations should fail as silently as possible if ! /// proper resource cleanup will still happen at transaction completion. ! /// </p> ! /// </remarks> ! /// <param name="savepoint">The savepoint to release.</param> ! /// <exception cref="Spring.Transaction.TransactionException"> ! /// If the release failed. ! /// </exception> ! public virtual void ReleaseSavepoint(string savepoint) ! { ! throw new NotImplementedException(); ! } ! } ! } --- 93,170 ---- public abstract bool RollbackOnly { get; } ! #endregion ! /// <summary> ! /// Create a new savepoint. ! /// </summary> ! /// <param name="savepointName"> ! /// The name of the savepoint to create. ! /// </param> ! /// <remarks> ! /// You can roll back to a specific savepoint ! /// via <see cref="Spring.Transaction.ISavepointManager.RollbackToSavepoint"/>, ! /// and explicitly release a savepoint that you don't need anymore via ! /// <see cref="Spring.Transaction.ISavepointManager.ReleaseSavepoint"/>. ! /// <p> ! /// Note that most transaction managers will automatically release ! /// savepoints at transaction completion. ! /// </p> ! /// </remarks> ! /// <exception cref="Spring.Transaction.TransactionException"> ! /// If the savepoint could not be created, ! /// either because the backend does not support it or because the ! /// transaction is not in an appropriate state. ! /// </exception> ! /// <returns> ! /// A savepoint object, to be passed into ! /// <see cref="Spring.Transaction.ISavepointManager.RollbackToSavepoint"/> ! /// or <see cref="Spring.Transaction.ISavepointManager.ReleaseSavepoint"/>. ! /// </returns> ! public virtual void CreateSavepoint(string savepointName) ! { ! throw new NestedTransactionNotSupportedException( ! "Cannot create a nested transaction because savepoints have not been implemented in the metadata for the DbProvider."); ! } + /// <summary> + /// Roll back to the given savepoint. + /// </summary> + /// <remarks> + /// The savepoint will be automatically released afterwards. + /// </remarks> + /// <param name="savepoint">The savepoint to roll back to.</param> + /// <exception cref="Spring.Transaction.TransactionException"> + /// If the rollback failed. + /// </exception> + public virtual void RollbackToSavepoint(string savepoint) + { + throw new NestedTransactionNotSupportedException( + "Cannot rollback to a savepoint in a nested transaction because savepoints have not been implemented in the metadata for the DbProvider."); + + } ! /// <summary> ! /// Explicitly release the given savepoint. ! /// </summary> ! /// <remarks> ! /// <p> ! /// Note that most transaction managers will automatically release ! /// savepoints at transaction completion. ! /// </p> ! /// <p> ! /// Implementations should fail as silently as possible if ! /// proper resource cleanup will still happen at transaction completion. ! /// </p> ! /// </remarks> ! /// <param name="savepoint">The savepoint to release.</param> ! /// <exception cref="Spring.Transaction.TransactionException"> ! /// If the release failed. ! /// </exception> ! public virtual void ReleaseSavepoint(string savepoint) ! { ! throw new NestedTransactionNotSupportedException( ! "Cannot release a savepoint in a nested transaction because savepoints have not been implemented in the metadata for the DbProvider."); ! ! } ! } ! } \ No newline at end of file Index: ConnectionUtils.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Support/ConnectionUtils.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ConnectionUtils.cs 24 Jul 2007 21:01:11 -0000 1.8 --- ConnectionUtils.cs 28 Nov 2007 05:54:47 -0000 1.9 *************** *** 145,151 **** } IDbConnection conn = provider.CreateConnection(); ! conn.Open(); ! ! if (TransactionSynchronizationManager.SynchronizationActive) { LOG.Debug("Registering transaction synchronization for IDbConnection"); --- 145,151 ---- } IDbConnection conn = provider.CreateConnection(); ! conn.Open(); ! ! if (TransactionSynchronizationManager.SynchronizationActive) { LOG.Debug("Registering transaction synchronization for IDbConnection"); *************** *** 208,211 **** --- 208,216 ---- } + /// <summary> + /// Applies the current transaction timeout, if any, to the given ADO.NET IDbCommand object. + /// </summary> + /// <param name="command">The command.</param> + /// <param name="dbProvider">The db provider.</param> public static void ApplyTransactionTimeout(IDbCommand command, IDbProvider dbProvider) { *************** *** 213,216 **** --- 218,228 ---- } + /// <summary> + /// Applies the specified timeout - overridden by the current transaction timeout, if any, to to the + /// given ADO.NET IDb command object. + /// </summary> + /// <param name="command">The command.</param> + /// <param name="dbProvider">The db provider the command was obtained from.</param> + /// <param name="timeout">The timeout to apply (or 0 for no timeout outside of a transaction.</param> public static void ApplyTransactionTimeout(IDbCommand command, IDbProvider dbProvider, int timeout) { |
From: Mark P. <mar...@us...> - 2007-11-28 05:54:51
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23634/Core Modified Files: AdoTemplate.cs Log Message: SPRNET-776 - Unit tests for AdoPlatformTransactionManager update docs to reflect limitations of AdoPlatformTransactionManager for nested transactions. code cleanup in AdoTemplate, ConnectionUtils Index: AdoTemplate.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Core/AdoTemplate.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AdoTemplate.cs 30 Oct 2007 15:24:44 -0000 1.5 --- AdoTemplate.cs 28 Nov 2007 05:54:47 -0000 1.6 *************** *** 1140,1150 **** - /* TODO - public DataTable DataTableCreateWithParams(IDbDataAdapterCreator dataAdapterCreator) - { - throw new NotImplementedException(); - } - */ - #endregion --- 1140,1143 ---- *************** *** 1277,1289 **** } - //TODO - /* - public int DataTableFillWithParams(DataTable dataTable, - IDbDataAdapterCreator dataAdapterCreator) - { - throw new NotImplementedException(); - } - */ - #endregion --- 1270,1273 ---- |
From: Mark P. <mar...@us...> - 2007-11-28 05:54:42
|
Update of /cvsroot/springnet/Spring.Net/doc/reference/styles In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23617/styles Modified Files: html_chunk.xsl Log Message: SPRNET-776 - Unit tests for AdoPlatformTransactionManager update docs to reflect limitations of AdoPlatformTransactionManager for nested transactions. code cleanup in AdoTemplate, ConnectionUtils Index: html_chunk.xsl =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/styles/html_chunk.xsl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** html_chunk.xsl 19 Oct 2006 19:43:36 -0000 1.4 --- html_chunk.xsl 28 Nov 2007 05:54:38 -0000 1.5 *************** *** 86,90 **** <xsl:template name="user.header.navigation"> <div style="background-color:white;border:none;height:73px;border:1px solid black;"> ! <a style="border:none;" href="http://www.springframework.org/" title="The Spring Framework"> <img style="border:none;" src="images/xdev-spring_logo.jpg" /> </a> --- 86,90 ---- <xsl:template name="user.header.navigation"> <div style="background-color:white;border:none;height:73px;border:1px solid black;"> ! <a style="border:none;" href="http://www.springframework.net/" title="The Spring Framework"> <img style="border:none;" src="images/xdev-spring_logo.jpg" /> </a> |
From: Mark P. <mar...@us...> - 2007-11-28 05:54:41
|
Update of /cvsroot/springnet/Spring.Net/doc/reference/src In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23617/src Modified Files: transaction.xml Log Message: SPRNET-776 - Unit tests for AdoPlatformTransactionManager update docs to reflect limitations of AdoPlatformTransactionManager for nested transactions. code cleanup in AdoTemplate, ConnectionUtils Index: transaction.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/transaction.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** transaction.xml 27 Nov 2007 21:01:42 -0000 1.21 --- transaction.xml 28 Nov 2007 05:54:37 -0000 1.22 *************** *** 1370,1376 **** </table> ! <para>Please not that changing of isolation levels on a per-method basis ! is scheduled for RC1. Please check the forums for news on when this ! feature will be introduced into the nightly builds.</para> <para>If you specify an exception type for 'NoRollbackFor' the action --- 1370,1383 ---- </table> ! <para>Note that setting the TransactionPropagation to Nested will throw ! a NestedTransactionNotSupportedException in a case when actual nested ! transations occurs, i.e. not in the case of applying the Nested ! propagation but in fact no nested calls are made. This will be fixed for ! the Spring 1.2 release for SqlServer and Oracle which support nested ! transactions. Also note, that changing of isolation levels on a ! per-method basis is also scheduled for the Spring 1.2 release since it ! requires detailed command text metadata for each dbprovider.. Please ! check the forums for news on when this feature will be introduced into ! the nightly builds.</para> <para>If you specify an exception type for 'NoRollbackFor' the action *************** *** 1379,1382 **** --- 1386,1398 ---- out to the calling code.</para> + <para>The ReadOnly boolean is a hint to the data access technology to + enable read-only optimizatations. This currenlty has no effect in + Spring's ADO.NET framework. If you would like to enable read-only + optimizations in ADO.NET this is generally done via the 'Mode=Read' or + 'Mode=Read-Only" options in the connection string. Check your database + provider for more information. In the case of NHibernate the flush mode + is set to Never when a new Session is created for the + transaction.</para> + <para>Throwing exceptions to indicate failure and assuming success is an easier and less invasive programming model than performing the same task |
From: Mark P. <mar...@us...> - 2007-11-27 21:10:45
|
Update of /cvsroot/springnet/Spring.Net/doc/reference/src In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv6974 Modified Files: overview.xml Log Message: added a section on quickstarts to the overview Index: overview.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/overview.xml,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** overview.xml 20 Oct 2006 23:57:00 -0000 1.18 --- overview.xml 27 Nov 2007 21:10:42 -0000 1.19 *************** *** 70,74 **** Dependency Injection (DI) principle. If you need a decent insight into IoC and DI, please do refer to the article : ! http://martinfowler.com/articles/injection.html. </para> </sect1> --- 70,74 ---- Dependency Injection (DI) principle. If you need a decent insight into IoC and DI, please do refer to the article : ! http://martinfowler.com/articles/injection.html.</para> </sect1> *************** *** 147,157 **** <sect1> <title>License Information</title> <para>Spring.NET is licensed according to the terms of the Apache License, Version 2.0. The full text of this license are available online at ! http://www.apache.org/licenses/LICENSE-2.0 . You can also ! view the full text of the license in the license.txt file located in the ! root installation directory.</para> </sect1> --- 147,167 ---- <sect1> + <title>Quickstart applications</title> + + <para>There are several sample applications that are described in the + <xref linkend="quickstarts" /> section. if you are already familiar with + the concepts of dependency injection, AOP, or have experience using the + Java version of the Spring framework you may find jumping into the + examples a better way to bootstrap the learning processing process.</para> + </sect1> + + <sect1> <title>License Information</title> <para>Spring.NET is licensed according to the terms of the Apache License, Version 2.0. The full text of this license are available online at ! http://www.apache.org/licenses/LICENSE-2.0 . You can also view the full ! text of the license in the license.txt file located in the root ! installation directory.</para> </sect1> *************** *** 159,165 **** <title>Support</title> ! <para>Training and Support are available through <ulink url="http://www.interface21.com">Interface21</ulink> in addition ! to mailing lists and fourms you can find on the main <ulink url="http://www.springframework.net">Spring.NET</ulink> ! website.</para> </sect1> </chapter> \ No newline at end of file --- 169,176 ---- <title>Support</title> ! <para>Training and Support are available through <ulink ! url="http://www.interface21.com">Interface21</ulink> in addition to ! mailing lists and fourms you can find on the main <ulink ! url="http://www.springframework.net">Spring.NET</ulink> website.</para> </sect1> </chapter> \ No newline at end of file |
From: Mark P. <mar...@us...> - 2007-11-27 21:01:51
|
Update of /cvsroot/springnet/Spring.Net/doc/reference/src In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv3268 Modified Files: ado.xml aop.xml objects.xml transaction.xml Log Message: misc doc cleanup - most importantly some reworking of the intro section to chapter 2. Index: transaction.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/transaction.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** transaction.xml 3 Oct 2007 14:38:35 -0000 1.20 --- transaction.xml 27 Nov 2007 21:01:42 -0000 1.21 *************** *** 232,245 **** ServiceDomainPlatformTransactionManager uses the 'Services without Components' update so that your objects do not need to inherit from ! ServicedComponent and as such calls ServiceDomain.Enter(), Leave; ! ContextUtil.SetAbort(). Note you can use Spring's EnterpriseServices ! exporter to have a EnterpriseService proxy created for your plain .NET ! object. TxScopePlatformTransactionManager calls new TransactionScope(); .Complete(), Dispose(), Transaction.Current.Rollback(). Configuration properties for each transaction manager are specific to the data access technology used. Refer to the API docs for comprehensive information but the examples should give you a good basis for getting started. The ! HibernatePlatformTransactionManager is described more in the section ! <classname></classname>.</para> <para>The <literal>GetTransaction(..)</literal> method returns a --- 232,244 ---- ServiceDomainPlatformTransactionManager uses the 'Services without Components' update so that your objects do not need to inherit from ! ServicedComponent or directly call the EnterpriseServices API ! ServiceDomain.Enter(), Leave; ContextUtil.SetAbort(). ! TxScopePlatformTransactionManager calls; new TransactionScope(); .Complete(), Dispose(), Transaction.Current.Rollback(). Configuration properties for each transaction manager are specific to the data access technology used. Refer to the API docs for comprehensive information but the examples should give you a good basis for getting started. The ! HibernatePlatformTransactionManager is described more in the following ! <link lang="" linkend="orm-tx-mgmt">section</link> .</para> <para>The <literal>GetTransaction(..)</literal> method returns a Index: ado.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/ado.xml,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ado.xml 30 Oct 2007 16:38:03 -0000 1.19 --- ado.xml 27 Nov 2007 21:01:42 -0000 1.20 *************** *** 1213,1218 **** lightweight object mapping framework.</para> ! <sect2> ! <title id="ado-resultsetextractor">ResultSetExtractor</title> <para>The ResultSetExtractor gives you control to iterate over the --- 1213,1218 ---- lightweight object mapping framework.</para> ! <sect2 id="ado-resultsetextractor"> ! <title>ResultSetExtractor</title> <para>The ResultSetExtractor gives you control to iterate over the *************** *** 1291,1296 **** </sect2> ! <sect2> ! <title id="ado-rowcallback">RowCallback</title> <para>The RowCallback is usually a statefull object itself or populates --- 1291,1296 ---- </sect2> ! <sect2 id="ado-rowcallback"> ! <title>RowCallback</title> <para>The RowCallback is usually a statefull object itself or populates *************** *** 1346,1351 **** </sect2> ! <sect2> ! <title id="ado-rowmapper">RowMapper</title> <para>The RowMapper lets you focus on just the logic to map a row of --- 1346,1351 ---- </sect2> ! <sect2 id="ado-rowmapper"> ! <title>RowMapper</title> <para>The RowMapper lets you focus on just the logic to map a row of Index: objects.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/objects.xml,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** objects.xml 11 Oct 2007 13:01:43 -0000 1.108 --- objects.xml 27 Nov 2007 21:01:42 -0000 1.109 *************** *** 1,43 **** <?xml version="1.0" encoding="UTF-8"?> <chapter id="objects"> ! <title>abstractObjectObjects, Object Factories, and Application ! Contexts</title> <sect1 id="objects-introduction"> <title>Introduction</title> <para>The <literal>Spring.Core</literal> assembly provides the basis for ! the Spring.NET Inversion of Control (IoC - sometimes also referred to as ! Dependency Injection) features (see <xref linkend="background-ioc" /> for ! some additional material describing this software engineering principle). ! The <classname><ulink url="http://www.springframework.net/doc/api/html/Spring.Objects.Factory.IObjectFactory.html">IObjectFactory</ulink></classname> ! interface from the <literal>Spring.Core</literal> assembly provides an ! advanced configuration mechanism capable of managing objects of any ! nature, using potentially any kind of storage facility. The ! <classname><ulink url="http://www.springframework.net/doc/api/html/Spring.Context.IApplicationContext.html">IApplicationContext</ulink></classname> ! interface from the same assembly builds on top of the functionality ! provided by the <classname>IObjectFactory</classname> interface, ! complementing it with features such as integration with Spring.NET's ! Aspect Oriented Programming (AOP) features and message resource handling ! (for use in internationalization).</para> <para>In short, the <classname>IObjectFactory</classname> provides the configuration framework and basic functionality, while the <classname>IApplicationContext</classname> adds more enterprise-centric ! functionality to it. In general, the ! <classname>IApplicationContext</classname> is a complete superset of the ! <classname>IObjectFactory</classname>, and any description of ! <classname>IObjectFactory</classname> capabilities and behavior should be ! considered to apply to <literal>IApplicationContext</literal>s as ! well.</para> ! <para>This chapter is divided into two parts, with the first part covering ! the basic principles that apply to both the ! <classname>IObjectFactory</classname> and ! <classname>IApplicationContext</classname>, with the second part covering ! those features that apply only to the ! <classname>IApplicationContext</classname> interface.</para> <para>If you are new to Spring.NET or IoC containers in general, you may --- 1,45 ---- <?xml version="1.0" encoding="UTF-8"?> <chapter id="objects"> ! <title>The IoC container</title> <sect1 id="objects-introduction"> <title>Introduction</title> + <para>This chapter covers the Spring Framework's implementation of the + Inversion of Control (IoC) <footnote> + <para>See the section entitled <xref + linkend="background-ioc" /></para> + </footnote> principle</para> + <para>The <literal>Spring.Core</literal> assembly provides the basis for ! the Spring.NET Inversion of Control container. The <classname><ulink url="http://www.springframework.net/doc/api/html/Spring.Objects.Factory.IObjectFactory.html">IObjectFactory</ulink></classname> ! interface provides an advanced configuration mechanism capable of managing ! objects of any nature. The <classname><ulink url="http://www.springframework.net/doc/api/html/Spring.Context.IApplicationContext.html">IApplicationContext</ulink></classname> ! interface builds on top of the <classname>IObjectFactory</classname> (it ! is a sub-interface) and adds other functionality such as easier ! integration with Spring.NET's Aspect Oriented Programming (AOP) features, ! message resource handling (for use in internationalization), event ! propagation and appliation layer-specific context such as ! <classname>WebApplicationContext</classname> for use in web ! applications.</para> <para>In short, the <classname>IObjectFactory</classname> provides the configuration framework and basic functionality, while the <classname>IApplicationContext</classname> adds more enterprise-centric ! functionality to it. The <classname>IApplicationContext</classname> is a ! complete superset of the <classname>IObjectFactory</classname>, and any ! description of <classname>IObjectFactory</classname> capabilities and ! behavior should be considered to apply to ! <literal>IApplicationContext</literal>s as well.</para> ! <para>This chapter is divided into two parts, with the <link ! linkend="objects-basics">first part</link> covering the basic principles ! that apply to both the <classname>IObjectFactory</classname> and ! <classname>IApplicationContext</classname>, with the <link ! linkend="context-introduction">second part</link> covering those features ! that apply only to the <classname>IApplicationContext</classname> ! interface.</para> <para>If you are new to Spring.NET or IoC containers in general, you may *************** *** 52,63 **** <sect1 id="objects-basics"> ! <title>Introduction to the IObjectFactory, IApplicationContext, and ! IObjectDefinition</title> <sect2 id="objects-factory"> ! <title>The IObjectFactory and IApplicationContext</title> ! <para>The <classname>IObjectFactory</classname> is the actual container ! that instantiates, configures, and manages a number of objects. These objects typically collaborate with one another, and thus can be said to have dependencies between themselves. These dependencies are reflected --- 54,65 ---- <sect1 id="objects-basics"> ! <title>Basics - containers and objects</title> <sect2 id="objects-factory"> ! <title>The container</title> ! <para>The <classname>IObjectFactory</classname> is the actual ! representation of the Spring IoC container that is responsible for ! instantiating, configuring, and managing a number of objects. These objects typically collaborate with one another, and thus can be said to have dependencies between themselves. These dependencies are reflected *************** *** 3779,3784 **** <note> ! In an ASP.NET environment you must specify the full, four-part name ! of the assembly when using a <classname>NameValueFileSectionHandler</classname> <programlisting> <section name="hibernateConfiguration" --- 3781,3790 ---- <note> ! In an ASP.NET environment you must specify the full, four-part name of the assembly when using a ! ! <classname>NameValueFileSectionHandler</classname> ! ! ! <programlisting> <section name="hibernateConfiguration" *************** *** 3786,3791 **** Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> </programlisting> </note> ! <sect4> <title>Type, Ref, and Expression substitution</title> --- 3792,3799 ---- Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> </programlisting> + + </note> ! <sect4> <title>Type, Ref, and Expression substitution</title> *************** *** 3913,3983 **** <title>IVariableSource</title> ! <para> ! The IVariableSource is the base interface for providing the ! ability to get the value of property placeholders (name-value) pairs ! from a variety of sources. Out of the box, Spring.NET supports a ! number of variable sources that allow users to obtain variable values ! from .NET config files, java-style property files, environment ! variables, command line arguments and the registry and the new ! connection strings configuraiton section in .NET 2.0. The list of ! implementing classes is listed below. Please refer to the SDK ! documentation for more information. ! </para> <itemizedlist> <listitem> ! <para> ! <classname>ConfigSectionVariableSource</classname> ! </para> </listitem> <listitem> ! <para> ! <classname>PropertyFileVariableSource</classname> ! </para> </listitem> <listitem> ! <para> ! <classname>EnvironmentVariableSource</classname> ! </para> </listitem> <listitem> ! <para> ! <classname>CommandLineArgsVariableSource</classname> ! </para> </listitem> <listitem> ! <para> ! <classname>RegistryVariableSource</classname> ! </para> </listitem> <listitem> ! <para> ! <classname>SpecialFolderVariableSource</classname> ! </para> </listitem> <listitem> ! <para> ! <classname>ConnectionStringsVariableSource</classname> ! </para> </listitem> </itemizedlist> ! <para> ! You use this by defining an instance of ! <classname>Spring.Objects.Factory.Config.VariablePlaceholderConfigurer</classname> ! in your configuraiton and set the property ! <literal>VariableSource</literal> to a single ! <classname>IVariableSource</classname> instance or the list property ! <literal>VariableSources</literal> to a list of <classname>IVariableSource</classname> ! instances. In the case of the same property defined in multiple ! <classname>IVariableSource</classname> implementations, the first one ! in the list that contains the property value will be used. ! <programlisting><object type="Spring.Objects.Factory.Config.VariablePlaceholderConfigurer, Spring.Core"> <property name="VariableSources"> <list> --- 3921,3975 ---- <title>IVariableSource</title> ! <para>The IVariableSource is the base interface for providing the ! ability to get the value of property placeholders (name-value) pairs ! from a variety of sources. Out of the box, Spring.NET supports a ! number of variable sources that allow users to obtain variable values ! from .NET config files, java-style property files, environment ! variables, command line arguments and the registry and the new ! connection strings configuraiton section in .NET 2.0. The list of ! implementing classes is listed below. Please refer to the SDK ! documentation for more information.</para> <itemizedlist> <listitem> ! <para><classname>ConfigSectionVariableSource</classname></para> </listitem> <listitem> ! <para><classname>PropertyFileVariableSource</classname></para> </listitem> <listitem> ! <para><classname>EnvironmentVariableSource</classname></para> </listitem> <listitem> ! <para><classname>CommandLineArgsVariableSource</classname></para> </listitem> <listitem> ! <para><classname>RegistryVariableSource</classname></para> </listitem> <listitem> ! <para><classname>SpecialFolderVariableSource</classname></para> </listitem> <listitem> ! <para><classname>ConnectionStringsVariableSource</classname></para> </listitem> </itemizedlist> ! <para>You use this by defining an instance of ! <classname>Spring.Objects.Factory.Config.VariablePlaceholderConfigurer</classname> ! in your configuraiton and set the property ! <literal>VariableSource</literal> to a single ! <classname>IVariableSource</classname> instance or the list property ! <literal>VariableSources</literal> to a list of ! <classname>IVariableSource</classname> instances. In the case of the ! same property defined in multiple ! <classname>IVariableSource</classname> implementations, the first one ! in the list that contains the property value will be used. ! <programlisting><object type="Spring.Objects.Factory.Config.VariablePlaceholderConfigurer, Spring.Core"> <property name="VariableSources"> <list> *************** *** 3988,3993 **** </property> </object> ! </programlisting> ! </para> </sect3> </sect2> --- 3980,3984 ---- </property> </object> ! </programlisting></para> </sect3> </sect2> *************** *** 4045,4050 **** <sect1 id="context-introduction"> ! <title>Introduction to the ! <classname>IApplicationContext</classname></title> <para>While the <literal>Spring.Objects</literal> namespace provides basic --- 4036,4040 ---- <sect1 id="context-introduction"> ! <title>The <classname>IApplicationContext</classname></title> <para>While the <literal>Spring.Objects</literal> namespace provides basic Index: aop.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/aop.xml,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** aop.xml 2 Oct 2007 04:43:12 -0000 1.45 --- aop.xml 27 Nov 2007 21:01:42 -0000 1.46 *************** *** 2091,2097 **** <title>Using AOP Namespace</title> ! <para>The AOP namespace is under development, however as of Spring.NET 1.1 ! M1 you can define a simple advisor, i.e pointcut + 1 piece of advice, in a ! more declarative manner. Under the covers the DefaultAdvisorAutoProxyCreator is being used. Here is an example,</para> --- 2091,2096 ---- <title>Using AOP Namespace</title> ! <para>The AOP namespace allows you to define an advisor, i.e pointcut + 1 ! piece of advice, in a more declarative manner. Under the covers the DefaultAdvisorAutoProxyCreator is being used. Here is an example,</para> |
From: Mark P. <mar...@us...> - 2007-11-27 15:27:09
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv31379 Modified Files: dbproviders.xml Log Message: Change SqlServerCe commandBuilderDeriveParametersMethod metadata to the value 'not supported' Index: dbproviders.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common/dbproviders.xml,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** dbproviders.xml 26 Nov 2007 13:58:44 -0000 1.27 --- dbproviders.xml 27 Nov 2007 15:27:02 -0000 1.28 *************** *** 107,111 **** <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"/> --- 107,111 ---- <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="not supported"/> <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: Bruno B. <bb...@us...> - 2007-11-26 14:17:50
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Xml In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv495 Modified Files: spring-objects-1.1.xsd Log Message: Added element-type attribute to the set element. Index: spring-objects-1.1.xsd =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Xml/spring-objects-1.1.xsd,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** spring-objects-1.1.xsd 8 Aug 2007 07:47:54 -0000 1.2 --- spring-objects-1.1.xsd 26 Nov 2007 14:17:46 -0000 1.3 *************** *** 145,148 **** --- 145,149 ---- <xsd:complexType> <xsd:group ref="objectList" minOccurs="0" maxOccurs="unbounded"/> + <xsd:attribute name="element-type" type="nonNullString" use="optional"/> </xsd:complexType> </xsd:element> |
From: Bruno B. <bb...@us...> - 2007-11-26 14:16:44
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Data/Spring/Objects/Factory/Config In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32567 Added Files: PPCWithTypesTests.xml Log Message: PropertyPlaceholderConfigurer does not replace property values in <list element-type=${prop}> [SPRNET-719] --- NEW FILE: PPCWithTypesTests.xml --- (This appears to be a binary file; contents omitted.) |
From: Bruno B. <bb...@us...> - 2007-11-26 14:16:32
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32538 Modified Files: Spring.Core.Tests.2002.csproj Spring.Core.Tests.2003.csproj Spring.Core.Tests.2005.csproj Log Message: PropertyPlaceholderConfigurer does not replace property values in <list element-type=${prop}> [SPRNET-719] Index: Spring.Core.Tests.2002.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2002.csproj,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Spring.Core.Tests.2002.csproj 14 Sep 2007 15:18:40 -0000 1.8 --- Spring.Core.Tests.2002.csproj 26 Nov 2007 14:16:29 -0000 1.9 *************** *** 660,663 **** --- 660,667 ---- /> <File + RelPath = "Data\Spring\Objects\Factory\Config\PPCWithTypesTests.xml" + BuildAction = "Content" + /> + <File RelPath = "Data\Spring\Objects\Factory\Config\PropertyPlaceholderConfigurerTests.xml" BuildAction = "Content" *************** *** 1175,1178 **** --- 1179,1187 ---- /> <File + RelPath = "Objects\Factory\Config\ObjectDefinitionVisitorTests.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Objects\Factory\Config\ObjectFactoryCreatingFactoryObjectTests.cs" SubType = "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.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** Spring.Core.Tests.2005.csproj 21 Oct 2007 18:16:45 -0000 1.69 --- Spring.Core.Tests.2005.csproj 26 Nov 2007 14:16:29 -0000 1.70 *************** *** 294,297 **** --- 294,298 ---- <Compile Include="Objects\Factory\Config\ConfigSectionVariableSourceTests.cs" /> <Compile Include="Objects\Factory\Config\ConnectionStringsVariableSourceTests.cs" /> + <Compile Include="Objects\Factory\Config\ObjectDefinitionVisitorTests.cs" /> <Compile Include="Objects\Factory\Config\ResourceHandlerConfigurerTests.cs" /> <Compile Include="Objects\Factory\Config\PropertyFileVariableSourceTests.cs" /> *************** *** 734,737 **** --- 735,739 ---- <Content Include="Data\Spring\Objects\Factory\concurrent.xml" /> <Content Include="Data\Spring\Objects\Factory\Config\AnotherDaoConfig.xml" /> + <Content Include="Data\Spring\Objects\Factory\Config\PPCWithTypesTests.xml" /> <Content Include="Data\Spring\Objects\Factory\Config\TypeAliases.xml" /> <Content Include="Data\Spring\Objects\Factory\Config\DaoConfig.xml" /> Index: Spring.Core.Tests.2003.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Spring.Core.Tests.2003.csproj,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Spring.Core.Tests.2003.csproj 14 Sep 2007 15:11:46 -0000 1.38 --- Spring.Core.Tests.2003.csproj 26 Nov 2007 14:16:29 -0000 1.39 *************** *** 686,689 **** --- 686,693 ---- /> <File + RelPath = "Data\Spring\Objects\Factory\Config\PPCWithTypesTests.xml" + BuildAction = "Content" + /> + <File RelPath = "Data\Spring\Objects\Factory\Config\PropertyPlaceholderConfigurerTests.xml" BuildAction = "Content" *************** *** 1231,1234 **** --- 1235,1243 ---- /> <File + RelPath = "Objects\Factory\Config\ObjectDefinitionVisitorTests.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Objects\Factory\Config\ObjectFactoryCreatingFactoryObjectTests.cs" SubType = "Code" |
From: Bruno B. <bb...@us...> - 2007-11-26 14:16:32
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Objects/Factory/Config In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32538/Objects/Factory/Config Modified Files: PropertyPlaceholderConfigurerTests.cs Added Files: ObjectDefinitionVisitorTests.cs Log Message: PropertyPlaceholderConfigurer does not replace property values in <list element-type=${prop}> [SPRNET-719] --- NEW FILE: ObjectDefinitionVisitorTests.cs --- (This appears to be a binary file; contents omitted.) Index: PropertyPlaceholderConfigurerTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Objects/Factory/Config/PropertyPlaceholderConfigurerTests.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PropertyPlaceholderConfigurerTests.cs 21 Aug 2007 19:28:39 -0000 1.10 --- PropertyPlaceholderConfigurerTests.cs 26 Nov 2007 14:16:29 -0000 1.11 *************** *** 557,561 **** TestObject to = (TestObject) xbf.GetObject("Test1"); Assert.AreEqual("A DefName", to.Name); ! } ! } } --- 557,577 ---- TestObject to = (TestObject) xbf.GetObject("Test1"); Assert.AreEqual("A DefName", to.Name); ! } ! ! [Test] ! public void WithTypes() ! { ! IApplicationContext ctx = new XmlApplicationContext( ! "file://Spring/Objects/Factory/Config/PPCWithTypesTests.xml"); ! ! object obj = ctx["testObject"]; ! Assert.IsTrue(obj is TestObject); ! ! TestObject to = (TestObject)obj; ! ! Assert.AreEqual(2, to.Pets.Count); ! Assert.AreEqual(2, to.PeriodicTable.Count); ! Assert.AreEqual(2, to.Computers.Count); ! } ! } } |
From: Bruno B. <bb...@us...> - 2007-11-26 14:16:05
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32125/Config Modified Files: ObjectDefinitionVisitor.cs Log Message: PropertyPlaceholderConfigurer does not replace property values in <list element-type=${prop}> [SPRNET-719] Index: ObjectDefinitionVisitor.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Config/ObjectDefinitionVisitor.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ObjectDefinitionVisitor.cs 28 Aug 2007 14:16:40 -0000 1.7 --- ObjectDefinitionVisitor.cs 26 Nov 2007 14:15:53 -0000 1.8 *************** *** 19,26 **** --- 19,32 ---- #endregion + #region Imports + using System; using System.Collections; + using Spring.Collections; using Spring.Util; + using Spring.Objects.Factory.Support; + + #endregion namespace Spring.Objects.Factory.Config *************** *** 198,212 **** } } ! else if (value is IList) { ! VisitList((IList)value); } ! else if (value is ISet) { ! VisitSet((ISet)value); } ! else if (value is IDictionary) { ! VisitDictionary((IDictionary)value); } else if (value is TypedStringValue) --- 204,218 ---- } } ! else if (value is ManagedList) { ! VisitManagedList((ManagedList)value); } ! else if (value is ManagedSet) { ! VisitManagedSet((ManagedSet)value); } ! else if (value is ManagedDictionary) { ! VisitManagedDictionary((ManagedDictionary)value); } else if (value is TypedStringValue) *************** *** 234,241 **** /// <summary> ! /// Calls <see cref="ResolveValue"/> for list element. /// </summary> ! protected virtual void VisitList(IList listVal) { for (int i = 0; i < listVal.Count; ++i) { --- 240,258 ---- /// <summary> ! /// Visits the ManagedList property ElementTypeName and ! /// calls <see cref="ResolveValue"/> for list element. /// </summary> ! protected virtual void VisitManagedList(ManagedList listVal) { + string elementTypeName = listVal.ElementTypeName; + if (elementTypeName != null) + { + string resolvedName = ResolveStringValue(elementTypeName).ToString(); + if (!elementTypeName.Equals(resolvedName)) + { + listVal.ElementTypeName = resolvedName; + } + } + for (int i = 0; i < listVal.Count; ++i) { *************** *** 250,257 **** /// <summary> ! /// Calls <see cref="ResolveValue"/> for set element. /// </summary> ! protected virtual void VisitSet(ISet setVal) { ISet clone = (ISet)setVal.Clone(); --- 267,284 ---- /// <summary> ! /// Visits the ManagedSet property ElementTypeName and ! /// calls <see cref="ResolveValue"/> for list element. /// </summary> ! protected virtual void VisitManagedSet(ManagedSet setVal) { + string elementTypeName = setVal.ElementTypeName; + if (elementTypeName != null) + { + string resolvedName = ResolveStringValue(elementTypeName).ToString(); + if (!elementTypeName.Equals(resolvedName)) + { + setVal.ElementTypeName = resolvedName; + } + } ISet clone = (ISet)setVal.Clone(); *************** *** 268,275 **** /// <summary> ! /// Calls <see cref="ResolveValue"/> for dictionary's value element. /// </summary> ! protected virtual void VisitDictionary(IDictionary dictVal) { Hashtable mods = new Hashtable(); foreach (DictionaryEntry entry in dictVal) --- 295,323 ---- /// <summary> ! /// Visits the ManagedSet properties KeyTypeName and ValueTypeName and ! /// calls <see cref="ResolveValue"/> for dictionary's value element. /// </summary> ! protected virtual void VisitManagedDictionary(ManagedDictionary dictVal) { + string keyTypeName = dictVal.KeyTypeName; + if (keyTypeName != null) + { + string resolvedName = ResolveStringValue(keyTypeName).ToString(); + if (!keyTypeName.Equals(resolvedName)) + { + dictVal.KeyTypeName = resolvedName; + } + } + + string valueTypeName = dictVal.ValueTypeName; + if (valueTypeName != null) + { + string resolvedName = ResolveStringValue(valueTypeName).ToString(); + if (!valueTypeName.Equals(resolvedName)) + { + dictVal.ValueTypeName = resolvedName; + } + } + Hashtable mods = new Hashtable(); foreach (DictionaryEntry entry in dictVal) |
From: Bruno B. <bb...@us...> - 2007-11-26 14:15:57
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32125/Support Modified Files: ManagedDictionary.cs ManagedList.cs ManagedSet.cs Log Message: PropertyPlaceholderConfigurer does not replace property values in <list element-type=${prop}> [SPRNET-719] Index: ManagedList.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/ManagedList.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ManagedList.cs 17 Aug 2007 02:43:30 -0000 1.14 --- ManagedList.cs 26 Nov 2007 14:15:54 -0000 1.15 *************** *** 30,33 **** --- 30,34 ---- using Spring.Core; using Spring.Core.TypeConversion; + using Spring.Core.TypeResolution; using Spring.Util; *************** *** 45,58 **** public class ManagedList : ArrayList, IManagedCollection { ! private Type elementType; /// <summary> ! /// Gets or sets the type of the elements of this managed list. /// </summary> ! /// <value>The type of the elements of this managed list.</value> ! public Type ElementType { ! get { return this.elementType; } ! set { this.elementType = value; } } --- 46,60 ---- public class ManagedList : ArrayList, IManagedCollection { ! private string elementTypeName; /// <summary> ! /// Gets or sets the unresolved name for the <see cref="System.Type"/> ! /// of the elements of this managed list. /// </summary> ! /// <value>The unresolved name for the type of the elements of this managed list.</value> ! public string ElementTypeName { ! get { return this.elementTypeName; } ! set { this.elementTypeName = value; } } *************** *** 78,83 **** { IList list; #if NET_2_0 ! if (this.elementType == null) { list = new ArrayList(); --- 80,91 ---- { IList list; + + Type elementType = null; + if (StringUtils.HasText(this.elementTypeName)) + { + elementType = TypeResolutionUtils.ResolveType(this.elementTypeName); + } #if NET_2_0 ! if (elementType == null) { list = new ArrayList(); *************** *** 87,91 **** // CLOVER:ON Type type = typeof(List<>); ! Type[] genericArgs = new Type[1] { this.elementType }; type = type.MakeGenericType(genericArgs); --- 95,99 ---- // CLOVER:ON Type type = typeof(List<>); ! Type[] genericArgs = new Type[1] { elementType }; type = type.MakeGenericType(genericArgs); *************** *** 102,114 **** resolver(objectName, definition, String.Format(CultureInfo.InvariantCulture, "{0}[{1}]", propertyName, i), element); ! if (this.elementType != null) { try { ! resolvedElement = TypeConversionUtils.ConvertValueIfNecessary(this.elementType, resolvedElement, propertyName + "[" + i + "]"); } catch (TypeMismatchException) { ! ThrowTypeMismatchException(objectName, propertyName, resolvedElement); } } --- 110,126 ---- resolver(objectName, definition, String.Format(CultureInfo.InvariantCulture, "{0}[{1}]", propertyName, i), element); ! if (elementType != null) { try { ! resolvedElement = TypeConversionUtils.ConvertValueIfNecessary(elementType, resolvedElement, propertyName + "[" + i + "]"); } catch (TypeMismatchException) { ! throw new TypeMismatchException( ! String.Format( ! "Unable to convert managed list element '{0}' from [{1}] into [{2}] during initialization" ! + " of property '{3}' for object '{4}'. Do you have an appropriate type converter registered?", ! resolvedElement, resolvedElement.GetType(), elementType, propertyName, objectName)); } } *************** *** 119,131 **** return list; } - - private void ThrowTypeMismatchException(string objectName, string propertyName, object resolvedElement) - { - throw new TypeMismatchException( - String.Format( - "Unable to convert managed list element '{0}' from [{1}] into [{2}] during initialization" - + " of property '{3}' for object '{4}'. Do you have an appropriate type converter registered?", resolvedElement, - resolvedElement.GetType(), this.elementType, propertyName, objectName)); - } } } \ No newline at end of file --- 131,134 ---- Index: ManagedDictionary.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/ManagedDictionary.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ManagedDictionary.cs 17 Aug 2007 02:43:30 -0000 1.13 --- ManagedDictionary.cs 26 Nov 2007 14:15:54 -0000 1.14 *************** *** 31,34 **** --- 31,35 ---- using Spring.Core; using Spring.Core.TypeConversion; + using Spring.Core.TypeResolution; using Spring.Util; *************** *** 46,70 **** public class ManagedDictionary : Hashtable, IManagedCollection { ! private Type keyType; ! private Type valueType; /// <summary> ! /// Gets or sets the type of the keys of this managed dictionary. /// </summary> ! /// <value>The type of the keys of this managed dictionary.</value> ! public Type KeyType { ! get { return this.keyType; } ! set { this.keyType = value; } } /// <summary> ! /// Gets or sets the type of the values of this managed dictionary. /// </summary> ! /// <value>The type of the values of this managed dictionary.</value> ! public Type ValueType { ! get { return this.valueType; } ! set { this.valueType = value; } } --- 47,73 ---- public class ManagedDictionary : Hashtable, IManagedCollection { ! private string keyTypeName; ! private string valueTypeName; /// <summary> ! /// Gets or sets the unresolved name for the <see cref="System.Type"/> ! /// of the keys of this managed dictionary. /// </summary> ! /// <value>The unresolved name for the type of the keys of this managed dictionary.</value> ! public string KeyTypeName { ! get { return this.keyTypeName; } ! set { this.keyTypeName = value; } } /// <summary> ! /// Gets or sets the unresolved name for the <see cref="System.Type"/> ! /// of the values of this managed dictionary. /// </summary> ! /// <value>The unresolved name for the type of the values of this managed dictionary.</value> ! public string ValueTypeName { ! get { return this.valueTypeName; } ! set { this.valueTypeName = value; } } *************** *** 91,99 **** string propertyName, ManagedCollectionElementResolver resolver) { ! IDictionary map; #if NET_2_0 ! if ((this.keyType == null) && (this.valueType == null)) { ! map = new HybridDictionary(); } else --- 94,114 ---- string propertyName, ManagedCollectionElementResolver resolver) { ! IDictionary dictionary; ! ! Type keyType = null; ! if (StringUtils.HasText(this.keyTypeName)) ! { ! keyType = TypeResolutionUtils.ResolveType(this.keyTypeName); ! } ! ! Type valueType = null; ! if (StringUtils.HasText(this.valueTypeName)) ! { ! valueType = TypeResolutionUtils.ResolveType(this.valueTypeName); ! } #if NET_2_0 ! if ((keyType == null) && (valueType == null)) { ! dictionary = new HybridDictionary(); } else *************** *** 101,112 **** Type type = typeof(Dictionary<,>); Type[] genericArgs = new Type[2] { ! (this.keyType == null) ? typeof(object) : this.keyType, ! (this.valueType == null) ? typeof(object) : this.valueType }; type = type.MakeGenericType(genericArgs); ! map = (IDictionary)ObjectUtils.InstantiateType(type); } #else ! map = new HybridDictionary(); #endif foreach (object key in this.Keys) --- 116,127 ---- Type type = typeof(Dictionary<,>); Type[] genericArgs = new Type[2] { ! (keyType == null) ? typeof(object) : keyType, ! (valueType == null) ? typeof(object) : valueType }; type = type.MakeGenericType(genericArgs); ! dictionary = (IDictionary)ObjectUtils.InstantiateType(type); } #else ! dictionary = new HybridDictionary(); #endif foreach (object key in this.Keys) *************** *** 114,166 **** string elementName = string.Format(CultureInfo.InvariantCulture, "{0}[{1}]", propertyName, key); object resolvedKey = resolver(objectName, definition, elementName, key); ! object resolvedElement = resolver(objectName, definition, elementName, this[key]); ! if (this.keyType != null) { try { ! resolvedKey = TypeConversionUtils.ConvertValueIfNecessary(this.keyType, resolvedKey, propertyName); } catch (TypeMismatchException) { ! ThrowKeyTypeMismatchException(objectName, propertyName, resolvedElement); } } ! if (this.valueType != null) { try { ! resolvedElement = TypeConversionUtils.ConvertValueIfNecessary(this.valueType, resolvedElement, propertyName + "[" + resolvedKey + "]"); } catch (TypeMismatchException) { ! ThrowValueTypeMismatchException(objectName, propertyName, resolvedElement); } } - - map.Add(resolvedKey, resolvedElement); - } - return map; - } ! private void ThrowKeyTypeMismatchException(string objectName, string propertyName, object resolvedKey) ! { ! throw new TypeMismatchException( ! String.Format( ! "Unable to convert managed dictionary key '{0}' from [{1}] into [{2}] during initialization" ! + " of property '{3}' for object '{4}'. Do you have an appropriate type converter registered?", resolvedKey, ! resolvedKey.GetType(), this.keyType, propertyName, objectName)); ! } ! private void ThrowValueTypeMismatchException(string objectName, string propertyName, object resolvedValue) ! { ! throw new TypeMismatchException( ! String.Format( ! "Unable to convert managed dictionary value '{0}' from [{1}] into [{2}] during initialization" ! + " of property '{3}' for object '{4}'. Do you have an appropriate type converter registered?", resolvedValue, ! resolvedValue.GetType(), this.valueType, propertyName, objectName)); ! } ! } } \ No newline at end of file --- 129,171 ---- string elementName = string.Format(CultureInfo.InvariantCulture, "{0}[{1}]", propertyName, key); object resolvedKey = resolver(objectName, definition, elementName, key); ! object resolvedValue = resolver(objectName, definition, elementName, this[key]); ! if (keyType != null) { try { ! resolvedKey = TypeConversionUtils.ConvertValueIfNecessary(keyType, resolvedKey, propertyName); } catch (TypeMismatchException) { ! throw new TypeMismatchException( ! String.Format( ! "Unable to convert managed dictionary key '{0}' from [{1}] into [{2}] during initialization" ! + " of property '{3}' for object '{4}'. Do you have an appropriate type converter registered?", ! resolvedKey, resolvedKey.GetType(), keyType, propertyName, objectName)); } } ! if (valueType != null) { try { ! resolvedValue = TypeConversionUtils.ConvertValueIfNecessary(valueType, resolvedValue, propertyName + "[" + resolvedKey + "]"); } catch (TypeMismatchException) { ! throw new TypeMismatchException( ! String.Format( ! "Unable to convert managed dictionary value '{0}' from [{1}] into [{2}] during initialization" ! + " of property '{3}' for object '{4}'. Do you have an appropriate type converter registered?", ! resolvedValue, resolvedValue.GetType(), valueType, propertyName, objectName)); } } ! dictionary.Add(resolvedKey, resolvedValue); ! } ! return dictionary; ! } } } \ No newline at end of file Index: ManagedSet.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Support/ManagedSet.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ManagedSet.cs 31 Jul 2007 18:16:50 -0000 1.13 --- ManagedSet.cs 26 Nov 2007 14:15:54 -0000 1.14 *************** *** 27,30 **** --- 27,31 ---- using Spring.Core; using Spring.Core.TypeConversion; + using Spring.Core.TypeResolution; using Spring.Util; *************** *** 41,54 **** public class ManagedSet : HybridSet, IManagedCollection { ! private Type elementType; /// <summary> ! /// Gets or sets the type of the elements of this managed set. /// </summary> ! /// <value>The type of the elements of this managed set.</value> ! public Type ElementType { ! get { return this.elementType; } ! set { this.elementType = value; } } --- 42,56 ---- public class ManagedSet : HybridSet, IManagedCollection { ! private string elementTypeName; /// <summary> ! /// Gets or sets the unresolved name for the <see cref="System.Type"/> ! /// of the elements of this managed set. /// </summary> ! /// <value>The unresolved name for the type of the elements of this managed set.</value> ! public string ElementTypeName { ! get { return this.elementTypeName; } ! set { this.elementTypeName = value; } } *************** *** 74,77 **** --- 76,86 ---- { ISet set = new HybridSet(); + + Type elementType = null; + if (StringUtils.HasText(this.elementTypeName)) + { + elementType = TypeResolutionUtils.ResolveType(this.elementTypeName); + } + string elementName = propertyName + "[(set-element)]"; foreach (object element in this) *************** *** 79,91 **** object resolvedElement = resolver(objectName, definition, elementName, element); ! if (this.elementType != null) { try { ! resolvedElement = TypeConversionUtils.ConvertValueIfNecessary(this.elementType, resolvedElement, propertyName); } catch (TypeMismatchException) { ! ThrowTypeMismatchException(objectName, propertyName, resolvedElement); } } --- 88,104 ---- object resolvedElement = resolver(objectName, definition, elementName, element); ! if (elementType != null) { try { ! resolvedElement = TypeConversionUtils.ConvertValueIfNecessary(elementType, resolvedElement, propertyName); } catch (TypeMismatchException) { ! throw new TypeMismatchException( ! String.Format( ! "Unable to convert managed set element '{0}' from [{1}] into [{2}] during initialization" ! + " of property '{3}' for object '{4}'. Do you have an appropriate type converter registered?", ! resolvedElement, resolvedElement.GetType(), elementType, propertyName, objectName)); } } *************** *** 93,106 **** set.Add(resolvedElement); } - return set; - } ! private void ThrowTypeMismatchException(string objectName, string propertyName, object resolvedElement) ! { ! throw new TypeMismatchException( ! String.Format( ! "Unable to convert managed set element '{0}' from [{1}] into [{2}] during initialization" ! + " of property '{3}' for object '{4}'. Do you have an appropriate type converter registered?", resolvedElement, ! resolvedElement.GetType(), this.elementType, propertyName, objectName)); } } --- 106,111 ---- set.Add(resolvedElement); } ! return set; } } |
From: Bruno B. <bb...@us...> - 2007-11-26 14:15:57
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Xml In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv32125/Xml Modified Files: ObjectsNamespaceParser.cs Log Message: PropertyPlaceholderConfigurer does not replace property values in <list element-type=${prop}> [SPRNET-719] Index: ObjectsNamespaceParser.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Objects/Factory/Xml/ObjectsNamespaceParser.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ObjectsNamespaceParser.cs 28 Aug 2007 14:16:40 -0000 1.6 --- ObjectsNamespaceParser.cs 26 Nov 2007 14:15:54 -0000 1.7 *************** *** 882,886 **** else if (element.Name.Equals(ObjectDefinitionConstants.DictionaryElement)) { ! return GetMap(element, name, parserHelper); } else if (element.Name.Equals(ObjectDefinitionConstants.NameValuesElement)) --- 882,886 ---- else if (element.Name.Equals(ObjectDefinitionConstants.DictionaryElement)) { ! return GetDictionary(element, name, parserHelper); } else if (element.Name.Equals(ObjectDefinitionConstants.NameValuesElement)) *************** *** 1021,1028 **** { ManagedList list = new ManagedList(); string elementTypeName = element.GetAttribute("element-type"); if (StringUtils.HasText(elementTypeName)) { ! list.ElementType = TypeResolutionUtils.ResolveType(elementTypeName); } --- 1021,1029 ---- { ManagedList list = new ManagedList(); + string elementTypeName = element.GetAttribute("element-type"); if (StringUtils.HasText(elementTypeName)) { ! list.ElementTypeName = elementTypeName; } *************** *** 1057,1061 **** if (StringUtils.HasText(elementTypeName)) { ! theSet.ElementType = TypeResolutionUtils.ResolveType(elementTypeName); } foreach (XmlNode node in element.ChildNodes) --- 1058,1062 ---- if (StringUtils.HasText(elementTypeName)) { ! theSet.ElementTypeName = elementTypeName; } foreach (XmlNode node in element.ChildNodes) *************** *** 1072,1099 **** /// <summary> ! /// Gets a map definition. /// </summary> /// <param name="element"> ! /// The element describing the map definition. /// </param> /// <param name="name"> ! /// The name of the object (definition) associated with the map definition. /// </param> /// <param name="parserHelper"> /// The namespace-aware parser. /// </param> ! /// <returns>The map definition.</returns> ! protected IDictionary GetMap(XmlElement element, string name, ObjectDefinitionParserHelper parserHelper) { ! ManagedDictionary map = new ManagedDictionary(); string keyTypeName = element.GetAttribute("key-type"); string valueTypeName = element.GetAttribute("value-type"); if (StringUtils.HasText(keyTypeName)) { ! map.KeyType = TypeResolutionUtils.ResolveType(keyTypeName); } if (StringUtils.HasText(valueTypeName)) { ! map.ValueType = TypeResolutionUtils.ResolveType(valueTypeName); } --- 1073,1100 ---- /// <summary> ! /// Gets a dictionary definition. /// </summary> /// <param name="element"> ! /// The element describing the dictionary definition. /// </param> /// <param name="name"> ! /// The name of the object (definition) associated with the dictionary definition. /// </param> /// <param name="parserHelper"> /// The namespace-aware parser. /// </param> ! /// <returns>The dictionary definition.</returns> ! protected IDictionary GetDictionary(XmlElement element, string name, ObjectDefinitionParserHelper parserHelper) { ! ManagedDictionary dictionary = new ManagedDictionary(); string keyTypeName = element.GetAttribute("key-type"); string valueTypeName = element.GetAttribute("value-type"); if (StringUtils.HasText(keyTypeName)) { ! dictionary.KeyTypeName = keyTypeName; } if (StringUtils.HasText(valueTypeName)) { ! dictionary.ValueTypeName = valueTypeName; } *************** *** 1155,1159 **** { // ok, we're using the value attribute shortcut... ! map[key] = inlineValueAtt.Value; } else if (entryEle.Attributes[ObjectDefinitionConstants.DictionaryValueRefShortcutAttribute] != null) --- 1156,1160 ---- { // ok, we're using the value attribute shortcut... ! dictionary[key] = inlineValueAtt.Value; } else if (entryEle.Attributes[ObjectDefinitionConstants.DictionaryValueRefShortcutAttribute] != null) *************** *** 1162,1166 **** XmlAttribute inlineValueRefAtt = entryEle.Attributes[ObjectDefinitionConstants.DictionaryValueRefShortcutAttribute]; RuntimeObjectReference ror = new RuntimeObjectReference(inlineValueRefAtt.Value); ! map[key] = ror; } else if (entryEle.Attributes[ObjectDefinitionConstants.ExpressionAttribute] != null) --- 1163,1167 ---- XmlAttribute inlineValueRefAtt = entryEle.Attributes[ObjectDefinitionConstants.DictionaryValueRefShortcutAttribute]; RuntimeObjectReference ror = new RuntimeObjectReference(inlineValueRefAtt.Value); ! dictionary[key] = ror; } else if (entryEle.Attributes[ObjectDefinitionConstants.ExpressionAttribute] != null) *************** *** 1169,1173 **** XmlAttribute inlineExpressionAtt = entryEle.Attributes[ObjectDefinitionConstants.ExpressionAttribute]; ExpressionHolder expHolder = new ExpressionHolder(inlineExpressionAtt.Value); ! map[key] = expHolder; } else --- 1170,1174 ---- XmlAttribute inlineExpressionAtt = entryEle.Attributes[ObjectDefinitionConstants.ExpressionAttribute]; ExpressionHolder expHolder = new ExpressionHolder(inlineExpressionAtt.Value); ! dictionary[key] = expHolder; } else *************** *** 1188,1197 **** ObjectDefinitionConstants.ValueAttribute, ObjectDefinitionConstants.DictionaryValueRefShortcutAttribute, ObjectDefinitionConstants.EntryElement)); } ! map[key] = ParsePropertySubElement((XmlElement) valueElements.Item(0), name, parserHelper); } #endregion } ! return map; } --- 1189,1198 ---- ObjectDefinitionConstants.ValueAttribute, ObjectDefinitionConstants.DictionaryValueRefShortcutAttribute, ObjectDefinitionConstants.EntryElement)); } ! dictionary[key] = ParsePropertySubElement((XmlElement)valueElements.Item(0), name, parserHelper); } #endregion } ! return dictionary; } |
From: Bruno B. <bb...@us...> - 2007-11-26 13:58:50
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25245 Modified Files: dbproviders.xml Log Message: Fixed build. Index: dbproviders.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common/dbproviders.xml,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** dbproviders.xml 22 Nov 2007 00:14:38 -0000 1.26 --- dbproviders.xml 26 Nov 2007 13:58:44 -0000 1.27 *************** *** 894,898 **** </object> </constructor-arg> - </object> --- 894,897 ---- *************** *** 930,934 **** </object> </constructor-arg> - S </object> --- 929,932 ---- |
From: Mark P. <mar...@us...> - 2007-11-22 00:14:55
|
Update of /cvsroot/springnet/Spring.Net/doc/reference/src In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25823 Modified Files: dbprovider.xml Log Message: SPRNET-768 - Add support for ODBC provider SPRNET-766 - Add support for Sybase provider Index: dbprovider.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/doc/reference/src/dbprovider.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dbprovider.xml 10 Oct 2007 20:59:13 -0000 1.13 --- dbprovider.xml 22 Nov 2007 00:14:06 -0000 1.14 *************** *** 40,44 **** </section> ! <section> <title>IDbProvider and DbProviderFactory</title> --- 40,44 ---- </section> ! <section id="dbprovider-dbprovider"> <title>IDbProvider and DbProviderFactory</title> *************** *** 183,186 **** --- 183,206 ---- 2.0</para> </listitem> + + <listitem> + <para><literal>SybaseAse-12</literal> - Sybase ASE provider for ASE + 12.x</para> + </listitem> + + <listitem> + <para><literal>SybaseAse-15</literal> - Sybase ASE provider for ASE + 15.x</para> + </listitem> + + <listitem> + <para><literal>Odbc-1.1</literal> - ODBC provider V1.0.5000.0 in + framework .NET V1.1</para> + </listitem> + + <listitem> + <para><literal>Odbc-2.0</literal> - ODBC provider V2.0.0.0 in + framework .NET V2</para> + </listitem> </itemizedlist> *************** *** 326,330 **** <section> ! <title>MultiDelegatingDbProvider </title> <para>There are use-cases in which there will need to be a runtime --- 346,350 ---- <section> ! <title>MultiDelegatingDbProvider</title> <para>There are use-cases in which there will need to be a runtime *************** *** 347,352 **** should execute the following code <literal>LogicalThreadContext.SetData("dbProviderName", ! "database1ProviderName")</literal> and then call the data access layer. ! </para> </section> </chapter> \ No newline at end of file --- 367,372 ---- should execute the following code <literal>LogicalThreadContext.SetData("dbProviderName", ! "database1ProviderName")</literal> and then call the data access ! layer.</para> </section> </chapter> \ No newline at end of file |
From: Mark P. <mar...@us...> - 2007-11-22 00:14:41
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv25866 Modified Files: dbproviders.xml Log Message: SPRNET-768 - Add support for ODBC provider SPRNET-766 - Add support for Sybase provider Index: dbproviders.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common/dbproviders.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** dbproviders.xml 21 Nov 2007 18:01:45 -0000 1.25 --- dbproviders.xml 22 Nov 2007 00:14:38 -0000 1.26 *************** *** 8,46 **** <!-- TODO Provide Schema to make it less verbose to configure --> - <object id="SybaseAse1.1" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false"> - <constructor-arg name="dbMetaData"> - <object type="Spring.Data.Common.DbMetadata"> - <constructor-arg name="productName" value="Sybase Adaptive Server Enterprise 12.5, provider V1.1.411 in framework .NET V1.1"/> - <constructor-arg name="assemblyName" value="Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7" /> - <constructor-arg name="connectionType" value="Sybase.Data.AseClient.AseConnection, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> - <constructor-arg name="commandType" value="Sybase.Data.AseClient.AseCommand, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> - <constructor-arg name="parameterType" value="Sybase.Data.AseClient.AseParameter, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> - <constructor-arg name="dataAdapterType" value="Sybase.Data.AseClient.AseDataAdapter, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> - <constructor-arg name="commandBuilderType" value="Sybase.Data.AseClient.AseCommandBuilder, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> - <constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/> - <constructor-arg name="parameterDbType" value="Sybase.Data.AseClient.AseDbType, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> - <constructor-arg name="parameterDbTypeProperty" value="AseDbType"/> - <constructor-arg name="parameterIsNullableProperty" value="IsNullable"/> - <constructor-arg name="parameterNamePrefix" value="@"/> - <constructor-arg name="exceptionType" value="Sybase.Data.AseClient.AseException, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> - <constructor-arg name="useParameterNamePrefixInParameterCollection" value="true"/> - <constructor-arg name="useParameterPrefixInSql" value="true"/> - <constructor-arg name="bindByName" value="true"/> - <constructor-arg name="errorCodeExceptionExpression" value="Errors[0].MessageNumber.ToString()"/> - <!-- TODO select form system db all errors that have 'incorrect syntax' at the start of the error string--> - <property name="ErrorCodes.BadSqlGrammarCodes"> - <value>101,102,103,104,105,106,107,108,109,110,111,112,113,116,120,121,123,207,208,213,257,512</value> - </property> - <property name="ErrorCodes.DataIntegrityViolationCodes"> - <value>423,511,515,530,547,2601,2615,2714</value> - </property> - <property name="ErrorCodes.DeadlockLoserCodes"> - <value>1205</value> - </property> - </object> - </constructor-arg> - - </object> <!-- SQL SERVER --> --- 8,12 ---- *************** *** 893,896 **** --- 859,989 ---- <alias name="SQLite-1.0.44" alias="System.Data.SQLite"/> + <!-- Sybase --> + + <object id="SybaseAse-12" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false"> + <constructor-arg name="dbMetaData"> + <object type="Spring.Data.Common.DbMetadata"> + <constructor-arg name="productName" value="Sybase Adaptive Server Enterprise 12.5, provider V1.1.411 in framework .NET V1.1"/> + <constructor-arg name="assemblyName" value="Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7" /> + <constructor-arg name="connectionType" value="Sybase.Data.AseClient.AseConnection, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="commandType" value="Sybase.Data.AseClient.AseCommand, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="parameterType" value="Sybase.Data.AseClient.AseParameter, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="dataAdapterType" value="Sybase.Data.AseClient.AseDataAdapter, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="commandBuilderType" value="Sybase.Data.AseClient.AseCommandBuilder, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/> + <constructor-arg name="parameterDbType" value="Sybase.Data.AseClient.AseDbType, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="parameterDbTypeProperty" value="AseDbType"/> + <constructor-arg name="parameterIsNullableProperty" value="IsNullable"/> + <constructor-arg name="parameterNamePrefix" value="@"/> + <constructor-arg name="exceptionType" value="Sybase.Data.AseClient.AseException, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="useParameterNamePrefixInParameterCollection" value="true"/> + <constructor-arg name="useParameterPrefixInSql" value="true"/> + <constructor-arg name="bindByName" value="true"/> + <constructor-arg name="errorCodeExceptionExpression" value="Errors[0].MessageNumber.ToString()"/> + + <!-- TODO select form system db all errors that have 'incorrect syntax' at the start of the error string--> + <property name="ErrorCodes.BadSqlGrammarCodes"> + <value>101,102,103,104,105,106,107,108,109,110,111,112,113,116,120,121,123,207,208,213,257,512</value> + </property> + <property name="ErrorCodes.DataIntegrityViolationCodes"> + <value>423,511,515,530,547,2601,2615,2714</value> + </property> + <property name="ErrorCodes.DeadlockLoserCodes"> + <value>1205</value> + </property> + </object> + </constructor-arg> + + </object> + + <object id="SybaseAse-15" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false"> + <constructor-arg name="dbMetaData"> + <object type="Spring.Data.Common.DbMetadata"> + <constructor-arg name="productName" value="Sybase Adaptive Server Enterprise 15.0.2, provider V1.15.152"/> + <constructor-arg name="assemblyName" value="Sybase.Data.AseClient, Version=1.15.152.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7" /> + <constructor-arg name="connectionType" value="Sybase.Data.AseClient.AseConnection, Sybase.Data.AseClient, Version=1.15.152.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="commandType" value="Sybase.Data.AseClient.AseCommand, Sybase.Data.AseClient, Version=1.15.152.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="parameterType" value="Sybase.Data.AseClient.AseParameter, Sybase.Data.AseClient, Version=1.15.152.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="dataAdapterType" value="Sybase.Data.AseClient.AseDataAdapter, Sybase.Data.AseClient, Version=1.15.152.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="commandBuilderType" value="Sybase.Data.AseClient.AseCommandBuilder, Sybase.Data.AseClient, Version=1.15.152.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/> + <constructor-arg name="parameterDbType" value="Sybase.Data.AseClient.AseDbType, Sybase.Data.AseClient, Version=1.15.152.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="parameterDbTypeProperty" value="AseDbType"/> + <constructor-arg name="parameterIsNullableProperty" value="IsNullable"/> + <constructor-arg name="parameterNamePrefix" value="@"/> + <constructor-arg name="exceptionType" value="Sybase.Data.AseClient.AseException, Sybase.Data.AseClient, Version=1.15.152.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="useParameterNamePrefixInParameterCollection" value="true"/> + <constructor-arg name="useParameterPrefixInSql" value="true"/> + <constructor-arg name="bindByName" value="true"/> + <constructor-arg name="errorCodeExceptionExpression" value="Errors[0].MessageNumber.ToString()"/> + + <!-- TODO select form system db all errors that have 'incorrect syntax' at the start of the error string--> + <property name="ErrorCodes.BadSqlGrammarCodes"> + <value>101,102,103,104,105,106,107,108,109,110,111,112,113,116,120,121,123,207,208,213,257,512</value> + </property> + <property name="ErrorCodes.DataIntegrityViolationCodes"> + <value>423,511,515,530,547,2601,2615,2714</value> + </property> + <property name="ErrorCodes.DeadlockLoserCodes"> + <value>1205</value> + </property> + </object> + </constructor-arg> + S + </object> + + <!-- ODBC --> + + <object id="Odbc-1.1" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false"> + <constructor-arg name="dbMetaData"> + <object type="Spring.Data.Common.DbMetadata"> + <constructor-arg name="productName" value="Odbc, provider V1.0.5000.0 in framework .NET V1.1"/> + <constructor-arg name="assemblyName" value="System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <constructor-arg name="connectionType" value="System.Data.Odbc.OdbcConnection, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> + <constructor-arg name="commandType" value="System.Data.Odbc.OdbcCommand, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <constructor-arg name="parameterType" value="System.Data.Odbc.OdbcParameter, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <constructor-arg name="dataAdapterType" value="System.Data.Odbc.OdbcDataAdapter, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <constructor-arg name="commandBuilderType" value="System.Data.Odbc.OdbcCommandBuilder, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/> + <constructor-arg name="parameterDbType" value="System.Data.Odbc.OdbcType, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <constructor-arg name="parameterDbTypeProperty" value="OdbcType"/> + <constructor-arg name="parameterIsNullableProperty" value="IsNullable"/> + <constructor-arg name="parameterNamePrefix" value="?"/> + <constructor-arg name="exceptionType" value="System.Data.Odbc.OdbcException, System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> + <constructor-arg name="useParameterNamePrefixInParameterCollection" value="false"/> + <constructor-arg name="useParameterPrefixInSql" value="false"/> + <constructor-arg name="bindByName" value="false"/> + <constructor-arg name="errorCodeExceptionExpression" value="Errors[0].NativeError.ToString()"/> + </object> + </constructor-arg> + </object> + + <object id="Odbc-2.0" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false"> + <constructor-arg name="dbMetaData"> + <object type="Spring.Data.Common.DbMetadata"> + <constructor-arg name="productName" value="Odbc, provider V2.0.0.0 in framework .NET V2"/> + <constructor-arg name="assemblyName" value="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <constructor-arg name="connectionType" value="System.Data.Odbc.OdbcConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> + <constructor-arg name="commandType" value="System.Data.Odbc.OdbcCommand, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <constructor-arg name="parameterType" value="System.Data.Odbc.OdbcParameter, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <constructor-arg name="dataAdapterType" value="System.Data.Odbc.OdbcDataAdapter, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <constructor-arg name="commandBuilderType" value="System.Data.Odbc.OdbcCommandBuilder, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/> + <constructor-arg name="parameterDbType" value="System.Data.Odbc.OdbcType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <constructor-arg name="parameterDbTypeProperty" value="OdbcType"/> + <constructor-arg name="parameterIsNullableProperty" value="IsNullable"/> + <constructor-arg name="parameterNamePrefix" value="?"/> + <constructor-arg name="exceptionType" value="System.Data.Odbc.OdbcException, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> + <constructor-arg name="useParameterNamePrefixInParameterCollection" value="false"/> + <constructor-arg name="useParameterPrefixInSql" value="false"/> + <constructor-arg name="bindByName" value="false"/> + <constructor-arg name="errorCodeExceptionExpression" value="Errors[0].NativeError.ToString()"/> + </object> + </constructor-arg> + + </object> + + <alias name="Odbc-2.0" alias="System.Data.Odbc"/> + </objects> |
From: Mark P. <mar...@us...> - 2007-11-21 18:01:54
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv6295 Modified Files: DbMetadata.cs IDbMetadata.cs dbproviders.xml Log Message: SPRNET-514 - dbproviders.xml configuration should allow for an optional 'DeriveParameters' method. Clean up code documenation Index: IDbMetadata.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common/IDbMetadata.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IDbMetadata.cs 11 Oct 2007 14:52:13 -0000 1.7 --- IDbMetadata.cs 21 Nov 2007 18:01:45 -0000 1.8 *************** *** 23,27 **** using System; using System.Reflection; - using Spring.Data.Support; #endregion --- 23,26 ---- *************** *** 38,57 **** public interface IDbMetadata { string ProductName { get; } Type ConnectionType { get; } Type CommandType { get; } Type ParameterType { get; } Type DataAdapterType { get; } Type CommandBuilderType { get; } Type ExceptionType { get; } string ErrorCodeExceptionExpression { get; } ! MethodInfo ! CommandBuilderDeriveParametersMethod { get; } /// <summary> /// Provide the prefix used to indentify named parameters in SQL text. /// </summary> string ParameterNamePrefix { get; } --- 37,109 ---- public interface IDbMetadata { + /// <summary> + /// Gets a descriptive name of the product. + /// </summary> + /// <example>Example: Microsoft SQL Server, provider V2.0.0.0 in framework .NET V2.0</example> + /// <value>The name of the product.</value> string ProductName { get; } + + /// <summary> + /// Gets the type of the connection. The fully qualified type name is given since some providers, + /// notably for SqlServerCe, do not use the same namespace for all data access types. + /// </summary> + /// <example>Example: System.Data.SqlClient.SqlCommand, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The type of the connection.</value> Type ConnectionType { get; } + + /// <summary> + /// Gets the type of the command. + /// </summary> + /// <example>Example: System.Data.SqlClient.SqlCommand, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The type of the command.</value> Type CommandType { get; } + + /// <summary> + /// Gets the type of the parameter. + /// </summary> + /// <example>Example: System.Data.SqlClient.SqlParameter, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The type of the parameter.</value> Type ParameterType { get; } + + /// <summary> + /// Gets the type of the data adapter. + /// </summary> + /// <example>Example: System.Data.SqlClient.SqlDataAdapter, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The type of the data adapter.</value> Type DataAdapterType { get; } + + /// <summary> + /// Gets the type of the command builder. + /// </summary> + /// <example>Example: System.Data.SqlClient.SqlCommandBuilder, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The type of the command builder.</value> Type CommandBuilderType { get; } + + /// <summary> + /// Gets the type of the exception. + /// </summary> + /// <example>Example: System.Data.SqlClient.SqlException, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The type of the exception.</value> Type ExceptionType { get; } + /// <summary> + /// Gets the error code exception expression. + /// </summary> + /// <example>Example Errors[0].Number.ToString() for Sql Server </example> + /// <value>The error code exception expression.</value> string ErrorCodeExceptionExpression { get; } ! /// <summary> ! /// Gets the command builder derive parameters method. ! /// </summary> ! /// <remarks>If the value 'not supported' is specified then this method will throw an ArgumentException</remarks> ! /// <example>Example: DeriveParameters</example> ! /// <value>The command builder derive parameters method.</value> ! MethodInfo CommandBuilderDeriveParametersMethod { get; } /// <summary> /// Provide the prefix used to indentify named parameters in SQL text. /// </summary> + /// <example>@ for Sql Server</example> string ParameterNamePrefix { get; } *************** *** 87,99 **** bool BindByName { get; //TODO will go away when make all of this fully configuration driven. ! set; } Type ParameterDbType { get; } PropertyInfo ParameterDbTypeProperty { get; } PropertyInfo ParameterIsNullableProperty { get; } ! ErrorCodes ErrorCodes { get; } } --- 139,171 ---- bool BindByName { get; //TODO will go away when make all of this fully configuration driven. ! set; ! } + /// <summary> + /// Gets the type of the parameter db. + /// </summary> + /// <example>Example: System.Data.SqlDbType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The type of the parameter db.</value> Type ParameterDbType { get; } + /// <summary> + /// Gets the parameter db type property. + /// </summary> + /// <example>Example: SqlDbType for SqlServer</example> + /// <value>The parameter db type property.</value> PropertyInfo ParameterDbTypeProperty { get; } + /// <summary> + /// Gets the parameter is nullable property. + /// </summary> + /// <example>Example: IsNullable for Sql Server</example> + /// <value>The parameter is nullable property.</value> PropertyInfo ParameterIsNullableProperty { get; } ! /// <summary> ! /// Gets or sets the error codes. ! /// </summary> ! /// <remarks>The collection of error codes to map error code integer values to Spring's DAO exception hierarchy</remarks> ! /// <value>The error codes.</value> ErrorCodes ErrorCodes { get; } } Index: dbproviders.xml =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common/dbproviders.xml,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** dbproviders.xml 18 Oct 2007 09:52:18 -0000 1.24 --- dbproviders.xml 21 Nov 2007 18:01:45 -0000 1.25 *************** *** 1,3 **** ! <?xml version="1.0" encoding="UTF-8"?> <!-- --- 1,3 ---- ! <?xml version="1.0" encoding="UTF-8"?> <!-- *************** *** 8,11 **** --- 8,46 ---- <!-- TODO Provide Schema to make it less verbose to configure --> + <object id="SybaseAse1.1" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false"> + <constructor-arg name="dbMetaData"> + <object type="Spring.Data.Common.DbMetadata"> + <constructor-arg name="productName" value="Sybase Adaptive Server Enterprise 12.5, provider V1.1.411 in framework .NET V1.1"/> + <constructor-arg name="assemblyName" value="Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7" /> + <constructor-arg name="connectionType" value="Sybase.Data.AseClient.AseConnection, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="commandType" value="Sybase.Data.AseClient.AseCommand, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="parameterType" value="Sybase.Data.AseClient.AseParameter, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="dataAdapterType" value="Sybase.Data.AseClient.AseDataAdapter, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="commandBuilderType" value="Sybase.Data.AseClient.AseCommandBuilder, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/> + <constructor-arg name="parameterDbType" value="Sybase.Data.AseClient.AseDbType, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="parameterDbTypeProperty" value="AseDbType"/> + <constructor-arg name="parameterIsNullableProperty" value="IsNullable"/> + <constructor-arg name="parameterNamePrefix" value="@"/> + <constructor-arg name="exceptionType" value="Sybase.Data.AseClient.AseException, Sybase.Data.AseClient, Version=1.1.411.0, Culture=neutral, PublicKeyToken=26e0f1529304f4a7"/> + <constructor-arg name="useParameterNamePrefixInParameterCollection" value="true"/> + <constructor-arg name="useParameterPrefixInSql" value="true"/> + <constructor-arg name="bindByName" value="true"/> + <constructor-arg name="errorCodeExceptionExpression" value="Errors[0].MessageNumber.ToString()"/> + + <!-- TODO select form system db all errors that have 'incorrect syntax' at the start of the error string--> + <property name="ErrorCodes.BadSqlGrammarCodes"> + <value>101,102,103,104,105,106,107,108,109,110,111,112,113,116,120,121,123,207,208,213,257,512</value> + </property> + <property name="ErrorCodes.DataIntegrityViolationCodes"> + <value>423,511,515,530,547,2601,2615,2714</value> + </property> + <property name="ErrorCodes.DeadlockLoserCodes"> + <value>1205</value> + </property> + </object> + </constructor-arg> + + </object> <!-- SQL SERVER --> *************** *** 778,782 **** <constructor-arg name="dataAdapterType" value="System.Data.SQLite.SQLiteDataAdapter , System.Data.SQLite, Version=1.0.43.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/> <constructor-arg name="commandBuilderType" value="System.Data.SQLite.SQLiteCommandBuilder, System.Data.SQLite, Version=1.0.43.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/> ! <constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/> <constructor-arg name="parameterDbType" value="System.Data.SQLite.TypeAffinity, System.Data.SQLite, Version=1.0.43.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/> <constructor-arg name="parameterDbTypeProperty" value="DbType"/> --- 813,817 ---- <constructor-arg name="dataAdapterType" value="System.Data.SQLite.SQLiteDataAdapter , System.Data.SQLite, Version=1.0.43.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/> <constructor-arg name="commandBuilderType" value="System.Data.SQLite.SQLiteCommandBuilder, System.Data.SQLite, Version=1.0.43.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/> ! <constructor-arg name="commandBuilderDeriveParametersMethod" value="not supported"/> <constructor-arg name="parameterDbType" value="System.Data.SQLite.TypeAffinity, System.Data.SQLite, Version=1.0.43.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/> <constructor-arg name="parameterDbTypeProperty" value="DbType"/> *************** *** 824,828 **** <constructor-arg name="dataAdapterType" value="System.Data.SQLite.SQLiteDataAdapter , System.Data.SQLite, Version=1.0.44.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/> <constructor-arg name="commandBuilderType" value="System.Data.SQLite.SQLiteCommandBuilder, System.Data.SQLite, Version=1.0.44.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/> ! <constructor-arg name="commandBuilderDeriveParametersMethod" value="DeriveParameters"/> <constructor-arg name="parameterDbType" value="System.Data.SQLite.TypeAffinity, System.Data.SQLite, Version=1.0.44.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/> <constructor-arg name="parameterDbTypeProperty" value="DbType"/> --- 859,863 ---- <constructor-arg name="dataAdapterType" value="System.Data.SQLite.SQLiteDataAdapter , System.Data.SQLite, Version=1.0.44.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/> <constructor-arg name="commandBuilderType" value="System.Data.SQLite.SQLiteCommandBuilder, System.Data.SQLite, Version=1.0.44.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/> ! <constructor-arg name="commandBuilderDeriveParametersMethod" value="not supported"/> <constructor-arg name="parameterDbType" value="System.Data.SQLite.TypeAffinity, System.Data.SQLite, Version=1.0.44.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/> <constructor-arg name="parameterDbTypeProperty" value="DbType"/> Index: DbMetadata.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Data/Common/DbMetadata.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** DbMetadata.cs 11 Oct 2007 14:52:13 -0000 1.12 --- DbMetadata.cs 21 Nov 2007 18:01:45 -0000 1.13 *************** *** 23,27 **** using System; using System.Reflection; - using Spring.Data.Support; using Spring.Util; --- 23,26 ---- *************** *** 38,41 **** --- 37,43 ---- { #region Fields + + private bool supportsDeriveParametersMethod = true; + private string productName; private string assemblyName; *************** *** 70,73 **** --- 72,95 ---- #region Constructor (s) + /// <summary> + /// Initializes a new instance of the <see cref="DbMetadata"/> class. + /// </summary> + /// <param name="productName">Name of the product.</param> + /// <param name="assemblyName">Name of the assembly.</param> + /// <param name="connectionType">Type of the connection.</param> + /// <param name="commandType">Type of the command.</param> + /// <param name="parameterType">Type of the parameter.</param> + /// <param name="dataAdapterType">Type of the data adapter.</param> + /// <param name="commandBuilderType">Type of the command builder.</param> + /// <param name="commandBuilderDeriveParametersMethod">The command builder derive parameters method.</param> + /// <param name="parameterDbType">Type of the parameter db.</param> + /// <param name="parameterDbTypeProperty">The parameter db type property.</param> + /// <param name="parameterIsNullableProperty">The parameter is nullable property.</param> + /// <param name="parameterNamePrefix">The parameter name prefix.</param> + /// <param name="exceptionType">Type of the exception.</param> + /// <param name="useParameterNamePrefixInParameterCollection">if set to <c>true</c> [use parameter name prefix in parameter collection].</param> + /// <param name="useParameterPrefixInSql">if set to <c>true</c> [use parameter prefix in SQL].</param> + /// <param name="bindByName">if set to <c>true</c> [bind by name].</param> + /// <param name="errorCodeExceptionExpression">The error code exception expression.</param> public DbMetadata(string productName, string assemblyName, *************** *** 115,127 **** //TODO consider support for derive parameters via a stored procedure. ! this.commandBuilderDeriveParametersMethod = ! ReflectionUtils.GetMethod(this.commandBuilderType, commandBuilderDeriveParametersMethod, ! new Type[] { this.commandType } ); - AssertUtils.ArgumentNotNull(this.commandBuilderDeriveParametersMethod, "commandBuilderDeriveParametersMethod", GetErrorMessage() + - ", could not resolve commandBuilderDeriveParametersMethod " + - commandBuilderDeriveParametersMethod + - " to MethodInfo. Please check dbproviders.xml entry for correct metadata listing."); - this.commandType = commandType; --- 137,158 ---- //TODO consider support for derive parameters via a stored procedure. ! if (commandBuilderDeriveParametersMethod.ToLower().Trim().Equals("not supported")) ! { ! supportsDeriveParametersMethod = false; ! } ! ! if (supportsDeriveParametersMethod) ! { ! this.commandBuilderDeriveParametersMethod = ! ReflectionUtils.GetMethod(this.commandBuilderType, commandBuilderDeriveParametersMethod, ! new Type[] {this.commandType}); ! ! AssertUtils.ArgumentNotNull(this.commandBuilderDeriveParametersMethod, ! "commandBuilderDeriveParametersMethod", GetErrorMessage() + ! ", could not resolve commandBuilderDeriveParametersMethod " + ! commandBuilderDeriveParametersMethod + ! " to MethodInfo. Please check dbproviders.xml entry for correct metadata listing."); ! } this.commandType = commandType; *************** *** 168,171 **** --- 199,208 ---- #region IDbMetadata Members + /// <summary> + /// Gets a value indicating whether to use param name prefix in parameter collection. + /// </summary> + /// <value> + /// <c>true</c> if should use param name prefix in parameter collection; otherwise, <c>false</c>. + /// </value> public bool UseParamNamePrefixInParameterCollection { *************** *** 173,181 **** } public string AssemblyName { get { return assemblyName; } } ! public string ProductName { --- 210,228 ---- } + /// <summary> + /// Gets the name of the assembly. + /// </summary> + /// <example>Example: System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The name of the assembly.</value> public string AssemblyName { get { return assemblyName; } } ! ! /// <summary> ! /// Gets a descriptive name of the product. ! /// </summary> ! /// <example>Example: Microsoft SQL Server, provider V2.0.0.0 in framework .NET V2.0</example> ! /// <value>The name of the product.</value> public string ProductName { *************** *** 183,186 **** --- 230,239 ---- } + /// <summary> + /// Gets the type of the connection. The fully qualified type name is given since some providers, + /// notably for SqlServerCe, do not use the same namespace for all data access types. + /// </summary> + /// <example>Example: System.Data.SqlClient.SqlCommand, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The type of the connection.</value> public Type ConnectionType { *************** *** 188,191 **** --- 241,249 ---- } + /// <summary> + /// Gets the type of the command. + /// </summary> + /// <example>Example: System.Data.SqlClient.SqlCommand, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The type of the command.</value> public Type CommandType { *************** *** 193,196 **** --- 251,259 ---- } + /// <summary> + /// Gets the type of the parameter. + /// </summary> + /// <example>Example: System.Data.SqlClient.SqlParameter, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The type of the parameter.</value> public Type ParameterType { *************** *** 198,201 **** --- 261,269 ---- } + /// <summary> + /// Gets the type of the data adapter. + /// </summary> + /// <example>Example: System.Data.SqlClient.SqlDataAdapter, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The type of the data adapter.</value> public Type DataAdapterType { *************** *** 203,206 **** --- 271,279 ---- } + /// <summary> + /// Gets the type of the command builder. + /// </summary> + /// <example>Example: System.Data.SqlClient.SqlCommandBuilder, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The type of the command builder.</value> public Type CommandBuilderType { *************** *** 208,216 **** } public MethodInfo CommandBuilderDeriveParametersMethod { ! get { return commandBuilderDeriveParametersMethod; } } public string ParameterNamePrefix { --- 281,308 ---- } + /// <summary> + /// Gets the command builder derive parameters method. + /// </summary> + /// <remarks>If the value 'not supported' is specified then this method will throw an ArgumentException</remarks> + /// <example>Example: DeriveParameters</example> + /// <value>The command builder derive parameters method.</value> public MethodInfo CommandBuilderDeriveParametersMethod { ! get ! { ! if (supportsDeriveParametersMethod) ! { ! return commandBuilderDeriveParametersMethod; ! } else ! { ! throw new ArgumentException("This provider does not support the DeriveParameters functionality"); ! } ! } } + /// <summary> + /// Provide the prefix used to indentify named parameters in SQL text. + /// </summary> + /// <example>@ for Sql Server</example> public string ParameterNamePrefix { *************** *** 218,221 **** --- 310,318 ---- } + /// <summary> + /// Gets the type of the exception. + /// </summary> + /// <example>Example: System.Data.SqlClient.SqlException, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The type of the exception.</value> public Type ExceptionType { *************** *** 223,226 **** --- 320,332 ---- } + /// <summary> + /// Does the driver require the use of the parameter prefix when + /// specifying the name of the parameter in the Command's + /// Parameter collection. + /// </summary> + /// <value></value> + /// <remarks>If true, then commamd.Parameters["@parameterName"] is + /// used, otherwise, command.Parameters["parameterName"]. + /// </remarks> public bool UseParameterNamePrefixInParameterCollection { *************** *** 229,232 **** --- 335,350 ---- + /// <summary> + /// Gets a value indicating whether the Provider requires + /// the use of a named prefix in the SQL string. + /// </summary> + /// <value> + /// <c>true</c> if use parameter prefix in SQL; otherwise, <c>false</c>. + /// </value> + /// <remarks> + /// The OLE DB/ODBC .NET Provider does not support named parameters for + /// passing parameters to an SQL Statement or a stored procedure called + /// by an IDbCommand when CommandType is set to Text. + /// </remarks> public bool UseParameterPrefixInSql { *************** *** 234,237 **** --- 352,360 ---- } + /// <summary> + /// For providers that allow you to choose between binding parameters + /// to a command by name (true) or by position (false). + /// </summary> + /// <value></value> public bool BindByName { *************** *** 240,243 **** --- 363,371 ---- } + /// <summary> + /// Gets the type of the parameter db. + /// </summary> + /// <example>Example: System.Data.SqlDbType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</example> + /// <value>The type of the parameter db.</value> public Type ParameterDbType { *************** *** 245,248 **** --- 373,381 ---- } + /// <summary> + /// Gets the parameter db type property. + /// </summary> + /// <example>Example: SqlDbType for SqlServer</example> + /// <value>The parameter db type property.</value> public PropertyInfo ParameterDbTypeProperty { *************** *** 250,253 **** --- 383,391 ---- } + /// <summary> + /// Gets the parameter is nullable property. + /// </summary> + /// <example>Example: IsNullable for Sql Server</example> + /// <value>The parameter is nullable property.</value> public PropertyInfo ParameterIsNullableProperty { *************** *** 255,258 **** --- 393,401 ---- } + /// <summary> + /// Gets or sets the error codes. + /// </summary> + /// <remarks>The collection of error codes to map error code integer values to Spring's DAO exception hierarchy</remarks> + /// <value>The error codes.</value> public ErrorCodes ErrorCodes { *************** *** 261,264 **** --- 404,412 ---- } + /// <summary> + /// Gets the error code exception expression. + /// </summary> + /// <example>Example Errors[0].Number.ToString() for Sql Server </example> + /// <value>The error code exception expression.</value> public string ErrorCodeExceptionExpression { |
From: Mark P. <mar...@us...> - 2007-11-20 14:39:52
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Data/NHibernate In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv29947/Data/NHibernate Modified Files: HibernateTransactionManager.cs Log Message: add documentation for missing method parameter, make project treat warnings as errors Index: HibernateTransactionManager.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Data/NHibernate/HibernateTransactionManager.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** HibernateTransactionManager.cs 20 Nov 2007 04:03:43 -0000 1.6 --- HibernateTransactionManager.cs 20 Nov 2007 14:39:48 -0000 1.7 *************** *** 687,690 **** --- 687,691 ---- /// <param name="ex">The ADOException that occured, wrapping the underlying /// ADO.NET thrown exception.</param> + /// <param name="translator">The translator to convert hibernate ADOExceptions.</param> /// <returns> /// The corresponding DataAccessException instance *************** *** 692,696 **** 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); } --- 693,696 ---- |
From: Mark P. <mar...@us...> - 2007-11-20 14:39:51
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv29947 Modified Files: Spring.Data.NHibernate.2005.csproj Log Message: add documentation for missing method parameter, make project treat warnings as errors Index: Spring.Data.NHibernate.2005.csproj =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data.NHibernate/Spring.Data.NHibernate.2005.csproj,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Spring.Data.NHibernate.2005.csproj 3 Oct 2007 05:02:49 -0000 1.10 --- Spring.Data.NHibernate.2005.csproj 20 Nov 2007 14:39:48 -0000 1.11 *************** *** 20,23 **** --- 20,24 ---- <WarningLevel>4</WarningLevel> <DocumentationFile>Spring.Data.NHibernate.xml</DocumentationFile> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
From: Mark P. <mar...@us...> - 2007-11-20 04:04:11
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Support In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4561 Modified Files: TestDbProvider.cs Log Message: SPRNET-778 - AdoExceptionTranslator in HibernateTransactionManager did not have a default value Index: TestDbProvider.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.Tests/Support/TestDbProvider.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TestDbProvider.cs 11 Oct 2007 14:55:50 -0000 1.8 --- TestDbProvider.cs 20 Nov 2007 04:04:05 -0000 1.9 *************** *** 34,38 **** /// <author>Mark Pollack (.NET)</author> /// <version>$Id$</version> ! internal class TestDbProvider : IDbProvider { private string connectionString; --- 34,38 ---- /// <author>Mark Pollack (.NET)</author> /// <version>$Id$</version> ! public class TestDbProvider : IDbProvider { private string connectionString; |
From: Mark P. <mar...@us...> - 2007-11-20 04:03:59
|
Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4404/Data/NHibernate Modified Files: HibernateTransactionManagerTests.cs Log Message: SPRNET-778 - AdoExceptionTranslator in HibernateTransactionManager did not have a default value Index: HibernateTransactionManagerTests.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Data.NHibernate.Tests/Data/NHibernate/HibernateTransactionManagerTests.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HibernateTransactionManagerTests.cs 30 Aug 2007 20:00:21 -0000 1.2 --- HibernateTransactionManagerTests.cs 20 Nov 2007 04:03:55 -0000 1.3 *************** *** 28,33 **** --- 28,35 ---- using NUnit.Framework; using Rhino.Mocks; + using Spring.Dao; using Spring.Data.Common; using Spring.Data.Support; + using Spring.Support; using Spring.Transaction; using Spring.Transaction.Support; *************** *** 38,42 **** { /// <summary> ! /// This calss contains tests for /// </summary> /// <author>Mark Pollack</author> --- 40,44 ---- { /// <summary> ! /// This class contains tests for the HibernateTransactionManager /// </summary> /// <author>Mark Pollack</author> *************** *** 494,497 **** --- 496,591 ---- } + + + [Test] + public void TransactionCommitWithFlushFailure() + { + DoTransactionCommitWithFlushFailure(false); + } + + [Test] + public void TransactionCommitWithFlushFailureAndFallbackTranslation() + { + DoTransactionCommitWithFlushFailure(true); + } + + /// <summary> + /// Does the test transaction commit with flush failure. + /// </summary> + /// <param name="fallbackTranslation">if set to <c>true</c> if the exception throw + /// is of the type NHibernate.ADOException, in which case HibernateTransactionManager + /// will 'fallback' to using the error codes in the underlying exception thrown by + /// the provider, ie. a SqlException, MySqlException. Otherwise, if it is + /// another subclass of HibernateException, then perform a direct maping as + /// found in SessionFactoryUtils.ConvertHibernateAccessException.</param> + private void DoTransactionCommitWithFlushFailure(bool fallbackTranslation) + { + #region Mock Setup + + IDbProvider provider = new TestDbProvider(); + IDbConnection connection = (IDbConnection)mocks.CreateMock(typeof(IDbConnection)); + ISessionFactory sessionFactory = (ISessionFactory)mocks.CreateMock(typeof(ISessionFactory)); + ISession session = (ISession)mocks.CreateMock(typeof(ISession)); + ITransaction transaction = (ITransaction)mocks.CreateMock(typeof(ITransaction)); + Exception rootCause = null; + using (mocks.Ordered()) + { + Expect.Call(sessionFactory.OpenSession()).Return(session); + Expect.Call(session.Connection).Return(connection); + Expect.Call(session.BeginTransaction(IsolationLevel.Unspecified)).Return(transaction); + Expect.Call(session.IsOpen).Return(true); + transaction.Commit(); + Exception sqlException = new TestSqlException("mymsg", "2627"); + if (fallbackTranslation) + { + //error code 2627 will map to a DataAccessIntegrity exception in sqlserver, which is the metadata + //used by TestDbProvider. + rootCause = sqlException; + LastCall.On(transaction).Throw(new ADOException("mymsg", sqlException)); + } + else + { + rootCause = new PropertyValueException("mymsg", typeof(string), "Name"); + LastCall.On(transaction).Throw(rootCause); + } + + transaction.Rollback(); + LastCall.On(transaction).Repeat.Once(); + Expect.Call(session.Close()).Return(null); + } + + #endregion + + mocks.ReplayAll(); + + + HibernateTransactionManager tm = new HibernateTransactionManager(sessionFactory); + tm.DbProvider = provider; + + TransactionTemplate tt = new TransactionTemplate(tm); + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(sessionFactory), "Hasn't thread session"); + Assert.IsTrue(!TransactionSynchronizationManager.SynchronizationActive, "Synchronizations not active"); + + IList list = new ArrayList(); + list.Add("test"); + try + { + tt.Execute(new TransactionCommitWithFlushFailureCallback(sessionFactory, list)); + Assert.Fail("Should have thrown DataIntegrityViolationException"); + } + catch (DataIntegrityViolationException ex) + { + Assert.AreEqual(rootCause, ex.InnerException); + Assert.IsTrue(ex.Message.IndexOf("mymsg") != -1); + } + + Assert.IsTrue(!TransactionSynchronizationManager.HasResource(sessionFactory), "Hasn't thread session"); + Assert.IsTrue(!TransactionSynchronizationManager.SynchronizationActive, "Synchronizations not active"); + + mocks.VerifyAll(); + + + } + } *************** *** 930,932 **** --- 1024,1065 ---- #endregion + #region Supporting classes for DoTransactionCommitWithFlushFailure + + public class TransactionCommitWithFlushFailureCallback : ITransactionCallback + { + private ISessionFactory sessionFactory; + private IList list; + + public TransactionCommitWithFlushFailureCallback(ISessionFactory sessionFactory, IList list) + { + this.sessionFactory = sessionFactory; + this.list = list; + } + + public object DoInTransaction(ITransactionStatus status) + { + Assert.IsTrue(TransactionSynchronizationManager.HasResource(sessionFactory), "Has thread session"); + HibernateTemplate ht = new HibernateTemplate(sessionFactory); + return ht.ExecuteFind(new TransactionCommitWithFlushFailureHibernateCallback(list)); + } + + + } + + public class TransactionCommitWithFlushFailureHibernateCallback : IHibernateCallback + { + private IList list; + public TransactionCommitWithFlushFailureHibernateCallback(IList list) + { + this.list = list; + } + + public object DoInHibernate(ISession session) + { + return list; + } + } + + #endregion + } \ No newline at end of file |
From: Mark P. <mar...@us...> - 2007-11-20 04:03:53
|
Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Dao In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv4386 Modified Files: IncorrectResultSizeDataAccessException.cs Log Message: SPRNET-778 - AdoExceptionTranslator in HibernateTransactionManager did not have a default value Index: IncorrectResultSizeDataAccessException.cs =================================================================== RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Data/Dao/IncorrectResultSizeDataAccessException.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IncorrectResultSizeDataAccessException.cs 18 May 2006 21:37:50 -0000 1.5 --- IncorrectResultSizeDataAccessException.cs 20 Nov 2007 04:03:48 -0000 1.6 *************** *** 63,67 **** /// <see cref="Spring.Dao.IncorrectResultSizeDataAccessException"/> class. /// </summary> ! public IncorrectResultSizeDataAccessException() : this( 0, 0 ) {} /// <summary> --- 63,67 ---- /// <see cref="Spring.Dao.IncorrectResultSizeDataAccessException"/> class. /// </summary> ! public IncorrectResultSizeDataAccessException() : this( -1, -1 ) {} /// <summary> *************** *** 72,76 **** /// A message about the exception. /// </param> ! public IncorrectResultSizeDataAccessException( string message ) : this( message, 0, 0 ) { } --- 72,76 ---- /// A message about the exception. /// </param> ! public IncorrectResultSizeDataAccessException( string message ) : this( message, -1, -1 ) { } *************** *** 89,94 **** : base( message, rootCause ) { ! _expectedSize = 0; ! _actualSize = 0; } --- 89,94 ---- : base( message, rootCause ) { ! _expectedSize = -1; ! _actualSize = -1; } *************** *** 120,123 **** --- 120,135 ---- } + /// <summary> + /// Initializes a new instance of the <see cref="IncorrectResultSizeDataAccessException"/> class. + /// </summary> + /// <param name="message">A message about the exception</param> + /// <param name="expectedSize">The expected result size.</param> + public IncorrectResultSizeDataAccessException(string message, int expectedSize) + : base(message) + { + this._expectedSize = expectedSize; + this._actualSize = -1; + } + /// <summary> /// Creates a new instance of the |