Exemple #1
0
        internal static MySqlCommand MockUpdate <TSource, TTarget>(this DbTable <TTarget> dbTable, bool success, DataSet <TSource> source, int rowIndex,
                                                                   Action <ColumnMapper, TSource, TTarget> columnMapper, Func <TSource, TTarget, KeyMapping> joinMapper)
            where TSource : Model, new()
            where TTarget : Model, new()
        {
            dbTable.Verify(source, nameof(source), rowIndex, nameof(rowIndex));
            var columnMappings = dbTable.Verify(columnMapper, nameof(columnMapper), source._);
            var join           = dbTable.Verify(joinMapper, nameof(joinMapper), source._).GetColumnMappings();

            var statement = dbTable.BuildUpdateScalarStatement(source, rowIndex, columnMappings, join);
            var result    = dbTable.MySqlSession().GetUpdateCommand(statement);

            dbTable.UpdateOrigin <TSource>(null, success);
            return(result);
        }