示例#1
0
 IEnumerable <CommandExecDescriptor> Patterns(IEnumerable <Type> types)
 => from t in types
     where Attribute.IsDefined(t, typeof(CommandPatternAttribute)) &&
 t.BaseType.IsGenericType && !t.IsAbstract
 let typeArgs = t.BaseType.GetGenericArguments()
                    where typeArgs.Length >= 2
                let specType = typeArgs[1]
                               select new CommandExecDescriptor
 {
     PatternType = t,
     SpecType    = specType,
     CommandName = CommandSpecDescriptor.FromSpecType(specType).CommandName
 };
示例#2
0
    public static IReadOnlyList <CommandExecDescriptor> DescribeExecutors(this Assembly a)
    {
        var q = from t in a.GetTypes()
                where Attribute.IsDefined(t, typeof(CommandPatternAttribute)) &&
                t.BaseType.IsGenericType && !t.IsAbstract
                let typeArgs = t.BaseType.GetGenericArguments()
                               where typeArgs.Length >= 2
                               let specType = typeArgs[1]
                                              select new CommandExecDescriptor
        {
            PatternType = t,
            SpecType    = specType,
            CommandName = CommandSpecDescriptor.FromSpecType(specType).CommandName
        };

        return(q.ToList());
    }
示例#3
0
 static CommandName GetCommandName <TSpec>()
     where TSpec : CommandSpec <TSpec>, new()
 => CommandSpecDescriptor.FromSpecType <TSpec>().CommandName;
示例#4
0
 static IAppMessage OrchestrationStartError(Type SpecType, Exception e)
 => AppMessage.Error("@CommandName orchestration start error: @ErrorDetail", new
 {
     CommandName = CommandSpecDescriptor.FromSpecType(SpecType).CommandName,
     ErrorDetail = e.ToString()
 });