Adding Assemblies - Session Factory

bearrito's Avatar

bearrito

19 Jul, 2010 08:34 PM via web

I am currently doing the following to create my session factories:

 private ISessionFactory CreateSessionFactory(String connectionString)
    {
        return Fluently.Configure()
             .Database(MsSqlConfiguration.MsSql2008
                           .ConnectionString(
                           C => C.Is(connectionString)))
             .Mappings(m => m.FluentMappings.AddFromAssemblyOf<Scenario>())
             .ExposeConfiguration(cfg =>
             {
                 new SchemaExport(cfg)
                 .Create(false, false);
             })
             .BuildSessionFactory();



    }

I would like to do :

 private ISessionFactory CreateSessionFactory(Assembly assemblyWithMappings,String connectionString)
    {
        return Fluently.Configure()
             .Database(MsSqlConfiguration.MsSql2008
                           .ConnectionString(
                           C => C.Is(connectionString)))
             .Mappings(m => m.FluentMappings.AddFromAssembly(assemblyWithMappings))
             .ExposeConfiguration(cfg =>
             {
                 new SchemaExport(cfg)
                 .Create(false, false);
             })
             .BuildSessionFactory();



    }

This returns without error but the SessionFactory is null.

I am doing the the following to get my assembly

analyticsAssembly = typeof(Scenario).Assembly;

Any ideas on what I am doing wrong?

    Reply to this discussion

    Preview Comments are parsed with Markdown. Help with syntax

    Attached Files

      You can attach files up to 10MB

      Five times two is what?