Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static ISessionFactory Configure()
- {
- if (_factory != null)
- return _factory;
- var configuration = new Configuration().Configure();
- // I could set my assembly of mapping here, but it's on our internal framework
- var fluentConfiguration = Fluently.Configure(configuration)
- //.Mappings(c => c.FluentMappings.AddFromAssembly(typeof(ProductMap)))
- .BuildConfiguration();
- _factory = fluentConfiguration.BuildSessionFactory();
- return _factory;
- }
- <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
- <session-factory>
- <!-- other configs here...-->
- <mapping assembly="MyApplication.Data.Mapping" />
- </session-factory>
- </hibernate-configuration>
- private static ISessionFactory Configure()
- {
- if (_factory != null)
- return _factory;
- var configuration = new Configuration().Configure();
- foreach(var alteration in alterations)
- {
- alteration.AddTo(configuration);
- }
- _factory = fluentConfiguration.BuildSessionFactory();
- return _factory;
- }
- // in your alteration
- Configuration AddTo(Configuration config)
- {
- return Fluently.Configure(config)
- .Mappings(c => c.FluentMappings.AddFromAssembly(typeof(ProductMap)))
- .BuildConfiguration();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement