Can the 'serverName' and 'createSchema' props be set within the
NHibernateInitializer (with defaults) rather than add another overload
on the IntializeNHibernateAndIoC? Then it would look like:

Initialize(PersistenceFramework.NHibernate,mappingInfo)
.Using(DatabaseEngine.MsSqlCe,"dbname",serverName,createSchema) //your
new options here
.ConfiguredBy(myProperties)
.AndIoC("windsor.boo");

My concern is the defaults for the new variables won't be enforced if
they are just inside an overloaded method and all the overloads
already delegate to the NHibernateInitialier builder already.



On Nov 3, 6:45 am, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> Joe,Thanks for the patch.
> Can you also provide a couple of unit tests to go along with it?
>
> On Mon, Oct 27, 2008 at 6:21 PM, Joe <[EMAIL PROTECTED]> wrote:
>
> > I was working with Rhino.Commons this weekend and needed to test a
> > query I was working with. I had two problems.
>
> > 1. My SQLServer was a named instanced server so the server value
> > (local) in the connection string would not work. Its hardcoded in
> > UnitOfWorkTestContextDbStrategy.cs. I needed (local)\SQL2005.
> > 2. I already had the schema and did not want Rhino.Commons to try to
> > recreate it.
>
> > So I wrote a patch to DatabaseTestFixtureBase and
> > UnitOfWorkTestContextDbStrategy that allows me to specify a server
> > name and a bool flag to determine whether or not to create the schema.
>
> > Now, I have never created a patch before, so if I hosed this up, let
> > me know and I will do what I can to fix it.
> > Also, if I am doing something completely wrong, can some one please
> > let me know. This has been a helluva learning experience for me, so I
> > am sure I am missing something. :D
> > I have uploaded the patch and it allows me to create my tests as such:
>
> >    [TestFixture]
> >    public class CustomerServiceFixture : DatabaseTestFixtureBase
> >    {
> >        #region Setup/Teardown
>
> >        [SetUp]
> >        public void TestSetUp()
> >        {
> >            CurrentContext.CreateUnitOfWork();
>
> >            var customer = new CustomerEntity
> >            {
> >                FirstName = "Joe",
> >                LastName = "Young"
> >            };
>
> >            UnitOfWork.CurrentSession.Save(customer);
> >            UnitOfWork.CurrentSession.Flush();
> >        }
>
> >        [TearDown]
> >        public void TestTearDown()
> >        {
> >            Repository<CustomerEntity>.DeleteAll();
> >            CurrentContext.DisposeUnitOfWork();
> >        }
>
> >        #endregion
>
> >        [TestFixtureSetUp]
> >        public void TestFixtureSetup()
> >        {
>
> > IntializeNHibernateAndIoC(PersistenceFramework.ActiveRecord,
> >      //
> > Persistence Framework
>
> > "Windsor.boo",                                        // Configuration
>
> > DatabaseEngine.MsSql2005,                             // Database Type
>
> > "SandBox_Dev",                                        // Database Name
> >                                      @"(local)
> > \SQL2005",                                   // Server Name
>
> > false,                                                // Create Schema
>
> > MappingInfo.FromAssemblyContaining<Entity>(),         // AR Entities
>
> > null);                                                // Additional NH
> > Properties
> >        }
>
> >        [Test]
> >        public void CanFetchCustomer()
> >        {
> >            var criteria = DetachedCriteria.For(typeof
> > (CustomerEntity));
> >            criteria.Add(Restrictions.Eq("LastName", "Young"));
>
> >            var customer =
> > Repository<CustomerEntity>.FindFirst(criteria, new[]
> > {Order.Asc("LastName")});
>
> >            Assert.IsNotNull(customer);
> >        }
> >    }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to