Exemple #1
0
        private void GetAndDropConstraints()
        {
#if PocketPC
#else
            if (_disableConstraints)
            {
                var fkRepo = new ForeignKeyRepository(_conn.ConnectionString, _destination);
                _savedConstraints = fkRepo.GetConstraints();
                fkRepo.DropConstraints();
            }
#endif
        }
Exemple #2
0
        public void Test_DisableConstraints_Enabled_Timing()
        {
            var connString = GetChinookConnectionString();

            using (var bc = new SqlCeBulkCopy(connString, SqlCeBulkCopyOptions.DisableConstraints))
            {
                bc.DestinationTableName = "InvoiceLine";
                var sw = new Stopwatch();
                sw.Start();
                bc.WriteToServer(GetTestInvoiceLineTable(connString));
                sw.Stop();
                Debug.WriteLine("Without constraints: " + sw.ElapsedMilliseconds);
                var fkRepo           = new ForeignKeyRepository(connString, "InvoiceLine");
                var savedConstraints = fkRepo.GetConstraints();
                Assert.IsTrue(savedConstraints.Count == 2);
            }
        }