Beispiel #1
0
    static void BuildEmployeeSearchKey1000_NoTrans(ICrudDataSource dataSource)
    {
        EmployeeSearchKey1000 = Guid.NewGuid().ToString();
        var rows = new List <Employee>();

        for (var i = 0; i < 1000; i++)
        {
            rows.Add(new Employee()
            {
                FirstName = i.ToString("0000"), LastName = "Z" + (int.MaxValue - i), Title = EmployeeSearchKey1000, MiddleName = i % 2 == 0 ? "A" + i : null, Gender = 'X'
            });
        }

        if (dataSource is ISupportsInsertBulk bulk)
        {
            bulk.InsertBulk(EmployeeTableName, rows).Execute();
        }
        else if (dataSource is ISupportsInsertBatch batch)
        {
            batch.InsertMultipleBatch(EmployeeTableName, rows).Execute();
        }
        else
        {
            foreach (var row in rows)
            {
                dataSource.Insert(EmployeeTableName, row).Execute();
            }
        }
    }
        public int Create(EmployeeClassification classification)
        {
            if (classification == null)
            {
                throw new ArgumentNullException(nameof(classification), $"{nameof(classification)} is null.");
            }

            return(m_DataSource.Insert(classification).ToInt32().Execute());
        }