Exemple #1
0
        /// <summary>
        /// Check if property is identifying and has incoming associations
        /// </summary>
        /// <param name="property"></param>
        /// <returns></returns>
        public static bool IsIdentifyingAndHasAssociations(this ResourceProperty property)
        {
            if (!property.IsIdentifying || property.EntityProperty == null)
            {
                return(false);
            }

            return(property.HasAssociations());
        }
Exemple #2
0
        /// <summary>
        /// Returns the incoming context for the property that can have multiple associations (ie role based)
        /// </summary>
        /// <param name="resource"></param>
        /// <param name="property"></param>
        /// <returns></returns>
        public static AssociationView Context(this ResourceClassBase resource, ResourceProperty property)
        {
            if (!property.HasAssociations())
            {
                return(null);
            }

            return(property.EntityProperty
                   .IncomingAssociations
                   .FirstOrDefault(y => y == resource.Entity.ParentAssociation));
        }