Esempio n. 1
0
 public void CreateProductNN()
 {
     ProductNN <T> productNN = new ProductNN <T>();
 }
        public void Add_principal_then_dependent_one_to_many_no_navs_FK_set_no_navs_set(EntityState entityState)
        {
            using (var context = new FixupContext())
            {
                var principal = new CategoryNN { Id = 77 };
                var dependent = new ProductNN { Id = 78 };

                context.Entry(dependent).Property("CategoryId").CurrentValue = principal.Id;

                context.Entry(principal).State = entityState;
                context.Entry(dependent).State = entityState;

                AssertFixup(
                    context,
                    () =>
                        {
                            Assert.Equal(principal.Id, context.Entry(dependent).Property("CategoryId").CurrentValue);
                            Assert.Equal(entityState, context.Entry(principal).State);
                            Assert.Equal(entityState, context.Entry(dependent).State);
                        });
            }
        }
Esempio n. 3
0
        public void Add_principal_then_dependent_one_to_many_no_navs_FK_set_no_navs_set(EntityState entityState)
        {
            using (var context = new FixupContext())
            {
                var principal = new CategoryNN { Id = 77 };
                var dependent = new ProductNN { Id = 78, CategoryId = principal.Id };

                context.Entry(principal).State = entityState;
                context.Entry(dependent).State = entityState;

                Assert.Equal(principal.Id, dependent.CategoryId);
                Assert.Equal(entityState, context.Entry(principal).State);
                Assert.Equal(entityState, context.Entry(dependent).State);
            }
        }
Esempio n. 4
0
        public void Add_principal_but_not_dependent_one_to_many_no_navs_FK_set_no_navs_set(EntityState entityState)
        {
            using (var context = new FixupContext())
            {
                var principal = new CategoryNN { Id = 77 };
                var dependent = new ProductNN { Id = 78 };

                context.Entry(principal).State = entityState;

                dependent.CategoryId = principal.Id;

                context.ChangeTracker.DetectChanges();

                AssertFixup(
                    context,
                    () =>
                        {
                            Assert.Equal(principal.Id, dependent.CategoryId);
                            Assert.Equal(entityState, context.Entry(principal).State);
                            Assert.Equal(EntityState.Detached, context.Entry(dependent).State);
                        });
            }
        }