public InsertStatementGenerator(Mapper mapper, int count, string tag) { _mapper = mapper; _tableMapping = _mapper._tableMappings[typeof(T)]; _insertStatements = new GeneratorInsertAction(_tableMapping.Table) { Tag = tag, Schema = mapper.Schema }; if (_tableMapping.DatabaseGenerated) { var primaryKeyColumn = _tableMapping.Table .Constraints .OfType <PrimaryKeyConstraint>() .Single() .SingleAffectedColumn; int startValue = _tableMapping.PrimaryKeySequence.StartWith ?? 0; _primaryKeyGenerator = DataGeneration.Count(startValue); _tableMapping.PrimaryKeySequence.StartWith = startValue + count; _insertStatements.Generators.Add(primaryKeyColumn, _primaryKeyGenerator); } _insertStatements.Generate(count); }