protected internal void EmbedRelations(FieldsTreeNode embeddedFieldNode, IEmbeddedRelationsSchema schema,
                                        ResourseEmbeddedRelationsSchema <TResource, TModel> resourceSchema)
 {
     foreach (var relationNode in embeddedFieldNode.Nodes)
     {
         EmbedRelation(relationNode, schema, resourceSchema);
     }
 }
        private void EmbedRelation(FieldsTreeNode relationNode, IEmbeddedRelationsSchema schema,
                                   ResourseEmbeddedRelationsSchema <TResource, TModel> resourceSchema)
        {
            var relation = resourceSchema[relationNode.Value]((TResource)this, model, relationNode.Value);

            if (relation == null)
            {
                return;
            }

            EmbedRelationsOfRelation(relation, relationNode, schema);
        }
        private static void EmbedRelationsOfRelation(object relation, FieldsTreeNode relationNode, IEmbeddedRelationsSchema schema)
        {
            var embeddedOfRelation = relationNode.Nodes.GetEmbeddedFieldNode();

            if (embeddedOfRelation == null)
            {
                return;
            }

            if (relation is IEnumerable <IResourceWithRelations> relations)
            {
                foreach (var item in relations)
                {
                    item.EmbedRelations(embeddedOfRelation, schema);
                }
            }
            else
            {
                ((IResourceWithRelations)relation).EmbedRelations(embeddedOfRelation, schema);
            }
        }
 public override void EmbedRelations(FieldsTreeNode embeddedFieldNode, IEmbeddedRelationsSchema schema) =>
 EmbedRelations(embeddedFieldNode, schema, schema.Presentation);
Пример #5
0
 public override void EmbedRelations(
     FieldsTreeNode embeddedFieldNode,
     IEmbeddedRelationsSchema schema,
     UserManager <Model.User> userManager) =>
 EmbedRelations(embeddedFieldNode, schema, schema.Server, userManager);
 public abstract void EmbedRelations(FieldsTreeNode embeddedFieldNode, IEmbeddedRelationsSchema schema);