/// <summary> /// Initializes a new instance of the <see cref="ModelOptions" /> class. /// </summary> /// <param name="variables">The shared variables dictionary.</param> /// <param name="prefix">The variable key prefix.</param> public ModelOptions(VariableDictionary variables, string prefix) : base(variables, AppendPrefix(prefix, "Model")) { Shared = new SharedModelOptions(Variables, Prefix); Read = new ReadModelOptions(Variables, Prefix); Create = new CreateModelOptions(Variables, Prefix); Update = new UpdateModelOptions(Variables, Prefix); Mapper = new MapperClassOptions(Variables, Prefix); Validator = new ValidatorClassOptions(Variables, Prefix); }
private static bool IsIgnored <TOption>(Entity entity, TOption options, SharedModelOptions sharedOptions) where TOption : ModelOptionsBase { var name = entity.EntityClass; var includeExpressions = new HashSet <MatchOptions>(sharedOptions?.Include?.Entities ?? Enumerable.Empty <MatchOptions>()); var excludeExpressions = new HashSet <MatchOptions>(sharedOptions?.Exclude?.Entities ?? Enumerable.Empty <MatchOptions>()); var includeEntities = options?.Include?.Entities ?? Enumerable.Empty <MatchOptions>(); foreach (var expression in includeEntities) { includeExpressions.Add(expression); } var excludeEntities = options?.Exclude?.Entities ?? Enumerable.Empty <MatchOptions>(); foreach (var expression in excludeEntities) { excludeExpressions.Add(expression); } return(IsIgnored(name, excludeExpressions, includeExpressions)); }
private static bool IsIgnored <TOption>(Property property, TOption options, SharedModelOptions sharedOptions) where TOption : BaseModelOptions { var name = $"{property.Entity.EntityClass}.{property.PropertyName}"; var includeExpressions = new HashSet <MatchOptions>(sharedOptions?.Include?.Properties ?? Enumerable.Empty <MatchOptions>()); var excludeExpressions = new HashSet <MatchOptions>(sharedOptions?.Exclude?.Properties ?? Enumerable.Empty <MatchOptions>()); var includeProperties = options?.Include?.Properties ?? Enumerable.Empty <MatchOptions>(); foreach (var expression in includeProperties) { includeExpressions.Add(expression); } var excludeProperties = options?.Exclude?.Properties ?? Enumerable.Empty <MatchOptions>(); foreach (var expression in excludeProperties) { excludeExpressions.Add(expression); } return(IsIgnored(name, excludeExpressions, includeExpressions)); }