narsil/Tanshu.Accounts.Repository/Ninject/SessionRepository.cs
2011-03-12 17:12:02 +05:30

48 lines
1.8 KiB
C#

//using FluentNHibernate.Automapping;
//using FluentNHibernate.Cfg;
//using FluentNHibernate.Cfg.Db;
//using NHibernate;
//using NHibernate.Cfg;
//using Tanshu.Accounts.Conventions;
//using Tanshu.Accounts.Entities;
//using Tanshu.Accounts.SqlDAO;
//namespace Tanshu.Accounts.Repository
//{
// public class SessionRepository
// {
// public static Configuration GetConfiguration()
// {
// var storeConfiguration = new StoreConfiguration();
// var persistenceModel = AutoMap.AssemblyOf<Voucher>(storeConfiguration)
// .Conventions.Setup(c =>
// {
// c.Add<PrimaryKeyConvention>();
// c.Add<CustomForeignKeyConvention>();
// c.Add<ClassConvention>();
// c.Add<CascadeConvention>();
// c.Add<NotNullConvention>();
// //c.Add(DefaultLazy.Never());
// //c.Add<EnumConvention>();
// });
// return Fluently.Configure()
// .Database(MsSqlConfiguration.MsSql2005.ConnectionString(p => p.FromConnectionStringWithKey("FluentCon")))
// .Mappings(m => m.AutoMappings.Add(persistenceModel))
// .BuildConfiguration()
// .SetInterceptor(new NHSQLInterceptor());
// }
// public static ISessionFactory GetSessionFactory()
// {
// return GetConfiguration().BuildSessionFactory();
// }
// public static ISession GetSession(ISessionFactory factory)
// {
// return factory.OpenSession();
// }
// public static IStatelessSession GetStatelessSession(ISessionFactory factory)
// {
// return factory.OpenStatelessSession();
// }
// }
//}