Exemplo n.º 1
0
 /// <summary>
 /// constructor.
 /// </summary>
 /// <param name="context"></param>
 public OperationDatabaseScope(OperationDatabaseContext context)
 {
     if (OperationDatabaseContext.Current != null && context != null)
     {
         //由于存在事务临时表,确保相同的多次读在同一个库中进行,
         if (OperationDatabaseContext.Current.ReadOnly && context.ReadOnly)
         {
             _RefrenceFromParent = true;
         }
     }
     if (!_RefrenceFromParent)
     {
         this.pushContext(context);
     }
 }
 /// <summary>
 /// databaseContext
 /// </summary>
 /// <param name="databaseContext"></param>
 /// <returns></returns>
 public Database CreateDatabase(OperationDatabaseContext databaseContext)
 {
     return(string.IsNullOrEmpty(databaseContext.DbName) ? DatabaseFactory.CreateDatabase() : DatabaseFactory.CreateDatabase(databaseContext.DbName));
 }
Exemplo n.º 3
0
 private void pushContext(OperationDatabaseContext context)
 {
     this._CurrentContext = context;
     OperationDatabaseScope._CurrentScope = this;
     OperationDatabaseContext.Current     = _CurrentContext;
 }