Beispiel #1
0
        private void InitScope(Action <IScope> scopeInit)
        {
            if (ParentContext != null && ParentContext.Scope != null)
            {
                ContextScope = ParentContext.Scope.OpenScope(ContextName);

                Action <IScope> configure = Configure;
                if (scopeInit != null)
                {
                    configure = (Action <IScope>)Delegate.Combine(configure, scopeInit);
                }

                configure(ContextScope);
                ContextScope.Unregister <IContext>();
                ContextScope.RegisterInstance <IContext>(this);
                ContextScope = ContextScope.AsReadOnly();
            }
        }
Beispiel #2
0
        internal DatabaseContext(ISystemContext systemContext, IConfiguration configuration)
            : base(systemContext)
        {
            if (systemContext == null)
            {
                throw new ArgumentNullException("systemContext");
            }
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            ContextScope.Unregister <IConfiguration>();
            ContextScope.RegisterInstance <IConfiguration>(configuration);
            ContextScope.RegisterInstance <IDatabaseContext>(this);

            SystemContext = systemContext;

            Configuration = configuration;

            InitStorageSystem();
        }