コード例 #1
0
        private bool HasOverlappingNonNullableForeignKeys(EntitySet entitySet, EntityType entityType)
        {
            foreach (AssociationSet associationSet in this.entityContainer.AssociationSets
                .Where(s => s.AssociationType.ReferentialConstraint != null && entityType.IsKindOf(s.AssociationType.ReferentialConstraint.DependentAssociationEnd.EntityType)
                    && s.Ends.Where(e => e.AssociationEnd == s.AssociationType.ReferentialConstraint.DependentAssociationEnd).Single().EntitySet == entitySet))
            {
                foreach (MemberProperty dependentProperty in associationSet.AssociationType.ReferentialConstraint.DependentProperties.Where(p => !p.PropertyType.IsNullable))
                {
                    if (entitySet.Container.Model.Associations.Any(a => a.ReferentialConstraint != null &&
                            a != associationSet.AssociationType &&
                            a.ReferentialConstraint.DependentProperties.Contains(dependentProperty)))
                    {
                        return true;
                    }
                }
            }

            return false;
        }
コード例 #2
0
        /// <summary>
        /// Considers the candidate for this relationship.
        /// </summary>
        /// <param name="entitySet">The entity set.</param>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="key">The entity data key of the candidate.</param>
        public void ConsiderCandidate(EntitySet entitySet, EntityType entityType, EntityDataKey key)
        {
            foreach (RelationshipGroupEnd end in this.ends.Where(e => e.EntitySet == entitySet && entityType.IsKindOf(e.EntityType)))
            {
                CapacityRange capacityRange = end.CapacitySelector();

                if (capacityRange != CapacityRange.Zero)
                {
                    this.RemoveCandidatesOnTargetBasedOnTreshhold(end);
                    
                    RelationshipCandidate candidate = new RelationshipCandidate(end, key, capacityRange);
                    end.Candidates.Add(candidate);
                }
            }
        }
コード例 #3
0
 /// <summary>
 /// Gets all constraints for the property for the specified dependent entity type.
 /// </summary>
 /// <param name="dependentEntityType">Type of the dependent entity.</param>
 /// <returns>All constraints for the property for the specified dependent entity type.</returns>
 public List<PropertyConstraint> GetConstraints(EntityType dependentEntityType)
 {
     return this.constraints.Where(c => dependentEntityType.IsKindOf(c.DependentEntityType)).ToList();
 }