public UnitOfWorkManager(IMVCForumContext context)
 {
     //http://www.entityframeworktutorial.net/code-first/automated-migration-in-code-first.aspx
     Database.SetInitializer(new MigrateDatabaseToLatestVersion<MVCForumContext, Migrations.Configuration>(AppConstants.MvcForumContext));
     //Database.SetInitializer<MVCForumContext>(null);
     _context = context as MVCForumContext;
 }
        public UnitOfWorkManager(IMVCForumContext context)
        {
            // http://stackoverflow.com/questions/3552000/entity-framework-code-only-error-the-model-backing-the-context-has-changed-sinc
            Database.SetInitializer<MVCForumContext>(null);

            _context = context as MVCForumContext;
        }
Beispiel #3
0
        /// <summary>
        /// Constructor
        /// </summary>
        public UnitOfWork(MVCForumContext context)
        {            
            _context = context;

            // In order to make calls that are overidden in the caching ef-wrapper, we need to use
            // transactions from the connection, rather than TransactionScope. 
            // This results in our call e.g. to commit() being intercepted 
            // by the wrapper so the cache can be adjusted.
            // This won't work with the dbcontext because it handles the connection itself, so we must use the underlying ObjectContext. 
            // http://blogs.msdn.com/b/diego/archive/2012/01/26/exception-from-dbcontext-api-entityconnection-can-only-be-constructed-with-a-closed-dbconnection.aspx
            _objectContext = ((IObjectContextAdapter) _context).ObjectContext;

            if (_objectContext.Connection.State != ConnectionState.Open)
            {
                _objectContext.Connection.Open();
                _transaction = _objectContext.Connection.BeginTransaction();
            }
        }
 public UploadedFileRepository(MVCForumContext context)
 {
     _context = context;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"> </param>
 public VoteRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
Beispiel #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"></param>
 public ActivityRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"></param>
 public GlobalPermissionForRoleRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"> </param>
 public LocalizationRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"></param>
 public CategoryPermissionForRoleRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
Beispiel #10
0
 public PermissionRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
 public PostRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
Beispiel #12
0
 public BannedWordRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
 public BlockRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"></param>
 public CategoryRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
Beispiel #15
0
 public PollAnswerRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
Beispiel #16
0
 public FavouriteRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
Beispiel #17
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"> </param>
 public SettingsRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"> </param>
 public TopicTagRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"> </param>
 public PrivateMessageRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
Beispiel #20
0
 public InstallerRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"> </param>
 public TopicNotificationRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
 public CategoryNotificationRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="context"></param>
 public MembershipRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }
Beispiel #24
0
 public EmailRepository(IMVCForumContext context)
 {
     _context = context as MVCForumContext;
 }