public QueryHelp(object queryName, CultureInfo ci, QueryHelpEntity entity) { QueryName = queryName; Culture = ci; Info = HelpGenerator.GetQueryHelp(DynamicQueryManager.Current.GetQuery(queryName).Core.Value); Columns = DynamicQueryManager.Current.GetQuery(queryName).Core.Value.StaticColumns.ToDictionary( cf => cf.Name, cf => new QueryColumnHelp(cf, cf.DisplayName(), HelpGenerator.GetQueryColumnHelp(cf))); if (entity != null) { HasEntity = true; UserDescription = entity.Description; foreach (var tranColumn in entity.Columns) { Columns.GetOrThrow(tranColumn.ColumnName).UserDescription = tranColumn.Description; } } Entity = new Lazy<QueryHelpEntity>(() => HelpLogic.GlobalContext(() => { if (entity == null) entity = new QueryHelpEntity { Culture = this.Culture.ToCultureInfoEntity(), Query = QueryLogic.GetQueryEntity(this.QueryName), }; entity.Columns.AddRange( DynamicQueryManager.Current.GetQuery(this.QueryName).Core.Value.StaticColumns.Select(a => a.Name) .Except(entity.Columns.Select(a => a.ColumnName)) .Select(pr => new QueryColumnHelpEntity { ColumnName = pr, Description = null, })); return entity; })); }
public EntityHelp(Type type, CultureInfo culture, EntityHelpEntity entity) { Type = type; Culture = culture; Info = HelpGenerator.GetEntityHelp(type); Properties = PropertyRoute.GenerateRoutes(type) .ToDictionary( pp => pp, pp => new PropertyHelp(pp, HelpGenerator.GetPropertyHelp(pp))); var allOperations = HelpLogic.CachedOperationsHelp(); Operations = OperationLogic.GetAllOperationInfos(type).Select(oi=>allOperations.GetOrThrow(oi.OperationSymbol)).ToDictionary(a=>a.OperationSymbol); var allQueries = HelpLogic.CachedQueriesHelp(); Queries = HelpLogic.TypeToQuery.Value.TryGetC(this.Type).EmptyIfNull().Select(a=>allQueries.GetOrThrow(a)).ToDictionary(qh => qh.QueryName); if (entity != null) { HasEntity = true; Description = entity.Description; foreach (var tranProp in entity.Properties) { Properties.GetOrThrow(tranProp.Property.ToPropertyRoute()).UserDescription = tranProp.Description; } foreach (var transOper in entity.Operations) { Operations.GetOrThrow(transOper.Operation).UserDescription = transOper.Description; } } Entity = new Lazy<EntityHelpEntity>(() => HelpLogic.GlobalContext(() => { if (entity == null) entity = new EntityHelpEntity { Culture = this.Culture.ToCultureInfoEntity(), Type = this.Type.ToTypeEntity(), }; entity.Properties.AddRange( PropertyRouteLogic.RetrieveOrGenerateProperties(this.Type.ToTypeEntity()) .Except(entity.Properties.Select(a => a.Property)) .Select(pr => new PropertyRouteHelpEntity { Property = pr, Description = null, })); entity.Operations.AddRange(this.Operations.Values.Select(o => o.Entity.Value).ToList()); entity.Queries.AddRange(this.Queries.Values.Select(a => a.Entity.Value).ToList()); return entity; })); }