本文整理汇总了C#中Func.NotNull方法的典型用法代码示例。如果您正苦于以下问题:C# Func.NotNull方法的具体用法?C# Func.NotNull怎么用?C# Func.NotNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Func
的用法示例。
在下文中一共展示了Func.NotNull方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: JobConfiguration
/// <summary>
/// Constructor
/// </summary>
/// <param name="jobType">The type of the class that implements the job</param>
/// <param name="builder">The trigger builder</param>
public JobConfiguration(
Type jobType,
Func<TriggerBuilder> builder)
{
jobType.Is<IJob>();
builder.NotNull(nameof(builder));
JobType = jobType;
TriggerBuilder = builder;
}
示例2: GetAssemblies
/// <summary>
/// Returns the list of all the assemblies that have been loaded
/// into the execution context of appDomain that fulfill the predicate
/// </summary>
/// <param name="appDomain">The app domain</param>
/// <param name="predicate">Predicate</param>
/// <returns>The list of all assemblyes already loaded into the execution context of app domain that fulfill the predicate</returns>
public static IEnumerable<Assembly> GetAssemblies(
this AppDomain appDomain,
Func<Assembly, bool> predicate)
{
appDomain.NotNull(nameof(appDomain));
predicate.NotNull(nameof(predicate));
return appDomain
.GetAssemblies()
.Where(predicate)
.ToList();
}
示例3: SetDateTimeNowFactory
/// <summary>
/// Sets the DateTime Now factory
/// </summary>
/// <param name="dateTimeNowFactory">The factory</param>
/// <remarks>USE THIS ONLY FOR UNIT TESTING</remarks>
internal void SetDateTimeNowFactory(Func<DateTime> dateTimeNowFactory)
{
dateTimeNowFactory.NotNull(nameof(dateTimeNowFactory));
_dateTimeNowFactory = dateTimeNowFactory;
}
示例4: SetSecurityTokenHandlerFactory
/// <summary>
/// Sets the security token handler factory
/// </summary>
/// <param name="securityTokenHandlerFactory">The factory</param>
/// <remarks>USE THIS ONLY FOR UNIT TESTING</remarks>
internal void SetSecurityTokenHandlerFactory(Func<JwtSecurityTokenHandler> securityTokenHandlerFactory)
{
securityTokenHandlerFactory.NotNull(nameof(securityTokenHandlerFactory));
_securityTokenHandlerFactory = securityTokenHandlerFactory;
}
示例5: SetCorsEngineFactory
/// <summary>
/// Sets the CORS engine factory
/// </summary>
/// <param name="corsEngineFactory">The factory</param>
/// <remarks>USE THIS ONLY FOR UNIT TESTING</remarks>
internal void SetCorsEngineFactory(Func<CorsEngine> corsEngineFactory)
{
corsEngineFactory.NotNull(nameof(corsEngineFactory));
_corsEngineFactory = corsEngineFactory;
}
示例6: SetSubscriberRepositoryFactory
/// <summary>
/// Sets the subscriber repository factory
/// </summary>
/// <remarks>USE THIS ONLY UNIT TESTING</remarks>
/// <param name="subscriberRepositoryFactory">The factory</param>
internal void SetSubscriberRepositoryFactory(
Func<AclConfiguration, HttpRequestMessage, ISubscriberRepository> subscriberRepositoryFactory)
{
subscriberRepositoryFactory.NotNull(nameof(subscriberRepositoryFactory));
_subscriberRepositoryFactory = subscriberRepositoryFactory;
}
示例7: SetResolverFactory
/// <summary>
/// Sets the resolver factory
/// </summary>
/// <remarks>USE THIS ONLY FOR UNIT TESTING</remarks>
/// <param name="resolverFactory">The factory</param>
internal void SetResolverFactory(Func<HttpRequestMessage, Type, object> resolverFactory)
{
resolverFactory.NotNull(nameof(resolverFactory));
_resolverFactory = resolverFactory;
}
示例8: RegisterAclCacheProvider
/// <summary>
/// Register the ACL cache provider
/// (in case it differs from the cache for the rest of the application)
/// </summary>
/// <param name="provider"></param>
public void RegisterAclCacheProvider(Func<ICache> provider)
{
provider.NotNull(nameof(provider));
_config.Properties.GetOrAdd(typeof(ICache), obj => provider);
}
示例9: SetNowFactory
/// <summary>
/// Sets the now factory
/// </summary>
/// <param name="nowFactory">The factory</param>
/// <remarks>USE THIS ONLY FOR UNIT TESTING</remarks>
internal void SetNowFactory(Func<DateTime> nowFactory)
{
nowFactory.NotNull(nameof(nowFactory));
_nowFactory = nowFactory;
}