예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventDispatcher"/> class.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="kernel">The kernel.</param>
        /// <param name="databaseService">The database service.</param>
        public EventDispatcher(ILoggerFactory log, IKernel kernel, IDb4oDatabaseService databaseService)
        {
            this.kernel = kernel;

            events = new Dictionary<string, EventPublisherInfo>();
            subscribers = new Dictionary<string, EventSubscriberInfo>();
            eventCollectors = new Dictionary<string, EventCollector>();
            logger = log.CreateLogger<EventDispatcher>("Framework");
            db = databaseService.Open(dbName);
            outerSubscriberMapping = new Dictionary<string, List<string>>();
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventDispatcher"/> class.
        /// </summary>
        /// <param name="log">The log.</param>
        /// <param name="kernel">The kernel.</param>
        /// <param name="databaseService">The database service.</param>
        public EventDispatcher(ILoggerFactory log, IKernel kernel, IDb4oDatabaseService databaseService)
        {
            this.kernel = kernel;

            events          = new Dictionary <string, EventPublisherInfo>();
            subscribers     = new Dictionary <string, EventSubscriberInfo>();
            eventCollectors = new Dictionary <string, EventCollector>();
            logger          = log.CreateLogger <EventDispatcher>("Framework");
            db = databaseService.Open(dbName);
            outerSubscriberMapping = new Dictionary <string, List <string> >();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthorizationStoreService"/> class.
 /// </summary>
 /// <param name="dbService">The db service.</param>
 /// <param name="loggerFactory">The logger factory.</param>
 public AuthorizationStoreService(IDb4oDatabaseService dbService, ILoggerFactory loggerFactory)
 {
     logger = loggerFactory.CreateLogger<AuthorizationStoreService>("AuthorizationStoreService");
     try
     {
         db = dbService.Open(DBNAME);
     }
     catch (Exception ex)
     {
         logger.Error("打开系统授权数据库 \"" + DBNAME + "\" 失败。" + Environment.NewLine + ex.Message);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthorizationStoreService"/> class.
 /// </summary>
 /// <param name="dbService">The db service.</param>
 /// <param name="loggerFactory">The logger factory.</param>
 public AuthorizationStoreService(IDb4oDatabaseService dbService, ILoggerFactory loggerFactory)
 {
     logger = loggerFactory.CreateLogger <AuthorizationStoreService>("AuthorizationStoreService");
     try
     {
         db = dbService.Open(DBNAME);
     }
     catch (Exception ex)
     {
         logger.Error("打开系统授权数据库 \"" + DBNAME + "\" 失败。" + Environment.NewLine + ex.Message);
     }
 }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MySessionService"/> class.
        /// </summary>
        /// <param name="dbService">The db service.</param>
        /// <param name="configService">The config service.</param>
        /// <param name="loggerFactory">The logger factory.</param>
        /// <param name="dispatcher">The dispatcher.</param>
        public SessionService(IDb4oDatabaseService dbService, IConfigurationService configService, ILoggerFactory loggerFactory, IEventDispatcher dispatcher)
        {
            this.dispatcher = dispatcher;
            logger = loggerFactory.CreateLogger<SessionService>("Framework");
            db = dbService.Open(SESSION_DB);

            // 加载会话数据库中的会话信息
            foreach (SessionState session in db.Load<SessionState>()) {
                sessions.Add(session.SessionId, session);
            }

            try {
                IConfiguration conf = new XMLConfiguration(configService.GetItem(SESSION_PAPH));
                timeOut = conf.Attributes["timeout"] != null ? Int32.Parse(conf.Attributes["timeout"]) : SESSION_DEFAULT_TIMEOUT;
                checkSpan = conf.Attributes["checkspan"] != null ? Int32.Parse(conf.Attributes["checkspan"]) : SESSION_DEFAULT_CHECKSPAN;
            }
            catch {
                timeOut = SESSION_DEFAULT_TIMEOUT;
                checkSpan = SESSION_DEFAULT_CHECKSPAN;
            }
            Start(); // 启动会话管理
        }
예제 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MySessionService"/> class.
        /// </summary>
        /// <param name="dbService">The db service.</param>
        /// <param name="configService">The config service.</param>
        /// <param name="loggerFactory">The logger factory.</param>
        /// <param name="dispatcher">The dispatcher.</param>
        public SessionService(IDb4oDatabaseService dbService, IConfigurationService configService, ILoggerFactory loggerFactory, IEventDispatcher dispatcher)
        {
            this.dispatcher = dispatcher;
            logger          = loggerFactory.CreateLogger <SessionService>("Framework");
            db = dbService.Open(SESSION_DB);

            // 加载会话数据库中的会话信息
            foreach (SessionState session in db.Load <SessionState>())
            {
                sessions.Add(session.SessionId, session);
            }

            try {
                IConfiguration conf = new XMLConfiguration(configService.GetItem(SESSION_PAPH));
                timeOut = conf.Attributes["timeout"] != null?Int32.Parse(conf.Attributes["timeout"]) : SESSION_DEFAULT_TIMEOUT;

                checkSpan = conf.Attributes["checkspan"] != null?Int32.Parse(conf.Attributes["checkspan"]) : SESSION_DEFAULT_CHECKSPAN;
            }
            catch {
                timeOut   = SESSION_DEFAULT_TIMEOUT;
                checkSpan = SESSION_DEFAULT_CHECKSPAN;
            }
            Start(); // 启动会话管理
        }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutService"/> class.
 /// </summary>
 /// <param name="dbService">The db service.</param>
 public LayoutService(IDb4oDatabaseService dbService)
 {
     db = dbService.Open(LAYOUTDB);
 }
예제 #8
0
 /// <summary>
 /// 构造函数(重载)
 /// </summary>
 /// <param name="databaseService">db4o数据库服务</param>
 /// <param name="databaseName">请求队列存放的数据库名称</param>
 public db4oRequestQueue(IDb4oDatabaseService databaseService, string databaseName)
 {
     dbService = databaseService.Open(databaseName);
 }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LayoutService"/> class.
 /// </summary>
 /// <param name="dbService">The db service.</param>
 public LayoutService(IDb4oDatabaseService dbService)
 {
     db = dbService.Open(LAYOUTDB);
 }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyService"/> class.
 /// </summary>
 public PropertyService()
 {
     dbService = new Db4oDatabaseService(@"..\Data\");
     db        = dbService.Open(PROPERTY_DBFILE);
 }
예제 #11
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="databaseService">数据库服务</param>
 /// <param name="loggerFactory">日志服务工厂</param>
 public UpgradeService(IDb4oDatabaseService databaseService, ILoggerFactory loggerFactory)
 {
     logger = loggerFactory.CreateLogger <UpgradeService>();
     Db4oFactory.Configure().ObjectClass(typeof(UpgradeProject)).CascadeOnDelete(true); // 设置级联删除
     db = databaseService.Open(UPGRADE_CONFIGURATION_FILE);
 }
예제 #12
0
 /// <summary>
 /// 构造函数(重载)
 /// </summary>
 /// <param name="databaseService">db4o数据库服务</param>
 /// <param name="databaseName">请求队列存放的数据库名称</param>
 public db4oRequestQueue(IDb4oDatabaseService databaseService, string databaseName)
 {
     dbService = databaseService.Open(databaseName);
 }
예제 #13
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="databaseService">数据库服务</param>
 /// <param name="loggerFactory">日志服务工厂</param>
 public UpgradeService(IDb4oDatabaseService databaseService, ILoggerFactory loggerFactory)
 {
     logger = loggerFactory.CreateLogger<UpgradeService>();
     Db4oFactory.Configure().ObjectClass(typeof(UpgradeProject)).CascadeOnDelete(true); // 设置级联删除
     db = databaseService.Open(UPGRADE_CONFIGURATION_FILE);
 }