Example #1
0
 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);
     }
 }
Example #2
0
        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);
        }
Example #3
0
        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);
            }
        }
Example #4
0
 public abstract void EmbedRelations(FieldsTreeNode embeddedFieldNode, IEmbeddedRelationsSchema schema,
                                     UserManager <Model.User> userManager);