Example #1
0
        private AppHost()
        {
            LogManager.LogFactory = new Log4NetFactory(true);

            var factory         = new FactoryProvider(FactoryUtils.ObjectFactory, LogManager.LogFactory);
            var providerManager = new Db4oFileProviderManager(Config.ConnectionString);

            var configDb4o = Db4oFactory.Configure();

            configDb4o.ActivationDepth(5);
            configDb4o.UpdateDepth(5);
            configDb4o.OptimizeNativeQueries(true);

            factory.Register(providerManager);             //Keep the manager from disposing providers it created
            factory.Register(providerManager.GetProvider());

            // Create the ApplicationContext injected with the static service implementations
            ApplicationContext.SetInstanceContext(new ApplicationContext {
                Factory   = factory,
                Cache     = new MemoryCacheClient(),
                Resources = new ConfigurationResourceManager(),
            });

            SetConfig(new EndpointHostConfig {
                ServiceName         = Config.ServiceName,
                OperationsNamespace = Config.OperationNamespace,
                ServiceModelFinder  = ServiceModelFinder.Instance,
                ServiceController   = new ServiceController(new ServiceResolver()),
            });
        }
Example #2
0
        private AppHost()
        {
            LogManager.LogFactory = new Log4NetFactory(true);

            var factory = new FactoryProvider(FactoryUtils.ObjectFactory, LogManager.LogFactory);
            var providerManager = new Db4oFileProviderManager(Config.ConnectionString);

            var configDb4o = Db4oFactory.Configure();
            configDb4o.ActivationDepth(5);
            configDb4o.UpdateDepth(5);
            configDb4o.OptimizeNativeQueries(true);

            factory.Register(providerManager); //Keep the manager from disposing providers it created
            factory.Register(providerManager.GetProvider());

            // Create the ApplicationContext injected with the static service implementations
            ApplicationContext.SetInstanceContext(new ApplicationContext {
                Factory = factory,
                Cache = new MemoryCacheClient(),
                Resources = new ConfigurationResourceManager(),
            });

            SetConfig(new EndpointHostConfig {
                ServiceName = Config.ServiceName,
                OperationsNamespace = Config.OperationNamespace,
                ServiceModelFinder = ServiceModelFinder.Instance,
                ServiceController = new ServiceController(new ServiceResolver()),
            });
        }