Beispiel #1
0
        /// <summary>
        /// Sets a table option for the table associated with this entity.
        /// Can be called more then once to set multiple table options.
        /// </summary>
        /// <param name="entityTypeBuilder"> The builder for the entity type being configured. </param>
        /// <param name="name"> The name of the table options. </param>
        /// <param name="value"> The value of the table options. </param>
        /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
        /// <returns> The same builder instance so that multiple calls can be chained. </returns>
        public static IConventionEntityTypeBuilder HasTableOption(
            [NotNull] this IConventionEntityTypeBuilder entityTypeBuilder,
            [CanBeNull] string name,
            [CanBeNull] string value,
            bool fromDataAnnotation = false)
        {
            Check.NotNull(entityTypeBuilder, nameof(entityTypeBuilder));

            if (entityTypeBuilder.CanSetTableOption(name, value, fromDataAnnotation))
            {
                var options = entityTypeBuilder.Metadata.GetTableOptions();
                UpdateTableOption(name, value, options);
                entityTypeBuilder.Metadata.SetTableOptions(options, fromDataAnnotation);

                return(entityTypeBuilder);
            }

            return(null);
        }