示例#1
0
 private void SubscribeToIpcMessageEvents(IpcMessage msg)
 {
     Subscribers.Each(logger =>
     {
         msg.Subscribe(logger);
     });
 }
示例#2
0
        private void InitializeAppResponders(AppConf[] configs)
        {
            string currentMode = ProcessMode.Current.Mode.ToString();

            configs.Where(c => c.ProcessMode.Equals(currentMode)).Each(ac =>
            {
                OnAppContentResponderInitializing(ac);
                Logger.RestartLoggingThread();
                AppContentResponder responder = new AppContentResponder(this, ac)
                {
                    Logger = Logger
                };
                Subscribers.Each(logger =>
                {
                    logger.RestartLoggingThread();
                    responder.Subscribe(logger);
                });
                string appName = ac.Name.ToLowerInvariant();
                responder.Initialize();
                responder.FileUploading      += (o, a) => FileUploading?.Invoke(o, a);
                responder.FileUploaded       += (o, a) => FileUploaded?.Invoke(o, a);
                responder.Responded          += (r, context) => OnResponded(context);
                responder.NotResponded       += (r, context) => OnNotResponded(context);
                AppContentResponders[appName] = responder;

                OnAppContentResponderInitialized(ac);
            });
        }
示例#3
0
        /// <summary>
        /// Generates a Dao Assembly for the underlying
        /// storable types if it has not yet been generated
        /// </summary>
        /// <returns></returns>
        public Assembly EnsureDaoAssemblyAndSchema(bool useExisting = true)
        {
            if (_daoAssembly == null)
            {
                _daoAssembly = GenerateDaoAssembly(useExisting);
            }

            Args.ThrowIfNull(Database, "Database");
            if (SchemaStatus == EnsureSchemaStatus.Invalid)
            {
                MultiTargetLogger logger = new MultiTargetLogger();
                Subscribers.Each(l => logger.AddLogger(l));
                SchemaStatus = Database.TryEnsureSchema(_daoAssembly.GetTypes().First(type => type.HasCustomAttributeOfType(out TableAttribute attr) && attr.ConnectionName.Equals(SchemaName)), logger);
            }

            return(_daoAssembly);
        }
示例#4
0
        private void InitializeAppResponders(AppConf[] configs)
        {
            configs.Each(ac =>
            {
                OnAppContentResponderInitializing(ac);
                Logger.RestartLoggingThread();
                AppContentResponder responder = new AppContentResponder(this, ac);
                responder.Logger = Logger;
                Subscribers.Each(logger =>
                {
                    logger.RestartLoggingThread();
                    responder.Subscribe(logger);
                });
                string appName = ac.Name.ToLowerInvariant();
                responder.Initialize();
                responder.FileUploading      += (o, a) => FileUploading?.Invoke(o, a);
                responder.FileUploaded       += (o, a) => FileUploaded?.Invoke(o, a);
                AppContentResponders[appName] = responder;

                OnAppContentResponderInitialized(ac);
            });
        }