Esempio n. 1
0
        protected override void Create()
        {
            ConnectionStringHolder.Initialize(Contexts.ApplicationContext.Config.ConnectionString);
            StoreKeeperServer.Create();
            Contexts.ServiceContext.Initialize();

            IServiceDescriptor serviceDescriptor = new ServiceConfiguration();

            string uriApplication = Infrastructure.GetEndpointUrl(serviceDescriptor);

            _applicationHost = new ServiceHost(typeof(StoreKeeperContract), new Uri(uriApplication));
            Infrastructure.AddServiceBehaviors(_applicationHost.Description);

            _applicationHost.AddServiceEndpoint(
                typeof(IServerAccess),
                Infrastructure.CreateApplicationBinding(false),
                Constants.ServiceAccessContract
                );

            _applicationHost.Open();

            Logger.Info("StoreKeeperService started on address: {0}", uriApplication);

            Contexts.ServiceContext.SessionManager.ReconnectSessions();
        }
Esempio n. 2
0
 protected override void Destroy()
 {
     if (_applicationHost != null)
     {
         _applicationHost.Close();
         _applicationHost = null;
     }
     StoreKeeperServer.Close();
     ConnectionStringHolder.Close();
     Logger.Info("StoreKeeperService destroyed.");
 }
Esempio n. 3
0
 public static void Initialize()
 {
     Instance._sessionManager = StoreKeeperServer.Service <ISessionManager>();
     Instance._dataManager    = StoreKeeperServer.Service <IDataManager>();
 }