本文整理汇总了C#中Func.NullCheck方法的典型用法代码示例。如果您正苦于以下问题:C# Func.NullCheck方法的具体用法?C# Func.NullCheck怎么用?C# Func.NullCheck使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func.NullCheck方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadAppDomain
/// <summary>
/// 加载某个应用的AppDomain,如果已经加载,则返回已经加载的AppDomain
/// </summary>
/// <param name="appName">应用名称</param>
/// <param name="appDomainBuilder">AppDomain的创建器</param>
/// <returns>应用程序域(AppDomain)</returns>
public static AppDomain LoadAppDomain(string appName, Func<string, AppDomain> appDomainBuilder)
{
appName.CheckStringIsNullOrEmpty("appName");
appDomainBuilder.NullCheck("appDomainBuilder");
lock (_registeredDomains)
{
AppDomain domain = null;
if (_registeredDomains.TryGetValue(appName, out domain) == false)
{
domain = CreateAppDomain(appName, appDomainBuilder);
_registeredDomains.Add(appName, domain);
}
return domain;
}
}
示例2: InternalGenerateDynamicActivities
/// <summary>
/// 创建动态活动
/// </summary>
/// <param name="createActivitiesParamsFetcher"></param>
/// <returns></returns>
private IList<IWfActivityDescriptor> InternalGenerateDynamicActivities(Func<WfCreateActivityParamCollection> createActivitiesParamsFetcher)
{
createActivitiesParamsFetcher.NullCheck("createActivitiesParamsFetcher");
List<IWfActivityDescriptor> result = null;
//随便找一条进线和活动,构造动态活动的起始点。
IWfTransitionDescriptor firstTemplateTransition = this.FromTransitions.FirstOrDefault();
if (firstTemplateTransition != null)
{
//寻找动态活动的前一个点,如果有多个点,随机选取一个
WfActivityDescriptor startActDesp = (WfActivityDescriptor)firstTemplateTransition.FromActivity;
IWfTransitionDescriptor dynInTransition = startActDesp.FindExsitedDynamicToTransition(this);
////没有生成过,或者已经生成过,且生成的活动还没有执行
if (dynInTransition == null || InstanceIsRunning(dynInTransition.ToActivity) == false)
{
//如果已经生成过
if (dynInTransition != null)
DeleteExistedDynamicActivities(dynInTransition, this);
WfCreateActivityParamCollection createActivityParams = createActivitiesParamsFetcher();
//活动矩阵定义的属性优先于活动模板定义的属性,矩阵中没有设置的属性,则使用活动模版的属性
MergeDynamicActivitiesProperties(createActivityParams, this);
WfActivityDescriptorCollection createdActivities = CreateActivities(this.FromTransitions, createActivityParams, this.ToTransitions);
ChangeNewDynActivitiesProperties(createdActivities, this);
result = new List<IWfActivityDescriptor>();
createdActivities.CopyTo(result);
}
}
return result;
}
示例3: ExecuteAndAssertTask
/// <summary>
/// 执行并且验证Task的返回结果
/// </summary>
/// <param name="func"></param>
private static void ExecuteAndAssertTask(Func<DO.SysTask> func)
{
func.NullCheck("func");
DO.SysTask task = func();
DO.SysTask taskLoaded = SysTaskAdapter.Instance.Load(task.TaskID);
ISysTaskExecutor executor = SysTaskSettings.GetSettings().GetExecutor(taskLoaded.TaskType);
executor.Execute(taskLoaded);
SysAccomplishedTask accomplishedTask = SysAccomplishedTaskAdapter.Instance.Load(taskLoaded.TaskID);
Assert.IsNotNull(accomplishedTask);
Console.WriteLine(accomplishedTask.StatusText);
Assert.AreEqual(SysTaskStatus.Completed, accomplishedTask.Status);
}
示例4: ExecuteProcessActionByProcessID
private static WfClientProcessInfo ExecuteProcessActionByProcessID(string processID, WfClientRuntimeContext runtimeContext, Func<IWfProcess, WfExecutorBase> getExecutor)
{
processID.CheckStringIsNullOrEmpty("processID");
getExecutor.NullCheck("getExecutor");
IWfProcess process = GetProcessByProcessID(processID, runtimeContext);
MeregeRuntimeContext(process, runtimeContext);
ExecuteExecutor(process, runtimeContext, getExecutor);
return process.ToClientProcessInfo(runtimeContext.Operator).FillCurrentOpinion(process.CurrentActivity, runtimeContext.Operator);
}