예제 #1
0
    public TypeHelp(Type type, CultureInfo culture, TypeHelpEntity?entity)
    {
        Type    = type;
        Culture = culture;
        Info    = HelpGenerator.GetEntityHelp(type);

        var props = DBEntity?.Properties.ToDictionaryEx(a => a.Property.ToPropertyRoute(), a => a.Info);
        var opers = DBEntity?.Operations.ToDictionaryEx(a => a.Operation, a => a.Info);

        Properties = PropertyRoute.GenerateRoutes(type)
                     .ToDictionary(pp => pp, pp => new PropertyHelp(pp, props?.TryGetC(pp)));

        Operations = OperationLogic.TypeOperations(type)
                     .ToDictionary(op => op.OperationSymbol, op => new OperationHelp(op.OperationSymbol, type, opers?.TryGetC(op.OperationSymbol)));


        var allQueries = HelpLogic.CachedQueriesHelp();

        Queries = HelpLogic.TypeToQuery.Value.TryGetC(this.Type).EmptyIfNull().Select(a => allQueries.GetOrThrow(a)).ToDictionary(qh => qh.QueryName);

        DBEntity = entity;
    }