Exemple #1
0
        private InternalSkipNavigationBuilder RunConvention(InternalSkipNavigationBuilder skipNavBuilder)
        {
            var context = new ConventionContext <IConventionSkipNavigationBuilder>(skipNavBuilder.Metadata.DeclaringEntityType.Model.ConventionDispatcher);

            CreateManyToManyConvention().ProcessSkipNavigationAdded(skipNavBuilder, context);
            return(context.ShouldStopProcessing() ? (InternalSkipNavigationBuilder)context.Result : skipNavBuilder);
        }
Exemple #2
0
        /// <summary>
        ///     Configures whether this navigation should be automatically included in a query.
        /// </summary>
        /// <param name="autoInclude"> A value indicating if the navigation should be automatically included. </param>
        /// <returns> The same builder instance so that multiple configuration calls can be chained. </returns>
        public virtual NavigationBuilder AutoInclude(bool autoInclude = true)
        {
            if (InternalNavigationBuilder != null)
            {
                InternalNavigationBuilder.AutoInclude(autoInclude, ConfigurationSource.Explicit);
            }
            else
            {
                InternalSkipNavigationBuilder.AutoInclude(autoInclude, ConfigurationSource.Explicit);
            }

            return(this);
        }
Exemple #3
0
        /// <summary>
        ///     Sets a backing field to use for this navigation property.
        /// </summary>
        /// <param name="fieldName"> The name of the field to use for this navigation property. </param>
        /// <returns> The same builder instance so that multiple configuration calls can be chained. </returns>
        public virtual NavigationBuilder HasField([CanBeNull] string fieldName)
        {
            if (InternalNavigationBuilder != null)
            {
                InternalNavigationBuilder.HasField(fieldName, ConfigurationSource.Explicit);
            }
            else
            {
                InternalSkipNavigationBuilder.HasField(fieldName, ConfigurationSource.Explicit);
            }

            return(this);
        }
Exemple #4
0
        /// <summary>
        ///     <para>
        ///         Sets the <see cref="PropertyAccessMode" /> to use for this property.
        ///     </para>
        ///     <para>
        ///         By default, the backing field, if one is found by convention or has been specified, is used when
        ///         new objects are constructed, typically when entities are queried from the database.
        ///         Properties are used for all other accesses.  Calling this method will change that behavior
        ///         for this property as described in the <see cref="PropertyAccessMode" /> enum.
        ///     </para>
        ///     <para>
        ///         Calling this method overrides for this property any access mode that was set on the
        ///         entity type or model.
        ///     </para>
        /// </summary>
        /// <param name="propertyAccessMode"> The <see cref="PropertyAccessMode" /> to use for this property. </param>
        /// <returns> The same builder instance so that multiple configuration calls can be chained. </returns>
        public virtual NavigationBuilder UsePropertyAccessMode(PropertyAccessMode propertyAccessMode)
        {
            if (InternalNavigationBuilder != null)
            {
                InternalNavigationBuilder.UsePropertyAccessMode(propertyAccessMode, ConfigurationSource.Explicit);
            }
            else
            {
                InternalSkipNavigationBuilder.UsePropertyAccessMode(propertyAccessMode, ConfigurationSource.Explicit);
            }

            return(this);
        }
Exemple #5
0
        /// <summary>
        ///     Configures whether this navigation should be eager loaded in a query.
        /// </summary>
        /// <param name="eagerLoaded"> A value indicating if the navigation should be eager loaded. </param>
        /// <returns> The same builder instance so that multiple configuration calls can be chained. </returns>
        public virtual NavigationBuilder IsEagerLoaded(bool eagerLoaded = true)
        {
            if (InternalNavigationBuilder != null)
            {
                InternalNavigationBuilder.IsEagerLoaded(eagerLoaded, ConfigurationSource.Explicit);
            }
            else
            {
                InternalSkipNavigationBuilder.IsEagerLoaded(eagerLoaded, ConfigurationSource.Explicit);
            }

            return(this);
        }
Exemple #6
0
        /// <summary>
        ///     Adds or updates an annotation on the navigation property. If an annotation
        ///     with the key specified in <paramref name="annotation" /> already exists
        ///     its value will be updated.
        /// </summary>
        /// <param name="annotation"> The key of the annotation to be added or updated. </param>
        /// <param name="value"> The value to be stored in the annotation. </param>
        /// <returns> The same builder instance so that multiple configuration calls can be chained. </returns>
        public virtual NavigationBuilder HasAnnotation([NotNull] string annotation, [NotNull] object value)
        {
            Check.NotEmpty(annotation, nameof(annotation));
            Check.NotNull(value, nameof(value));

            if (InternalNavigationBuilder != null)
            {
                InternalNavigationBuilder.HasAnnotation(annotation, value, ConfigurationSource.Explicit);
            }
            else
            {
                InternalSkipNavigationBuilder.HasAnnotation(annotation, value, ConfigurationSource.Explicit);
            }

            return(this);
        }