Example #1
0
        public void DefaultConstructorThrows()
        {
            var       context = new ModuleDbContext();
            Exception ex      = Assert.Throws <InvalidOperationException>(() => {
                context.Items.Add(new Item());
            });

            Assert.Equal("No connection string named 'SiteSqlServer' could be found in the application config file.", ex.Message);
        }
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                this.dataContext.Dispose();
                this.connection.Dispose();
            }

            this.dataContext = null;
            this.connection  = null;

            _disposed = true;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="Repository{TEntity}"/> class.
 /// </summary>
 /// <param name="context">The module database context.</param>
 public Repository(ModuleDbContext context)
 {
     this.context  = context;
     this.entities = context.Set <T>();
 }
 public FakeDataContext()
 {
     this.connection  = Effort.DbConnectionFactory.CreateTransient();
     this.dataContext = new ModuleDbContext(this.connection);
 }
Example #5
0
 public OperateService(ModuleDbContext db, IMapper mapper, IModuleService moduleSvc)
 {
     _mapper    = mapper;
     _moduleSvc = moduleSvc;
     _db        = db;
 }
Example #6
0
 public ModuleService(ModuleDbContext db, IMapper mapper)
 {
     _mapper = mapper;
     _db     = db;
 }