本文整理汇总了C#中System.Action.NullCheck方法的典型用法代码示例。如果您正苦于以下问题:C# Action.NullCheck方法的具体用法?C# Action.NullCheck怎么用?C# Action.NullCheck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Action
的用法示例。
在下文中一共展示了Action.NullCheck方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadUserTasksByActivity
public UserTaskCollection LoadUserTasksByActivity(string activityID, Action<InSqlClauseBuilder> action)
{
action.NullCheck("action");
InSqlClauseBuilder builder = new InSqlClauseBuilder();
action(builder);
string sql = string.Format("SELECT * FROM WF.USER_TASK WHERE ACTIVITY_ID = {0}",
TSqlBuilder.Instance.CheckUnicodeQuotationMark(activityID));
if (builder.Count > 0)
sql += " AND " + builder.ToSqlStringWithInOperator(TSqlBuilder.Instance);
UserTaskCollection result = new UserTaskCollection();
DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];
foreach (DataRow row in table.Rows)
{
UserTask task = new UserTask();
ORMapping.DataRowToObject(row, task);
result.Add(task);
}
return result;
}
示例2: Load
/// <summary>
///
/// </summary>
/// <param name="fillAssignees"></param>
/// <param name="action"></param>
/// <returns></returns>
public WfProcessCurrentInfoCollection Load(bool fillAssignees, Action<WhereSqlClauseBuilder> action)
{
action.NullCheck("action");
WfProcessCurrentInfoCollection result = new WfProcessCurrentInfoCollection();
WhereSqlClauseBuilder whereBuilder = new WhereSqlClauseBuilder();
action(whereBuilder);
string fieldNames = ORMapping.GetSelectFieldsNameSql<WfProcessInstanceData>("Data");
string sql = string.Format("SELECT {0} FROM WF.PROCESS_INSTANCES WHERE {1}",
fieldNames,
whereBuilder.ToSqlString(TSqlBuilder.Instance));
DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];
result.LoadFromDataView(table.DefaultView);
if (fillAssignees)
FillAssignees(result);
return result;
}
示例3: ExecutionWrapper
/// <summary>
/// 操作执行的包装类,在操作的开始和结束输出时间信息
/// </summary>
/// <param name="operationName"></param>
/// <param name="action"></param>
private static void ExecutionWrapper(string operationName, Action action)
{
operationName.CheckStringIsNullOrEmpty("operationName");
action.NullCheck("action");
WfExecutorLogContextInfo.Writer.WriteLine("\t\t{0}开始:{1:yyyy-MM-dd HH:mm:ss.fff}",
operationName, DateTime.Now);
Stopwatch sw = new Stopwatch();
sw.Start();
try
{
action();
}
finally
{
sw.Stop();
WfExecutorLogContextInfo.Writer.WriteLine("\t\t{0}结束:{1:yyyy-MM-dd HH:mm:ss.fff};经过时间:{2:#,##0}毫秒",
operationName, DateTime.Now, sw.ElapsedMilliseconds);
}
}
示例4: ExecutionWrapper
/// <summary>
/// 执行操作,通过日志输出操作时间
/// </summary>
/// <param name="operationName"></param>
/// <param name="action"></param>
public void ExecutionWrapper(string operationName, Action action)
{
operationName.CheckStringIsNullOrEmpty("operationName");
action.NullCheck("action");
ProcessProgress.Current.Output.WriteLine("\t\t{0}开始:{1:yyyy-MM-dd HH:mm:ss.fff}",
operationName, DateTime.Now);
Stopwatch sw = new Stopwatch();
sw.Start();
try
{
action();
}
finally
{
sw.Stop();
ProcessProgress.Current.Output.WriteLine("\t\t{0}结束:{1:yyyy-MM-dd HH:mm:ss.fff};经过时间:{2:#,##0}毫秒",
operationName, DateTime.Now, sw.ElapsedMilliseconds);
}
}
示例5: LoadUserTasks
public UserTaskCollection LoadUserTasks(Action<WhereSqlClauseBuilder> action)
{
action.NullCheck("action");
WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();
action(builder);
string sql = string.Format("SELECT * FROM WF.USER_TASK WHERE {0}", builder.ToSqlString(TSqlBuilder.Instance));
UserTaskCollection result = new UserTaskCollection();
DataTable table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];
foreach (DataRow row in table.Rows)
{
UserTask task = new UserTask();
ORMapping.DataRowToObject(row, task);
result.Add(task);
}
return result;
}
示例6: LoadProcesses
private WfProcessCollection LoadProcesses(Action<WhereSqlClauseBuilder> action)
{
action.NullCheck("action");
var whereBuilder = new WhereSqlClauseBuilder();
action(whereBuilder);
var mapping = ORMapping.GetMappingInfo<WfProcessInstanceData>();
string[] fields = ORMapping.GetSelectFieldsName(mapping, "Data");
var sql = string.Format("SELECT {0},{1} FROM {2} WHERE {3}",
string.Join(",", fields),
BINARYDATA,
mapping.TableName,
whereBuilder.ToSqlString(TSqlBuilder.Instance));
var table = DbHelper.RunSqlReturnDS(sql, GetConnectionName()).Tables[0];
WfProcessCollection result = null;
PerformanceMonitorHelper.GetDefaultMonitor().WriteExecutionDuration("DataTableToProcessCollection",
() => result = DataTableToProcessCollection(table)
);
return result;
}
示例7: DeleteProcesses
private void DeleteProcesses(Action<WhereSqlClauseBuilder> action)
{
action.NullCheck("action");
ORMappingItemCollection mapping = ORMapping.GetMappingInfo<WfProcessInstanceData>();
WhereSqlClauseBuilder whereBuilder = new WhereSqlClauseBuilder();
action(whereBuilder);
string sql = string.Format("DELETE {0} WHERE {1}", mapping.TableName, whereBuilder.ToSqlString(TSqlBuilder.Instance));
WfProcessCurrentInfoCollection processesInfo = WfProcessCurrentInfoAdapter.Instance.Load(false, action);
Dictionary<object, object> context = new Dictionary<object, object>();
using (TransactionScope scope = TransactionScopeFactory.Create())
{
DbHelper.RunSql(sql, GetConnectionName());
WfProcessCurrentActivityAdapter.Instance.DeleteProcessActivities(processesInfo);
WfRelativeProcessAdapter.Instance.Delete(processesInfo);
WfExtraPersistenceSettings.GetConfig().GetPersisters().DeleteData(processesInfo, context);
scope.Complete();
}
}
示例8: Delete
/// <summary>
/// 删除EmailMessage
/// </summary>
/// <param name="action"></param>
public void Delete(Action<WhereSqlClauseBuilder> action)
{
action.NullCheck("action");
WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();
action(builder);
builder.AppendTenantCode();
StringBuilder strB = new StringBuilder();
using (StringWriter writer = new StringWriter(strB))
{
WriteDeleteEmailAddressesSql(writer, builder);
WriteDeleteEmailAttachmentsSql(writer, builder);
writer.WriteLine("DELETE MSG.EMAIL_MESSAGES WHERE {0}",
builder.ToSqlString(TSqlBuilder.Instance));
}
DbHelper.RunSqlWithTransaction(strB.ToString(), GetConnectionName());
}
示例9: ExecuteProcessAction
private static WfClientProcessInfo ExecuteProcessAction(string processID, WfClientRuntimeContext runtimeContext, Action<IWfProcess> action)
{
processID.CheckStringIsNullOrEmpty("processID");
action.NullCheck("action");
IWfProcess process = GetProcessByProcessID(processID, runtimeContext);
MeregeRuntimeContext(process, runtimeContext);
DoPrincipalAction(runtimeContext, () => action(process));
return process.ToClientProcessInfo(runtimeContext.Operator);
}