本文整理汇总了C#中IDatabase.BeginTransaction方法的典型用法代码示例。如果您正苦于以下问题:C# IDatabase.BeginTransaction方法的具体用法?C# IDatabase.BeginTransaction怎么用?C# IDatabase.BeginTransaction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDatabase
的用法示例。
在下文中一共展示了IDatabase.BeginTransaction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Transaction
public Transaction(IDatabase db, IsolationLevel isolationLevel)
{
_db = db;
_db.BeginTransaction(isolationLevel);
}
示例2: InsertTaskTree
public static bool InsertTaskTree(PTR3Core core, IDatabase dbPTRConfig, DelGetConfig getXmlDynamicConfig
, int rootTaskRunningId, bool parallel, int taskToInsertId, ref int lastInsertedTaskRunningId
, out string message, MsgStatusEnum logStatus)
{
message = "";
dbPTRConfig.BeginTransaction();
try
{
// wstaw do konfiguracji dynamicznej i dodaj graf procesow do running tasks
DbParameter OUT_INSERTED_TASK_RI_ID = dbPTRConfig.GetIntParamOut("@OUT_INSERTED_TASK_RI_ID");
DbParameter OUT_LAST_INSERTED_TASK_RI_ID = dbPTRConfig.GetIntParamOut("@OUT_LAST_INSERTED_TASK_RI_ID");
int prevTaskId = (parallel ? rootTaskRunningId : lastInsertedTaskRunningId);
PTR3Core.LOG.Log(logStatus, "Dynamic tasks graph inserting (root running task id: {0}, preview running task id: {1}, task to insert id {2}) ..."
, rootTaskRunningId, prevTaskId, taskToInsertId);
dbPTRConfig.ExecuteSp("SP_INSERT_TASK_TREE",
dbPTRConfig.GetIntParamIn("@IN_ROOF_TASK_RI_ID", rootTaskRunningId),
dbPTRConfig.GetIntParamIn("@IN_PREV_TASK_RI_ID", prevTaskId),
dbPTRConfig.GetIntParamIn("@IN_TASK_ID", taskToInsertId),
OUT_INSERTED_TASK_RI_ID,
OUT_LAST_INSERTED_TASK_RI_ID);
int firstInsertedTaskRunningId = (int)OUT_INSERTED_TASK_RI_ID.Value;
lastInsertedTaskRunningId = (int)OUT_LAST_INSERTED_TASK_RI_ID.Value;
core.UpdateTaskDynamicConfiguration(dbPTRConfig, getXmlDynamicConfig(firstInsertedTaskRunningId));
dbPTRConfig.CommitTransaction();
return true;
}
catch(Exception ex)
{
dbPTRConfig.RollbackTransaction();
message = "Error while dynamic task graph inserting: " + ex.Message + "\r\n" + ex.StackTrace + ".";
return false;
}
}