Beispiel #1
0
        /// <summary>
        /// Engine context initialize
        /// </summary>
        /// <returns></returns>
        public static IServiceEngine Initialize(IEnumerable <Type> serviceTypes, ServiceManager.ServiceOpendHandler opend = null)
        {
            if (EngineContext.Current is Engine)
            {
                var engine = opend == null ? new ServiceEngine(serviceTypes) : new ServiceEngine(serviceTypes, opend);
                EngineContext.Replace(engine, true);
            }
            else if (!(EngineContext.Current is IServiceEngine))
            {
                throw new ServiceContextException();
            }

            return(Singleton <IEngine> .Instance as IServiceEngine);
        }
 public ServiceEngine(IEnumerable <Type> serviceTypes, ServiceManager.ServiceOpendHandler opend)
 {
     ServiceManager        = new ServiceManager(serviceTypes, opend);
     OnInitializeComplete += ServiceManager.InitForDependencyRegister;
 }