Esempio n. 1
0
        public static MySqlCommand MockInsert <TSource, TTarget>(this DbTable <TTarget> dbTable, bool success, DataSet <TSource> source, int ordinal,
                                                                 Action <ColumnMapper, TSource, TTarget> columnMapper, bool updateIdentity = false)
            where TSource : Model, new()
            where TTarget : Model, new()
        {
            dbTable.Verify(source, nameof(source), ordinal, nameof(ordinal));
            var columnMappings = dbTable.Verify(columnMapper, nameof(columnMapper), source._);

            dbTable.VerifyUpdateIdentity(updateIdentity, nameof(updateIdentity));

            var result = dbTable.GetInsertScalarCommand(dbTable.BuildInsertScalarStatement(source, ordinal, columnMappings));

            dbTable.UpdateOrigin(source, success);

            return(result);
        }