protected MethodCollection(string[] methodNames, Type projectionType, Type aggregateType) { _validArgumentTypes.Add(typeof(CancellationToken)); MethodNames.AddRange(methodNames); ProjectionType = projectionType; AggregateType = aggregateType; projectionType.GetMethods(flags()) .Where(x => MethodNames.Contains(x.Name)) .Where(x => !x.HasAttribute <MartenIgnoreAttribute>()) .Each(method => addMethodSlot(method, false)); if (aggregateType != null) { aggregateType.GetMethods(flags()) .Where(x => MethodNames.Contains(x.Name)) .Where(x => !x.HasAttribute <MartenIgnoreAttribute>()) .Each(method => addMethodSlot(method, true)); } IsAsync = Methods.Select(x => x.Method).OfType <MethodInfo>().Any(x => x.IsAsync()); LambdaName = methodNames.First(); }
public void Merge(Step step) { if (!step._filteringAttributes.Any()) { _doNotFilterAttributes = true; } _filteringAttributes.AddRange(step._filteringAttributes); if (step._preImageAllAttributes) { _preImageAllAttributes = true; _preImageAttributes.Clear(); } else { _preImageAttributes.AddRange(step._preImageAttributes); } if (step._postImageAllAttributes) { _postImageAllAttributes = true; _postImageAttributes.Clear(); } else { _postImageAttributes.AddRange(step._postImageAttributes); } MethodNames.AddRange(step.MethodNames); }
protected MethodCollection(string[] methodNames, Type projectionType, Type aggregateType) { _validArgumentTypes.Add(typeof(CancellationToken)); MethodNames.AddRange(methodNames); ProjectionType = projectionType; Methods = projectionType.GetMethods(flags()) .Where(x => MethodNames.Contains(x.Name)) .Where(x => !x.HasAttribute <MartenIgnoreAttribute>()) .Select(x => new MethodSlot(x, aggregateType) { HandlerType = projectionType }).ToList(); AggregateType = aggregateType; if (aggregateType != null) { var aggregateSlots = aggregateType.GetMethods(flags()) .Where(x => MethodNames.Contains(x.Name)) .Where(x => !x.HasAttribute <MartenIgnoreAttribute>()) .Select(x => new MethodSlot(x, aggregateType) { HandlerType = aggregateType, DeclaredByAggregate = true }); Methods.AddRange(aggregateSlots); } IsAsync = Methods.Select(x => x.Method).OfType <MethodInfo>().Any(x => x.IsAsync()); LambdaName = methodNames.First(); }