コード例 #1
0
    public CollectionCollectionBuilder(
        IMutableEntityType leftEntityType,
        IMutableEntityType rightEntityType,
        IMutableSkipNavigation leftNavigation,
        IMutableSkipNavigation rightNavigation)
    {
        Check.DebugAssert(((IConventionEntityType)leftEntityType).IsInModel, "Not in model");
        Check.DebugAssert(((IConventionEntityType)rightEntityType).IsInModel, "Not in model");
        Check.DebugAssert(((IConventionSkipNavigation)leftNavigation).IsInModel, "Not in model");
        Check.DebugAssert(((IConventionSkipNavigation)rightNavigation).IsInModel, "Not in model");

        if (leftNavigation == rightNavigation)
        {
            throw new InvalidOperationException(
                      CoreStrings.ManyToManyOneNav(leftEntityType.DisplayName(), leftNavigation.Name));
        }

        LeftEntityType  = leftEntityType;
        RightEntityType = rightEntityType;
        LeftNavigation  = leftNavigation;
        RightNavigation = rightNavigation;

        var leftSkipNavigation  = (SkipNavigation)leftNavigation;
        var rightSkipNavigation = (SkipNavigation)rightNavigation;

        leftSkipNavigation.Builder.HasInverse(rightSkipNavigation, ConfigurationSource.Explicit);

        // We delayed setting the ConfigurationSource of SkipNavigation in HasMany().
        // But now we know that both navigations are skip navigations.
        leftSkipNavigation.UpdateConfigurationSource(ConfigurationSource.Explicit);
        rightSkipNavigation.UpdateConfigurationSource(ConfigurationSource.Explicit);
    }
コード例 #2
0
        public CollectionCollectionBuilder(
            IMutableEntityType leftEntityType,
            IMutableEntityType rightEntityType,
            IMutableSkipNavigation leftNavigation,
            IMutableSkipNavigation rightNavigation)
        {
            Check.DebugAssert(((IConventionEntityType)leftEntityType).IsInModel, "Not in model");
            Check.DebugAssert(((IConventionEntityType)rightEntityType).IsInModel, "Not in model");
            Check.DebugAssert(((IConventionSkipNavigation)leftNavigation).IsInModel, "Not in model");
            Check.DebugAssert(((IConventionSkipNavigation)rightNavigation).IsInModel, "Not in model");

            LeftEntityType  = leftEntityType;
            RightEntityType = rightEntityType;
            LeftNavigation  = leftNavigation;
            RightNavigation = rightNavigation;

            var leftSkipNavigation  = (SkipNavigation)leftNavigation;
            var rightSkipNavigation = (SkipNavigation)rightNavigation;

            leftSkipNavigation.Builder.HasInverse(rightSkipNavigation, ConfigurationSource.Explicit);

            // We delayed setting the ConfigurationSource of SkipNavigation in HasMany().
            // But now we know that both navigations are skip navigations.
            leftSkipNavigation.UpdateConfigurationSource(ConfigurationSource.Explicit);
            rightSkipNavigation.UpdateConfigurationSource(ConfigurationSource.Explicit);
        }
コード例 #3
0
 public CollectionCollectionBuilder(
     IMutableEntityType leftEntityType,
     IMutableEntityType rightEntityType,
     IMutableSkipNavigation leftNavigation,
     IMutableSkipNavigation rightNavigation)
     : base(leftEntityType, rightEntityType, leftNavigation, rightNavigation)
 {
 }
コード例 #4
0
 public CollectionNavigationBuilder(
     [NotNull] IMutableEntityType declaringEntityType,
     [NotNull] IMutableEntityType relatedEntityType,
     MemberIdentity navigation,
     [CanBeNull] IMutableForeignKey foreignKey,
     [CanBeNull] IMutableSkipNavigation skipNavigation)
     : base(declaringEntityType, relatedEntityType, navigation, foreignKey, skipNavigation)
 {
 }
コード例 #5
0
        protected virtual void Using([NotNull] IMutableForeignKey rightForeignKey, [NotNull] IMutableForeignKey leftForeignKey)
        {
            var leftBuilder  = ((SkipNavigation)LeftNavigation).Builder;
            var rightBuilder = ((SkipNavigation)RightNavigation).Builder;

            leftBuilder  = leftBuilder.HasForeignKey((ForeignKey)leftForeignKey, ConfigurationSource.Explicit);
            rightBuilder = rightBuilder.HasForeignKey((ForeignKey)rightForeignKey, ConfigurationSource.Explicit);

            leftBuilder = leftBuilder.HasInverse(rightBuilder.Metadata, ConfigurationSource.Explicit);

            LeftNavigation  = leftBuilder.Metadata;
            RightNavigation = leftBuilder.Metadata.Inverse;
        }
コード例 #6
0
 public CollectionNavigationBuilder(
     [NotNull] IMutableEntityType declaringEntityType,
     [NotNull] IMutableEntityType relatedEntityType,
     MemberIdentity navigation,
     [CanBeNull] IMutableForeignKey foreignKey,
     [CanBeNull] IMutableSkipNavigation skipNavigation)
 {
     DeclaringEntityType = declaringEntityType;
     RelatedEntityType   = relatedEntityType;
     CollectionMember    = navigation.MemberInfo;
     CollectionName      = navigation.Name;
     Builder             = ((ForeignKey)foreignKey)?.Builder;
     SkipNavigation      = skipNavigation;
 }
コード例 #7
0
        public CollectionCollectionBuilder(
            [NotNull] IMutableEntityType leftEntityType,
            [NotNull] IMutableEntityType rightEntityType,
            [NotNull] IMutableSkipNavigation leftNavigation,
            [NotNull] IMutableSkipNavigation rightNavigation)
        {
            Check.DebugAssert(((IConventionEntityType)leftEntityType).Builder != null, "Builder is null");
            Check.DebugAssert(((IConventionEntityType)rightEntityType).Builder != null, "Builder is null");
            Check.DebugAssert(((IConventionSkipNavigation)leftNavigation).Builder != null, "Builder is null");
            Check.DebugAssert(((IConventionSkipNavigation)rightNavigation).Builder != null, "Builder is null");

            LeftEntityType  = leftEntityType;
            RightEntityType = rightEntityType;
            LeftNavigation  = leftNavigation;
            RightNavigation = rightNavigation;
        }
コード例 #8
0
        public CollectionCollectionBuilder(
            IMutableEntityType leftEntityType,
            IMutableEntityType rightEntityType,
            IMutableSkipNavigation leftNavigation,
            IMutableSkipNavigation rightNavigation)
        {
            Check.DebugAssert(((IConventionEntityType)leftEntityType).IsInModel, "Not in model");
            Check.DebugAssert(((IConventionEntityType)rightEntityType).IsInModel, "Not in model");
            Check.DebugAssert(((IConventionSkipNavigation)leftNavigation).IsInModel, "Not in model");
            Check.DebugAssert(((IConventionSkipNavigation)rightNavigation).IsInModel, "Not in model");

            LeftEntityType  = leftEntityType;
            RightEntityType = rightEntityType;
            LeftNavigation  = leftNavigation;
            RightNavigation = rightNavigation;
        }