public IUnitOfWork BeginUnitOfWork(SqlConnectionType connectiontype, SqlIsolationLevel isolationLevel, string feature) { SqlConnection sqlConnection = SqlConnectionContext.GetDBConnection();//Unopened var isReadonlyConnection = connectiontype == SqlConnectionType.UseReadOnlyDatabase; var myDbContext = new MyDbContext(sqlConnection, isReadonlyConnection); return(new EntityUnitOfWork(myDbContext)); }
public IUnitOfWork BeginUnitOfWork(SqlConnectionType connectiontype, SqlIsolationLevel isolationLevel, string feature) { var sqlConnectionUnitOfWork = new SqlConnectionFactoryContext().BeginUnitOfWork(connectiontype, isolationLevel, null); var entityUnitOfWork = new EntityUnitOfWorkFactory().BeginUnitOfWork(connectiontype, isolationLevel, null); return(new UnitOfWorkComposite(new List <IUnitOfWork> { sqlConnectionUnitOfWork, entityUnitOfWork })); }
public SqlConnectionContext(SqlConnectionType connectiontype, SqlIsolationLevel sqlIsolationLevel) { lock (LockObject) { if (WebCallContext.GetData(ConnectionKey) == null) { WebCallContext.SetData(ConnectionKey, new SqlConnection(ConnectionString)); WebCallContext.SetData(IsolationLevelKey, sqlIsolationLevel); } else { throw new Exception("There is already a sql connection"); } } }
public IUnitOfWork BeginUnitOfWork(SqlConnectionType connectionType, SqlIsolationLevel isolationLevel, string feature) { return(new SqlConnectionContext(connectionType, isolationLevel)); }
/// <summary> /// Create a new type adapter from currect factory /// </summary> /// <returns>Created type adapter</returns> public static IUnitOfWork CreateAdapter(SqlConnectionType connectiontype, SqlIsolationLevel isolationLevel, string featureName) { return(_currentUnitOfWorkFactory.BeginUnitOfWork(connectiontype, isolationLevel, null)); }