Example #1
0
 private void WithDbContext(Action <FooContext> action)
 {
     using (var context = new FooContext(optionsBuilder.Options))
     {
         action.Invoke(context);
     }
 }
Example #2
0
        public void use_ModelFooService_to_interact()
        {
            using (var context = new FooContext(optionsBuilder.Options))
            {
                var modelFooRepository = new ModelFooRepository(context);
                var modelFooService    = new ModelFooService(modelFooRepository);

                var modelFoo = modelFooService.ValidateAndInsertOrUpdate(new ModelFoo {
                    Name = "Test 1"
                });
                modelFooService.SaveChanges();

                Assert.NotEqual(default(ModelFoo), modelFoo);
            }
        }
Example #3
0
        public void composite_foo_tests()
        {
            using (var context = new FooContext(optionsBuilder.Options))
            {
                var compositeFooRepository = new CompositeFooRepository(context);
                var compositeFooService    = new CompositeFooService(compositeFooRepository);

                var modelFoo = compositeFooService.InsertOrUpdate(new CompositeFoo {
                    Name = "Test 1"
                }, true);
                compositeFooService.SaveChanges();

                modelFoo = compositeFooService.Find(0, 0);

                Assert.NotNull(modelFoo);
            }
        }
Example #4
0
 public CompositeFooRepository(FooContext fooContext) : base(fooContext)
 {
 }
Example #5
0
 public ModelFooRepository(FooContext fooContext) : base(fooContext)
 {
 }