/// <summary> /// Creates new instance. /// </summary> /// <param name="behaviorProvider">Collection of behaviors.</param> /// <param name="compilerConfiguration">Pipeline compiler configuration.</param> public CodeDomPipelineConfiguration(IBehaviorProvider behaviorProvider, ICompilerConfiguration compilerConfiguration) { Ensure.NotNull(behaviorProvider, "behaviorProvider"); Ensure.NotNull(compilerConfiguration, "compilerConfiguration"); BehaviorProvider = behaviorProvider; CompilerConfiguration = compilerConfiguration; }
/// <summary> /// Creates new instance. /// </summary> /// <param name="behaviorProvider">Behavior provider.</param> /// <param name="behaviorFactory">Factory for creating instances of behaviors.</param> public ReflectionPipeline(IBehaviorProvider behaviorProvider, IReflectionBehaviorFactory behaviorFactory) { Ensure.NotNull(behaviorProvider, "behaviorProvider"); Ensure.NotNull(behaviorFactory, "behaviorFactory"); this.behaviorProvider = behaviorProvider; this.behaviorFactory = behaviorFactory; }
public DefaultRequestContext(IBehaviorProvider behaviors, ITwoLevelCache cache, ITextLocalizer localizer, IPermissionService permissions, IUserAccessor userAccessor) { Behaviors = behaviors ?? throw new ArgumentNullException(nameof(behaviors)); Cache = cache ?? throw new ArgumentNullException(nameof(cache)); Localizer = localizer ?? throw new ArgumentNullException(nameof(localizer)); Permissions = permissions ?? throw new ArgumentNullException(nameof(permissions)); this.userAccessor = userAccessor ?? throw new ArgumentNullException(nameof(userAccessor)); }
/// <summary> /// Adds new provider to the start of the collection. /// </summary> /// <param name="provider">New behavior provider.</param> /// <returns>Self (for fluency).</returns> public BehaviorProviderCollection Add(IBehaviorProvider provider) { Ensure.NotNull(provider, "provider"); lock (storageLock) storage.Insert(0, provider); return(this); }
/// <summary> /// Creates new instance for <paramref name="handlerType"/>. /// </summary> /// <param name="handlerType">Target handler type.</param> /// <param name="behaviorProvider">Behavior collection.</param> /// <param name="configuration">Generator configuration.</param> public CodeDomPipelineGenerator(Type handlerType, IBehaviorProvider behaviorProvider, ICompilerConfiguration configuration) { Ensure.NotNull(handlerType, "handlerType"); Ensure.NotNull(behaviorProvider, "behaviorProvider"); Ensure.NotNull(configuration, "configuration"); this.handlerType = handlerType; this.behaviorProvider = behaviorProvider; this.compilerFactory = new CompilerFactory(configuration); this.configuration = configuration; this.nameFormatter = new CodeDomNameFormatter(handlerType); }
public NullRequestContext(IBehaviorProvider behaviors = null, ITwoLevelCache cache = null, ITextLocalizer localizer = null, IPermissionService permissions = null, IUserAccessor userAccessor = null) { Behaviors = behaviors ?? new NullBehaviorProvider(); Cache = cache ?? new NullTwoLevelCache(); Localizer = localizer ?? NullTextLocalizer.Instance; Permissions = permissions ?? new NullPermissions(); UserAccessor = userAccessor ?? new NullUserAccessor(); }
/// <summary> /// Resolves behaviors for handler, row and behavior type /// </summary> /// <typeparam name="TRow">Row type</typeparam> /// <typeparam name="TBehavior">Behavior type</typeparam> /// <param name="provider">Provider</param> /// <param name="handlerType">Handler type</param> /// <returns>Behavior</returns> public static IEnumerable <TBehavior> Resolve <TRow, TBehavior>(this IBehaviorProvider provider, Type handlerType) { return(provider.Resolve(handlerType, typeof(TRow), typeof(TBehavior)).Cast <TBehavior>()); }
/// <summary> /// Creates new instance based on <paramref name="configuration"/>. /// </summary> /// <param name="configuration">Pipeline generator configuration.</param> public CodeDomPipelineFactory(CodeDomPipelineConfiguration configuration) { Ensure.NotNull(configuration, "configuration"); behaviorProvider = configuration.BehaviorProvider; compilerConfiguration = configuration.CompilerConfiguration; }