예제 #1
0
        [Fact] // CodePlex 1278
        public void DetectChanges_correctly_detects_change_of_complex_object_instance_on_change_tracking_proxy()
        {
            using (var context = new Context1278())
            {
                context.Configuration.AutoDetectChangesEnabled = false;

                var entity = context.Entities.Create();
                entity.ComplexProperty = new ComplexType1278();

                context.Entities.Attach(entity);

                entity.ComplexProperty = new ComplexType1278();

                Assert.True(context.Entry(entity).Property(e => e.ComplexProperty).IsModified);

                context.ChangeTracker.DetectChanges();

                Assert.True(context.Entry(entity).Property(e => e.ComplexProperty).IsModified);
            }
        }
예제 #2
0
        public void DetectChanges_correctly_detects_change_of_complex_object_instance_on_non_proxy()
        {
            using (var context = new Context1278())
            {
                context.Configuration.AutoDetectChangesEnabled = false;

                var entity = new Entity1278 { ComplexProperty = new ComplexType1278() };

                context.Entities.Attach(entity);

                entity.ComplexProperty = new ComplexType1278();

                Assert.False(context.Entry(entity).Property(e => e.ComplexProperty).IsModified);

                context.ChangeTracker.DetectChanges();

                Assert.True(context.Entry(entity).Property(e => e.ComplexProperty).IsModified);
            }
        }