Esempio n. 1
0
        /// <summary>
        ///     Configures a database check constraint when targeting a relational database.
        /// </summary>
        /// <param name="ownedNavigationBuilder"> The navigation builder for the owned type. </param>
        /// <param name="name"> The name of the check constraint. </param>
        /// <param name="sql"> The logical constraint sql used in the check constraint. </param>
        /// <param name="buildAction"> An action that performs configuration of the check constraint. </param>
        /// <returns> A builder to further configure the navigation. </returns>
        public static OwnedNavigationBuilder HasCheckConstraint(
            this OwnedNavigationBuilder ownedNavigationBuilder,
            string name,
            string sql,
            Action <CheckConstraintBuilder> buildAction)
        {
            Check.NotEmpty(sql, nameof(sql));
            Check.NotNull(buildAction, nameof(buildAction));

            ownedNavigationBuilder.HasCheckConstraint(name, sql);

            buildAction(new CheckConstraintBuilder(ownedNavigationBuilder.OwnedEntityType.FindCheckConstraint(name) !));

            return(ownedNavigationBuilder);
        }