コード例 #1
0
ファイル: SolutionMeta.cs プロジェクト: hicham73/XrmTools
        public void AddAttribute(CrmComponent component, CrmComponent rootComponent)
        {
            if (rootComponent != null)
            {
                var emdi = EntityMetas.Where(x => x.MetadataId.Contains(rootComponent.ObjectId.ToString())).FirstOrDefault <EntityMetadataInfo>();
                if (emdi != null)
                {
                    var amdi = emdi.EntityMetadata.Attributes.Where(x => x.MetadataId == component.ObjectId).FirstOrDefault <AttributeMetadata>();

                    emdi.Attributes.Add(new AttributeMetadataInfo(amdi));
                }
            }
        }
コード例 #2
0
ファイル: SolutionMeta.cs プロジェクト: hicham73/XrmTools
        internal void AddManyToManyRelationship(CrmComponent component, CrmComponent rootComponent)
        {
            if (rootComponent != null)
            {
                var emdi = EntityMetas.Where(x => x.MetadataId.Contains(rootComponent.ObjectId.ToString())).FirstOrDefault <EntityMetadataInfo>();

                if (emdi != null)
                {
                    var mtmr = emdi.EntityMetadata.ManyToManyRelationships.Where(x => x.MetadataId == component.ObjectId).FirstOrDefault <ManyToManyRelationshipMetadata>();

                    if (mtmr != null)
                    {
                        emdi.ManyToManyRelationships.Add(new ManyToManyRelationshipMetadataInfo(mtmr));
                    }
                }
            }
        }
コード例 #3
0
ファイル: SolutionMeta.cs プロジェクト: hicham73/XrmTools
        internal void AddManyToOneRelationship(CrmComponent component, CrmComponent rootComponent)
        {
            if (rootComponent != null)
            {
                var emdi = EntityMetas.Where(x => x.MetadataId.Contains(rootComponent.ObjectId.ToString())).FirstOrDefault <EntityMetadataInfo>();

                if (emdi != null)
                {
                    var otmr = emdi.EntityMetadata.ManyToOneRelationships.Where(x => x.MetadataId == component.ObjectId).FirstOrDefault <OneToManyRelationshipMetadata>();

                    if (otmr != null)
                    {
                        emdi.ManyToOneRelashionships.Add(new OneToManyRelationshipMetadataInfo(otmr));

                        var primaryEntity = EntityMetas.Where(x => x.LogicalName == otmr.ReferencedEntity).FirstOrDefault <EntityMetadataInfo>();

                        if (primaryEntity != null)
                        {
                            primaryEntity.OneToManyRelashionships.Add(new OneToManyRelationshipMetadataInfo(otmr));
                        }
                    }
                }
            }
        }
コード例 #4
0
ファイル: SolutionMeta.cs プロジェクト: hicham73/XrmTools
 internal void AddEntity(EntityMetadataInfo emdi)
 {
     EntityMetas.Add(emdi);
 }