public static ResourceConfig <TModel> CreateConfig <TModel>(
     this ResourceStrategy <TModel> strategy,
     string resourceGroupName,
     string name,
     Func <string, TModel> createModel        = null,
     IEnumerable <IEntityConfig> dependencies = null)
     where TModel : class, new()
 => new ResourceConfig <TModel>(
     strategy,
     resourceGroupName,
     name,
     createModel ?? (_ => new TModel()),
     dependencies.EmptyIfNull());
Пример #2
0
 public ResourceConfig(
     ResourceStrategy <TModel> strategy,
     IResourceConfig resourceGroup,
     string name,
     Func <IEngine, TModel> createModel,
     IEnumerable <IEntityConfig> dependencies)
 {
     Strategy      = strategy;
     ResourceGroup = resourceGroup;
     Name          = name;
     CreateModel   = createModel;
     _Dependencies = dependencies;
 }
 public static ResourceConfig <TModel> CreateResourceConfig <TModel>(
     this ResourceStrategy <TModel> strategy,
     IResourceConfig resourceGroup,
     string name,
     Func <IEngine, TModel> createModel,
     IEnumerable <IEntityConfig> dependencies)
     where TModel : class
 => new ResourceConfig <TModel>(
     strategy,
     resourceGroup,
     name,
     createModel,
     new[] { resourceGroup }
     .Concat(dependencies)
     .Where(v => v != null));
        public static ResourceConfig <TModel> CreateResourceConfig <TModel>(
            this ResourceStrategy <TModel> strategy,
            IResourceConfig resourceGroup,
            string name,
            Func <IEngine, TModel> createModel = null)
            where TModel : class, new()
        {
            // update dependencies
            createModel = createModel ?? (_ => new TModel());
            var engine = new DependencyEngine();

            createModel(engine);
            //
            return(strategy.CreateResourceConfig(
                       resourceGroup,
                       name,
                       createModel,
                       engine
                       .Dependencies
                       .Values));
        }