Пример #1
0
        /// <summary>
        /// Add ErrorFilter to the <paramref name="syntax"/>
        /// </summary>
        /// <param name="syntax"></param>
        /// <param name="errors"></param>
        /// <returns></returns>
        public static ICreateColumnOptionSyntax WithErrorFilter(this ICreateColumnOptionSyntax syntax, params int[] errors)
        {
            if (errors.Length == 0)
            {
                return(syntax);
            }

            if (syntax is CreateColumnExpressionBuilder builder)
            {
                var id = $"{nameof(CreateColumnExpression)}_{builder.Expression.TableName}";
                if (builder.Expression.Column?.Name.IsNotEmpty() ?? false)
                {
                    id = $"{id}_{builder.Expression.Column?.Name}";
                }

                AddOrUpdateErrorFilter(id, errors);
            }

            return(syntax);
        }
Пример #2
0
 /// <summary>
 /// ChangeLog activation for Create.Column(..) syntax <br/>
 /// -------------------------------------------------<br/>
 /// It will be possible to add custom logging on all table operations.<br/>
 /// The interface <see cref="ICustomMigrationProcessor{T}"/> must be implemented and registered in the IoC container (<see cref="IServiceCollection"/> )<br/>
 /// Method <see cref="ICustomMigrationProcessor.Process(IChangeLogTabledExpression)"/><br/>
 /// can be used to implementing your preferred custom logging <br/>
 /// <br/>
 /// See the example of a implementation of <see cref="ICustomMigrationProcessor{T}"/>:<br/>
 /// <a href="https://github.com/DIPSAS/FluentDbTools/blob/master/src/FluentDbTools/Tests/Test.FluentDbTools.Migration/TestOracleCustomMigrationProcessor.cs">https://github.com/DIPSAS/FluentDbTools/blob/master/src/FluentDbTools/Tests/Test.FluentDbTools.Migration/TestOracleCustomMigrationProcessor.cs</a><br/>
 /// <br/>
 /// Can be registered like this:<br/>
 /// <code type="csharp">
 ///     <see cref="IServiceCollection">serviceCollection</see>.AddSingleton&lt;ICustomMigrationProcessor&lt;OracleProcessor&gt;,TestOracleCustomMigrationProcessor&gt;();
 /// </code>
 /// </summary>
 /// <param name="syntax"></param>
 /// <param name="changeLog"></param>
 /// <returns><see cref="ICreateColumnOptionSyntax"/></returns>
 public static ICreateColumnOptionSyntax WithChangeLog(
     this ICreateColumnOptionSyntax syntax, ChangeLogContext changeLog)
 {
     return(AddChangeLogCreateColumnSyntax(syntax, changeLog));
 }