protected internal void EmbedRelations(FieldsTreeNode embeddedFieldNode, IEmbeddedRelationsSchema schema, ResourceEmbeddedRelationsSchema <TResource, TModel> resourceSchema, UserManager <Model.User> userManager) { foreach (var relationNode in embeddedFieldNode.Nodes) { EmbedRelation(relationNode, schema, resourceSchema, userManager); } }
public PresentationsController( IPresentationRepository repo, UserManager <Model.User> userManager, IEmbeddedRelationsSchema embeddedRelationsSchema) { this.repo = repo; this.userManager = userManager; this.embeddedRelationsSchema = embeddedRelationsSchema; }
public SimulationsController( ISimulationRepository simulationRepo, UserManager <User> userManager, IEmbeddedRelationsSchema embeddedRelationsSchema) { this.simulationRepo = simulationRepo; this.userManager = userManager; this.embeddedRelationsSchema = embeddedRelationsSchema; }
private void EmbedRelation(FieldsTreeNode relationNode, IEmbeddedRelationsSchema schema, ResourceEmbeddedRelationsSchema <TResource, TModel> resourceSchema, UserManager <Model.User> userManager) { var relation = resourceSchema[relationNode.Value]((TResource)this, model, relationNode.Value, userManager); if (relation == null) { return; } EmbedRelationsOfRelation(relation, relationNode, schema, userManager); }
public ServersController( IServerRepository serversRepo, ISimulationRepository simulationsRepo, IPresentationRepository presentationsRepo, UserManager <Model.User> userManager, IEmbeddedRelationsSchema embeddedRelationsSchema) { this.serversRepo = serversRepo; this.simulationsRepo = simulationsRepo; this.presentationsRepo = presentationsRepo; this.userManager = userManager; this.embeddedRelationsSchema = embeddedRelationsSchema; }
internal static T EmbedRelations <T>(this T resource, HttpRequest request, IEmbeddedRelationsSchema embeddedRelationsSchema) where T : IResourceWithRelations { var fields = request.GetFieldsDefinition(); var embeddedField = fields.GetEmbeddedFieldNode(); if (embeddedField == null) { return(resource); } resource.EmbedRelations(embeddedField, embeddedRelationsSchema); return(resource); }
private static void EmbedRelationsOfRelation(object relation, FieldsTreeNode relationNode, IEmbeddedRelationsSchema schema, UserManager <Model.User> userManager) { var embeddedOfRelation = relationNode.Nodes.GetEmbeddedFieldNode(); if (embeddedOfRelation == null) { return; } if (relation is IEnumerable <IResourceWithRelations> relations) { foreach (var item in relations) { item.EmbedRelations(embeddedOfRelation, schema, userManager); } } else { ((IResourceWithRelations)relation).EmbedRelations(embeddedOfRelation, schema, userManager); } }
public abstract void EmbedRelations(FieldsTreeNode embeddedFieldNode, IEmbeddedRelationsSchema schema);
public override void EmbedRelations(FieldsTreeNode embeddedFieldNode, IEmbeddedRelationsSchema schema) => EmbedRelations(embeddedFieldNode, schema, schema.Presentation);
public PresentationsController(IPresentationRepository repo, IEmbeddedRelationsSchema embeddedRelationsSchema) { this.repo = repo; this.embeddedRelationsSchema = embeddedRelationsSchema; }
internal static PresentationCollection EmbedRelations(this PresentationCollection collection, HttpRequest request, IEmbeddedRelationsSchema schema) => EmbedRelations <PresentationCollection, PresentationResource>(collection, request, schema);
internal static ServerCollection EmbedRelations(this ServerCollection collection, HttpRequest request, IEmbeddedRelationsSchema schema) => EmbedRelations <ServerCollection, ServerResource>(collection, request, schema);
internal static SimulationCollection EmbedRelations(this SimulationCollection collection, HttpRequest request, IEmbeddedRelationsSchema schema) => EmbedRelations <SimulationCollection, SimulationResource>(collection, request, schema);
internal static TCollection EmbedRelations <TCollection, TResource>(this TCollection collection, HttpRequest request, IEmbeddedRelationsSchema embeddedRelationsSchema) where TCollection : SimpleListRepresentation <TResource> where TResource : IResourceWithRelations { var fields = request.GetFieldsDefinition(); var collectionNode = fields.FirstOrDefault()?.Nodes.Single(); var embeddedField = collectionNode?.Nodes.GetEmbeddedFieldNode(); if (embeddedField == null) { return(collection); } foreach (var resource in collection.ResourceList) { resource.EmbedRelations(embeddedField, embeddedRelationsSchema); } return(collection); }
public abstract void EmbedRelations(FieldsTreeNode embeddedFieldNode, IEmbeddedRelationsSchema schema, UserManager <Model.User> userManager);
public override void EmbedRelations( FieldsTreeNode embeddedFieldNode, IEmbeddedRelationsSchema schema, UserManager <Model.User> userManager) => EmbedRelations(embeddedFieldNode, schema, schema.Server, userManager);
internal static ServerCollection EmbedRelations(this ServerCollection collection, HttpRequest request, IEmbeddedRelationsSchema schema, UserManager <Model.User> userManager) => EmbedRelations <ServerCollection, ServerResource>(collection, request, schema, userManager);
internal static PresentationCollection EmbedRelations(this PresentationCollection collection, HttpRequest request, IEmbeddedRelationsSchema schema, UserManager <Model.User> userManager) => EmbedRelations <PresentationCollection, PresentationResource>(collection, request, schema, userManager);