Esempio n. 1
0
        public DetachedContext(TDbContext dbContext)
        {
            _dbContext       = dbContext;
            _serviceProvider = ((IInfrastructure <IServiceProvider>)_dbContext).Instance;

            // get update and load services and event manager.
            _detachedServices = _serviceProvider.GetService <IDetachedContextServices>();
            if (_detachedServices == null)
            {
                throw new DetachedSetupException(_dbContext.GetType());
            }

            // set THIS as the current detached context.
            _detachedServices.SetDetachedContext(this);

            // load plugins.
            Plugins.Initialize();
        }
Esempio n. 2
0
 public DetachedSet(IDetachedContextServices detachedServices, IEventManager eventManager)
 {
     _detachedServices = detachedServices;
     _dbContext        = detachedServices.DetachedContext.DbContext;
     _eventManager     = eventManager;
 }