コード例 #1
0
        public UnitOfWork()
        {
            if (string.IsNullOrEmpty(_nameOrConnectionString))
            {
                throw new InvalidOperationException("Database name or connection string is null.");
            }

            _dbContext    = new SimpleDbContext(_nameOrConnectionString, _entities);
            _repositories = new Hashtable();

            foreach (var attribute in _attributes)
            {
                if (!_repositories.ContainsKey(attribute))
                {
                    var proxy = _proxyGenerator.CreateInterfaceProxyWithoutTarget(attribute, new RepositoryInterceptor(_dbContext));
                    _repositories.Add(attribute, proxy);
                }
            }
        }
コード例 #2
0
 public RepositoryInterceptor(SimpleDbContext dbContext)
 {
     _dbContext = dbContext;
 }
コード例 #3
0
 public SimpleRepository(SimpleDbContext dbContext)
 {
     _dbContext = dbContext;
 }