Ejemplo n.º 1
0
        public NestedResourceConfig <TNestedModel, TModel> CreateNested <TNestedModel>(
            NestedResourceStrategy <TNestedModel, TModel> strategy,
            string name,
            Func <IEngine, TNestedModel> createModel = null)
            where TNestedModel : class, new()
        {
            // update dependencies
            createModel = createModel ?? (_ => new TNestedModel());
            var engine = new DependencyEngine();

            createModel(engine);
            //
            return(new NestedResourceConfig <TNestedModel, TModel>(
                       this,
                       strategy,
                       name,
                       createModel,
                       engine.Dependencies.Values));
        }
        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));
        }