in·dom·i·ta·ble
adj.   Incapable of being overcome, subdued, or vanquished; unconquerable.

29th
SEP

LeanKit Kanban is now in public beta

Posted by indomitablehef | Filed under LeanKit, Lean, Kanban, Asp.Net MVC, S#arp Architecture

There’s still much work to be done, but we’re ready for the masses to come and take a look. Thank You, to all of you who helped us to beta test it during our private beta phase, and those of you at IMIHealth and BBCWorldWide for participating in a full pilot. Your feedback and encouragement have been invaluable.

LeanKit Kanban is a visual process management application, based on Lean principles, and optimized for distributed teams. I invite everyone to sign up for the free 1 board 5 user account at http://LeanKitKanban.com

29th
JAN

Schema Generation using FluentNHibernate and S#arp Architecture

Posted by indomitablehef | Filed under S#arp Architecture, NHibernate

This took me several hours to figure out, and even though it makes me look bad to admit that, I figured I’d share what I eventually came up with.

I’ve been using S#arp Architecture for ASP.Net MVC, which uses FluentNHibernate. The S#arp Architecture project template generates the following test, used to test the FluentNHibernate mappings:

1
2
3
4
5
6
7
8
9
10
11
12
    [TestFixture]
    [Category("DB Tests")]
    public class MappingIntegrationTests
    {
        [SetUp]
        public virtual void SetUp()
        {
            string[] mappingAssemblies = RepositoryTestsHelper.GetMappingAssemblies();
            NHibernateSession.Init(new SimpleSessionStorage(), mappingAssemblies,
                "../../../../app/FuBar1.Web/Hibernate.cfg.xml");
        }
<...>

To do the Schema Export based on the FluentNHibernate mappings, you need to get at the NHibernate Configuration object.
Luckily, the NHibernateSession.Init method returns the Configuration object. So, I modified the Setup for the MappingIntegrationTests class to:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
    [TestFixture]
    [Category("DB Tests")]
    public class MappingIntegrationTests
    {
        private Configuration cfg;
 
        [SetUp]
        public virtual void SetUp()
        {
            string[] mappingAssemblies = RepositoryTestsHelper.GetMappingAssemblies();
            cfg = NHibernateSession.Init(new SimpleSessionStorage(), mappingAssemblies,
                "../../../../app/FuBar1.Web/Hibernate.cfg.xml");
        }
<...>

…capturing the Configuration in a private variable.

I then added this [Test] method to the class, to do the SchemaExport:

1
2
3
4
5
6
7
        [Test]
        public void SchemaGeneration()
        {
            var session = NHibernateSession.SessionFactory.OpenSession();
            new SchemaExport(cfg).Execute(true, false, false, false, session.Connection, null);
            Assert.IsTrue(true);
        }

and viola! I get this in the test output window (ReSharper, NUnit)
testoutput.jpg

Yeah, that’s right. Monkeys.