Пример #1
0
 public Void Visit <TModel>(
     NestedResourceConfig <TModel, TParentModel> config,
     NestedResourceContext <TParentModel> context)
     where TModel : class
 {
     context.SetNestedModel(config);
     return(new Void());
 }
Пример #2
0
            public void SetNestedModel <TModel>(
                NestedResourceConfig <TModel, TParentModel> config)
                where TModel : class
            {
                var model = config.CreateModel(Context.Engine);

                config.Strategy.CreateOrUpdate(ParentModel, config.Name, model);
            }
 public Void Visit <TModel, TParentModel>(
     NestedResourceConfig <TModel, TParentModel> config, Context context)
     where TModel : class
     where TParentModel : class
 {
     context.GetOrAdd(config);
     return(new Void());
 }
            public TModel GetOrAdd <TModel, TParentModel>(
                NestedResourceConfig <TModel, TParentModel> config)
                where TModel : class
                where TParentModel : class
            {
                var parentModel = config.Parent.Accept(new GetOrAddVisitor <TParentModel>(), this);
                var model       = config.Strategy.Get(parentModel, config.Name);

                if (model == null)
                {
                    model = config.CreateModel(Subscription);
                    config.Strategy.CreateOrUpdate(parentModel, config.Name, model);
                }
                return(model);
            }
Пример #5
0
 void IEntityConfig <TModel> .AddNested <TNestedModel>(NestedResourceConfig <TNestedModel, TModel> config)
 => _NestedResources.Add(config);
 public TModel Visit <TParenModel>(
     NestedResourceConfig <TModel, TParenModel> config, Context context)
     where TParenModel : class
 => context.GetOrAdd(config);