Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static ISession GetSession()
- {
- ISessionFactory holder = ActiveRecordMediator.GetSessionFactoryHolder();
- ISessionScope activeScope = holder.ThreadScopeInfo.GetRegisteredScope();
- ISession session = null;
- var key = holder.GetSessionFactory(typeof(ActiveRecordBase));
- if (activeScope == null)
- {
- session = holder.CreateSession(typeof(ActiveRecordBase));
- }
- else
- {
- if (activeScope.IsKeyKnown(key))
- session = activeScope.GetSession(key);
- else
- session = holder.GetSessionFactory(typeof(ActiveRecordBase)).OpenSession();
- }
- return session;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement