本文整理汇总了C#中ITransaction类的典型用法代码示例。如果您正苦于以下问题:C# ITransaction类的具体用法?C# ITransaction怎么用?C# ITransaction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITransaction类属于命名空间,在下文中一共展示了ITransaction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnNewTransaction
private void OnNewTransaction(ITransaction transaction, TransactionMode transactionMode, IsolationMode isolationMode, bool distributedTransaction)
{
if (!transaction.DistributedTransaction)
{
transaction.Enlist(new RhinoTransactionResourceAdapter(transactionMode));
}
}
示例2: SchemaManager
public SchemaManager(ITransaction transaction)
{
if (transaction == null)
throw new ArgumentNullException("transaction");
Transaction = transaction;
}
示例3: DetachFrom
public void DetachFrom(ITransaction transaction)
{
transaction.UnregisterOnCommit(OnCommit);
if (transaction is ICallbackHandler)
((ICallbackHandler)transaction).OnCallbackDetached(this);
}
示例4: AttachTo
public void AttachTo(ITransaction transaction)
{
transaction.RegisterOnCommit(OnCommit);
if (transaction is ICallbackHandler)
((ICallbackHandler)transaction).OnCallbackAttached(this);
}
示例5: UnitOfWorkSynchronization
/// <summary>
/// ���캯��
/// </summary>
public UnitOfWorkSynchronization(ITransaction transaction, UnitOfWorkDelegate unitOfWorkDelegate)
{
_transaction = transaction;
_unitOfWorkDelegate = unitOfWorkDelegate;
_asyncMessageBus = DependencyResolver.Resolve<IAsyncMessageBus>();
_logger = DependencyResolver.Resolve<ILoggerFactory>().Create("EventSourcing.UnitOfWorkSynchronization");
}
示例6: Insert
public Dictionary<string, object> Insert(string tableName, Dictionary<string, object> row, ITransaction transaction = null)
{
if (!DataStore.ContainsKey(tableName))
DataStore.Add(tableName, new FakeDBTable());
var table = DataStore[tableName];
var dictToUse = row.Copy();
//var id = DataStore[tableName].Count + 1;
var primaryKeys = Analyzer.GetPrimaryKeys(tableName);
var autoKey = Analyzer.GetAutoNumberKey(tableName);
if (autoKey != null)
{
if (!dictToUse.ContainsKey(autoKey))
dictToUse.Add(autoKey, table.NextAutoKey++);
else
dictToUse[autoKey] = table.NextAutoKey++;
}
var invalid = primaryKeys.Where(key => dictToUse[key] == null);
if (invalid.Any())
throw new KeyNotSetException(tableName, invalid);
table.Add(dictToUse);
return dictToUse.WhereKeys(key => primaryKeys.Contains(key));
}
示例7: RawRead
public IEnumerable<Dictionary<string, object>> RawRead(string tableName, Dictionary<string, object> id, ITransaction transaction = null)
{
if (!DataStore.ContainsKey(tableName))
return new List<Dictionary<string, object>>();
return DataStore[tableName].FindByFieldValues(id);
}
示例8: UnitOfWork
public UnitOfWork(IProvider dataProvider)
{
provider = dataProvider as Provider;
if (provider == null)
throw new Exception("Invalid Data Provider");
transaction = provider.Session.BeginTransaction();
}
示例9: SessionInitializeTransaction
protected void SessionInitializeTransaction()
{
if (session == null) {
session = NHibernateHelper.OpenSession ();
tx = session.BeginTransaction ();
}
}
示例10: if
//查找用户的基本套餐
public Int32 getId(Int64 num)
{
trans = session.BeginTransaction();
try
{
IEnumerable<Rule> rule = session.CreateQuery("from Rule as c where c.Mobilenumber='" + num + "'").List<Rule>();
Int32 id = 0;
foreach (Rule r in rule)
{
if (r.Chargeid == 1)
{
id = 1;
break;
}
else if (r.Chargeid == 2)
{
id = 2;
break;
}
else if (r.Chargeid == 3)
{
id = 3;
break;
}
else continue;
}
return id;
}
catch (Exception)
{
throw new Exception();
}
}
示例11: Dispose
public void Dispose()
{
if (disposed)
return;
if (session == null)
return;
try
{
if (preventCommit)
transaction.Rollback();
else
transaction.Commit();
}
catch
{
transaction.Rollback();
throw;
}
finally
{
transaction.Dispose();
}
session.Dispose();
session = null;
transaction = null;
disposed = true;
}
示例12: Setup
public void Setup()
{
session = WindsorPersistenceFixture.Container.Resolve<ISession>();
repository = new SecurityRepository();
repository.Session = session;
tx = session.BeginTransaction();
}
示例13: BeginTransaction
public void BeginTransaction()
{
if (_transaction == null)
{
_transaction = Session.BeginTransaction();
}
}
示例14: Start
public void Start()
{
_session = _sessionSource.CreateSession();
_session.FlushMode = FlushMode.Commit;
_transaction = _session.BeginTransaction();
_isInitialized = true;
}
示例15: UnitOfWork
public UnitOfWork(ISessionFactory sessionFactory)
{
_sessionFactory = sessionFactory;
CurrentSession = _sessionFactory.OpenSession();
//CurrentSession.EnableFilter("translationFilter").SetParameter("locale", Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName);
_transaction = CurrentSession.BeginTransaction();
}