コード例 #1
0
 /// <summary>
 /// 保存事务总表数据
 /// </summary>
 /// <param name="transactionStatus"></param>
 private void SaveDistributedTransaction(byte transactionStatus)
 {
     using (DistributedMainDbContext db = new DistributedMainDbContext())
     {
         db.Entry(new DistributedTransactionMain
         {
             Id = (long)TransactionIds.Value,
             TransactionStatus = transactionStatus
         }).State = EntityState.Added;
         foreach (var transactionDataSource in TransactionDataSources.Value)
         {
             foreach (string tableName in transactionDataSource.Value)
             {
                 db.Entry(new DistributedTransactionMainDetail
                 {
                     DistributedTransactionMainId = (long)TransactionIds.Value,
                     TransactionDataSource        = transactionDataSource.Key,
                     TransactionTable             = tableName,
                 }).State = EntityState.Added;
             }
         }
         db.SaveChanges();
     }
 }
コード例 #2
0
 static BaseRepository()
 {
     ReadOnlyMainDbContext = new DistributedMainDbContext();
 }