Exemplo n.º 1
0
        SqlServer_Database_can_be_created_with_columns_that_implicitly_total_more_that_8060_bytes_and_data_longer_than_8060_can_be_inserted
            ()
        {
            EnsureDatabaseInitialized(() => new ModelWithWideProperties());

            ExtendedSqlAzureExecutionStrategy.ExecuteNew(
                () =>
            {
                using (new TransactionScope())
                {
                    using (var context = new ModelWithWideProperties())
                    {
                        var entity = new EntityWithImplicitWideProperties
                        {
                            Property1 = new String('1', 1000),
                            Property2 = new String('2', 1000),
                            Property3 = new String('3', 1000),
                            Property4 = new String('4', 1000),
                        };

                        context.ImplicitlyWide.Add(entity);

                        context.SaveChanges();

                        entity.Property1 = new String('A', 4000);
                        entity.Property2 = new String('B', 4000);

                        context.SaveChanges();
                    }
                }
            });
        }
        SqlCe_Database_can_be_created_with_columns_that_implicitly_total_more_that_8060_bytes_but_data_longer_than_8060_cannot_be_inserted
            ()
        {
            RunInSqlCeTransaction <ModelWithWidePropertiesForSqlCe>(
                context =>
            {
                var entity = new EntityWithImplicitWideProperties
                {
                    Property1 =
                        new String('1', 1000),
                    Property2 =
                        new String('2', 1000),
                    Property3 =
                        new String('3', 1000),
                    Property4 =
                        new String('4', 1000),
                };

                context.ImplicitlyWide.Add(entity);

                context.SaveChanges();

                entity.Property1 = new String('A', 4000);
                entity.Property2 = new String('B', 4000);

                Assert.Throws <DbUpdateException>(
                    () => context.SaveChanges());
            });
        }
        public void SqlServer_Database_can_be_created_with_columns_that_implicitly_total_more_that_8060_bytes_and_data_longer_than_8060_can_be_inserted()
        {
            EnsureDatabaseInitialized(() => new ModelWithWideProperties());

            using (new TransactionScope())
            {
                using (var context = new ModelWithWideProperties())
                {
                    var entity = new EntityWithImplicitWideProperties
                                 {
                                     Property1 = new String('1', 1000),
                                     Property2 = new String('2', 1000),
                                     Property3 = new String('3', 1000),
                                     Property4 = new String('4', 1000),
                                 };

                    context.ImplicitlyWide.Add(entity);

                    context.SaveChanges();

                    entity.Property1 = new String('A', 4000);
                    entity.Property2 = new String('B', 4000);

                    context.SaveChanges();
                }
            }
        }