Oh, then you might like this little class ted:
/*
* Created by: Jerome Gagner
* Created: Thursday, December 21, 2006
*/
using System;
using System.Reflection;
using NLog;
using Spring.Context;
using Spring.Transaction;
using Spring.Transaction.Support;
using NUnit.Framework;
//Load log4net stuff
namespace Test.TestFramework
{
public abstract class AbstractTransactionalTestCase
{
private static Logger log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Method for being able to return the application context.
/// </summary>
/// <returns></returns>
public abstract IApplicationContext getApplicationContext();
//Should do what I think it does
[ThreadStatic]
private static ITransactionStatus status = null;
[SetUp]
public void setUp()
{
log.Debug("Setting up.." );
//Set up the test case with spring injected dependencies
Type parent = GetType();
PropertyInfo[] props = parent.GetProperties();
foreach (PropertyInfo prop in props)
{
if (prop.CanWrite)
{
object val = getApplicationContext().GetObject(prop.Name
);
prop.SetValue(this, val, null);
}
}
log.Debug("Starting a transaction...");
//Start a transaction
IPlatformTransactionManager txManager =
(IPlatformTransactionManager)
getApplicationContext().GetObject("transactionManager");
DefaultTransactionDefinition def = new
DefaultTransactionDefinition();
def.PropagationBehavior = TransactionPropagation.RequiresNew;
status = txManager.GetTransaction(def);
}
[TearDown]
public void tearDown()
{
log.Debug("Tearing down");
log.Debug("Rolling back transaction after test execution...");
IPlatformTransactionManager txManager =
(IPlatformTransactionManager)
getApplicationContext().GetObject("transactionManager");
txManager.Rollback(status);
}
}
}
On 1/8/07, Ted Husted <[EMAIL PROTECTED]> wrote:
We use Spring.NET at work, so I would be interesting in what you are
doing.
-Ted.
On 1/8/07, Jerome Gagner <[EMAIL PROTECTED]> wrote:
> I need to clean up the code a bit, it was a quick and dirty
implementation
> but I think the community could benefit a bit from it. I'll try and post
it
> tonight.
>
>
> On 1/8/07, Ron Grabowski <[EMAIL PROTECTED]> wrote:
> > Post the code to a JIRA ticket or on a website somewhere. In case
you're
> curious, here's how IBatisNet integrates with Castle's IoC container:
> >
> >
> >
> >
>
http://svn.castleproject.org:8080/svn/castle/trunk/Facilities/IBatisNet/Castle.Facilities.IBatisNetIntegration/
> >
> >
> >
> > ----- Original Message ----
> >
> > From: Jerome Gagner < [EMAIL PROTECTED]>
> >
> > To: [email protected]
> >
> > Sent: Monday, January 8, 2007 1:46:02 AM
> >
> > Subject: Spring .NET Integration for iBatis .NET
> >
> > Hello All,
> >
> > I recently implemented functionality similar to the Spring/iBatis Java
> integration (SqlMapClient and SqlMapClientTemplate) with Spring .NET and
> iBatis .NET. I have also gotten permission to release this back. I'm
> probably going to submit to Spring .NET but I was interested if anyone
on
> the iBatis side would be willing to review and give pointers before
doing
> so?