Exemplo n.º 1
0
        public static ReadOnlyCollection <PipelineStep> For(PipelineAttribute annotation)
        {
            // temporary variable is introduced in order
            // not to get a crash when the cache is invalidated upon new assembly load
            var cache = _cache;

            if (!cache.ContainsKey(annotation))
            {
                lock (_cacheLock)
                {
                    if (!cache.ContainsKey(annotation))
                    {
                        var t_a_method = annotation.StepMarker;
                        var t_a_type   = annotation.WorkshopMarker;
                        var t_a_asm    = annotation.PlantMarker;

                        // todo. cache this and invalidate cache on appdomain changes
                        _cache.Add(annotation, AppDomain.CurrentDomain.GetAssemblies().SelectMany(asm =>
                        {
                            var a_asm = asm.AttrOrNull(t_a_asm).AssertCast <PipelinePlantAttribute>();
                            if (a_asm == null)
                            {
                                return(Enumerable.Empty <PipelineStep>());
                            }
                            else
                            {
                                return(asm.GetTypes().SelectMany(t =>
                                {
                                    var a_type = t.AttrOrNull(t_a_type).AssertCast <PipelineWorkshopAttribute>();
                                    if (a_type == null)
                                    {
                                        return Enumerable.Empty <PipelineStep>();
                                    }
                                    else
                                    {
                                        return t.GetMethods(BF.All).SelectMany(m =>
                                        {
                                            var a_method = m.AttrOrNull(t_a_method).AssertCast <PipelineStepAttribute>();
                                            if (a_method == null)
                                            {
                                                return Enumerable.Empty <PipelineStep>();
                                            }
                                            else
                                            {
                                                return new PipelineStep(a_asm, a_type, a_method, m).MkArray();
                                            }
                                        });
                                    }
                                }));
                            }
                        }).Order().ToReadOnly());
                    }
                }
            }

            // temporary variable is used in order
            // not to get a crash when the cache is invalidated upon new assembly load
            return(cache[annotation]);
        }
Exemplo n.º 2
0
        public void Register([NotNull] Type type, [NotNull] Type pipelineType, double priority)
        {
            Assert.ArgumentNotNull(type, nameof(type));
            Assert.ArgumentNotNull(pipelineType, nameof(pipelineType));

            var attribute = new PipelineAttribute(pipelineType, priority);

            PipelineManager.LoadType(type, attribute);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Erzeugt ein neues Auswahlelement.
 /// </summary>
 /// <param name="type">Die Implementierung der Aktion.</param>
 /// <param name="attribute">Die kennzeichnende Eigenschaft.</param>
 public ProviderSelector( Type type, PipelineAttribute attribute )
 {
     // Remember
     Attribute = attribute;
     Type = type;
 }
Exemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="CurrentPage"></param>
 /// <param name="BoundDate"></param>
 /// <param name="SortColumn"></param>
 public PipelineListState(int CurrentPage = 1, GridDateFilter BoundDate = GridDateFilter.AllOpen, PipelineAttribute SortColumn = PipelineAttribute.ApplicationDate, String sortDirection = "DESC", String activityTypeFilter = "", String loanPurposeFilter = "", string borrowerStatusFilter = null)
 {
     this.CurrentPage          = CurrentPage;
     this.BoundDate            = BoundDate;
     this.SortColumn           = SortColumn;
     this.SortDirection        = sortDirection;
     this.LoanPurposeFilter    = loanPurposeFilter;
     this.BorrowerStatusFilter = borrowerStatusFilter;
 }
 /// <summary>
 /// Erzeugt ein neues Auswahlelement.
 /// </summary>
 /// <param name="type">Die Implementierung der Aktion.</param>
 /// <param name="attribute">Die kennzeichnende Eigenschaft.</param>
 public ProviderSelector(Type type, PipelineAttribute attribute)
 {
     // Remember
     Attribute = attribute;
     Type      = type;
 }
        public static IPipeline BuildPipeline(PipelineAttribute metadata, String name)
        {
            var steps = Registry.For(metadata);

            return(new Impl.Pipeline(name, metadata, steps));
        }
 public static IPipeline BuildPipeline(PipelineAttribute metadata)
 {
     return(BuildPipeline(metadata, null));
 }
Exemplo n.º 8
0
 public Pipeline(String name, PipelineAttribute metadata, ReadOnlyCollection <PipelineStep> steps)
 {
     Name     = name;
     Metadata = metadata;
     Steps    = steps;
 }