示例#1
0
        public AnkhRuntime(IServiceContainer parentContainer)
        {
            if (parentContainer == null)
            {
                throw new ArgumentNullException("parentContainer");
            }

            _container = parentContainer;

            _commandMapper = GetService <CommandMapper>();
            if (_commandMapper == null)
            {
                _container.AddService(typeof(CommandMapper), _commandMapper = new CommandMapper(this));
            }

            _context = GetService <AnkhContext>();
            if (_context == null)
            {
                _container.AddService(typeof(AnkhContext), _context = AnkhContext.Create(this));
            }

            InitializeServices();

            if (_runtimeInstance == null)
            {
                _runtimeInstance = this;
            }
        }
示例#2
0
        protected Module(AnkhRuntime runtime)
        {
            if (runtime == null)
            {
                throw new ArgumentNullException("runtime");
            }

            _container = runtime.GetService <IServiceContainer>();
            _runtime   = runtime;
            _context   = runtime.Context;
        }