Exemple #1
0
        private static object GetRelationshipMetadata(XrmFakedRelationship fakeRelationShip)
        {
            if (fakeRelationShip.RelationshipType == XrmFakedRelationship.enmFakeRelationshipType.ManyToMany)
            {
                var mtm = new Microsoft.Xrm.Sdk.Metadata.ManyToManyRelationshipMetadata();
                mtm.Entity1LogicalName        = fakeRelationShip.Entity1LogicalName;
                mtm.Entity1IntersectAttribute = fakeRelationShip.Entity1Attribute;
                mtm.Entity2LogicalName        = fakeRelationShip.Entity2LogicalName;
                mtm.Entity2IntersectAttribute = fakeRelationShip.Entity2Attribute;
                mtm.SchemaName          = fakeRelationShip.IntersectEntity;
                mtm.IntersectEntityName = fakeRelationShip.IntersectEntity.ToLower();
                return(mtm);
            }
            else
            {
                var otm = new Microsoft.Xrm.Sdk.Metadata.OneToManyRelationshipMetadata();
#if FAKE_XRM_EASY_2013 || FAKE_XRM_EASY_2015 || FAKE_XRM_EASY
#else
                otm.ReferencedEntityNavigationPropertyName = fakeRelationShip.IntersectEntity;
#endif
                otm.ReferencingAttribute = fakeRelationShip.Entity1Attribute;
                otm.ReferencingEntity    = fakeRelationShip.Entity1LogicalName;
                otm.ReferencedAttribute  = fakeRelationShip.Entity2Attribute;
                otm.ReferencedEntity     = fakeRelationShip.Entity2LogicalName;
                otm.SchemaName           = fakeRelationShip.IntersectEntity;
                return(otm);
            }
        }
 public static void SetSealedPropertyValue(this Microsoft.Xrm.Sdk.Metadata.ManyToManyRelationshipMetadata manyToManyRelationshipMetadata, string sPropertyName, object value)
 {
     manyToManyRelationshipMetadata.GetType().GetProperty(sPropertyName).SetValue(manyToManyRelationshipMetadata, value, null);
 }