示例#1
0
        public Repository(JamimDataContext context)
        {
            if (!interfaces.Contains(typeof(IAggregateRoot)))
            {
                throw new ApplicationException("Business Rule Violated: Aggregation broken!");
            }

            this.context = context;
            this.dbSet   = context.Set <TEntity>();
        }
        public static JamimDataContext GetDataContext()
        {
            IDataContextStorageContainer _dataContextStorageContainer = DataContextStorageFactory.CreateStorageContainer();

            JamimDataContext jamimDataContext = _dataContextStorageContainer.GetDataContext();

            if (jamimDataContext == null)
            {
                jamimDataContext = new JamimDataContext();
                _dataContextStorageContainer.Store(jamimDataContext);
            }
            return(jamimDataContext);
        }