Esempio n. 1
0
        public static IUnityContainer ConfigureUnity(ISettingsContainer settingsContainer, ITracer tracer, ITracerContextManager tracerContextManager)
        {
            IUnityContainer container      = new UnityContainer();
            var             massProcessors = new IMassProcessor[]
            {
                new TaskServiceJobsMassProcessor(container),
            };
            var storageSettings = settingsContainer.AsSettings <ISqlStoreSettingsAspect>();

            container.RegisterContexts()
            .AttachQueryableContainerExtension()
            .UseParameterResolvers(ParameterResolvers.Defaults)
            .ConfigureMetadata()
            .ConfigureSettingsAspects(settingsContainer)
            .ConfigureTracing(tracer, tracerContextManager)
            .ConfigureSecurityAspects()
            .ConfigureQuartz()
            .ConfigureIdentityInfrastructure()
            .ConfigureWcf()
            .ConfigureOperationsProcessing()
            .ConfigureStorage(storageSettings, EntryPointSpecificLifetimeManagerFactory)
            .ConfigureReplication(EntryPointSpecificLifetimeManagerFactory);

            ReplicationRoot.Instance.PerformTypesMassProcessing(massProcessors, true, typeof(object));

            return(container);
        }
        public static IUnityContainer ConfigureUnity(ISettingsContainer settingsContainer)
        {
            IUnityContainer container = new UnityContainer();
            container.AttachQueryableContainerExtension()
                     .UseParameterResolvers(new ParameterResolver[]
                                                 {
                                                     OperationServicesDependencyResolver
                                                 }
                                                .Concat(AggregatesLayerParameterResolvers.Defaults)
                                                .Concat(ParameterResolvers.Defaults));

            var massProcessors = new IMassProcessor[]
                {
                    new AggregatesLayerMassProcessor(container, x => null),
                    new EFDbModelMassProcessor(container)
                };

            container
                .ConfigureSettingsAspects(settingsContainer)
                .ConfigureIndentityInfrastructure(EntryPointSpecificLifetimeManagerFactory)
                .ConfigureStorageLayer(EntryPointSpecificLifetimeManagerFactory)
                .ConfigureSecurityInfrastructure();

            SampleAppRoot.Instance.PerformTypesMassProcessing(massProcessors, true, typeof(object));
            SampleAppRoot.Instance.PerformTypesMassProcessing(massProcessors, false, typeof(object));

            return container;
        }
Esempio n. 3
0
 public WithBackupSettingsFileExpoter(
     string targetFilePath,
     ISettingsContainer container,
     ISettingsSerializer serializer)
     : this(targetFilePath, targetFilePath + ".bak", container, serializer)
 {
 }
Esempio n. 4
0
        private ProxySettingsContainer(
            ISettingsContainer parent,
            string tag,
            string parentTagPrefix)
        {
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }
            if (tag == null)
            {
                throw new ArgumentNullException(nameof(tag));
            }
            if (parentTagPrefix == null)
            {
                throw new ArgumentNullException(nameof(parentTagPrefix));
            }

            ParentContainer = parent;
            Tag             = tag.Replace("\\", "-");
            ParentTagPrefix = parentTagPrefix;

            ParentContainer.SettingChanging += ParentContainer_SettingChanging;
            ParentContainer.SettingChanged  += ParentContainer_SettingChanged;
        }
Esempio n. 5
0
        private static string SettingsToText(ISettingsContainer settings)
        {
            var lines = settings.KeyValuePairs.ToList().ConvertAll(pair => pair.Key + "=" + pair.Value.Value);

            lines.Sort();
            return(string.Join("\n", lines));
        }
Esempio n. 6
0
        public static IUnityContainer ConfigureUnity(ISettingsContainer settingsContainer, ITracer tracer)
        {
            IUnityContainer container      = new UnityContainer();
            var             massProcessors = new IMassProcessor[]
            {
                new TaskServiceJobsMassProcessor(container),
            };
            var storageSettings = settingsContainer.AsSettings <ISqlStoreSettingsAspect>();

            var connectionStringSettings = settingsContainer.AsSettings <IConnectionStringSettings>();
            var environmentSettings      = settingsContainer.AsSettings <IEnvironmentSettings>();

            container.AttachQueryableContainerExtension()
            .UseParameterResolvers(ParameterResolvers.Defaults)
            .ConfigureMetadata()
            .ConfigureSettingsAspects(settingsContainer)
            .ConfigureTracing(tracer)
            .ConfigureSecurityAspects()
            .ConfigureQuartz()
            .ConfigureOperationsProcessing(connectionStringSettings, environmentSettings)
            .ConfigureStorage(storageSettings, EntryPointSpecificLifetimeManagerFactory)
            .ConfigureReplication(EntryPointSpecificLifetimeManagerFactory);

            ReplicationRoot.Instance.PerformTypesMassProcessing(massProcessors, true, typeof(object));

            LinqToDB.Common.Configuration.Linq.OptimizeJoins = false;

            return(container);
        }
Esempio n. 7
0
        public WithBackupSettingsFileExpoter(
            string targetFilePath,
            string tempFilePath,
            ISettingsContainer container,
            ISettingsSerializer serializer)
        {
            if (targetFilePath == null)
            {
                throw new ArgumentNullException(nameof(targetFilePath));
            }
            if (tempFilePath == null)
            {
                throw new ArgumentNullException(nameof(tempFilePath));
            }
            if (container == null)
            {
                throw new ArgumentNullException(nameof(container));
            }
            if (serializer == null)
            {
                throw new ArgumentNullException(nameof(serializer));
            }

            TargetFilePath = targetFilePath;
            TempFilePath   = tempFilePath;
            Container      = container;
            Serializer     = serializer;
        }
Esempio n. 8
0
        public void Serialize(Stream stream, ISettingsContainer container)
        {
            var serializationInfoArray = container.Settings
                                         .Select(SerializeKeyValuePair)
                                         .ToArray();
            var serializer = new DataContractSerializer(typeof(KeyValueSerializationInfo[]));

            serializer.WriteObject(stream, serializationInfoArray);
        }
 public LibraryContainer(IAuthorContainer authors, IBookContainer books, ICategoryContainer categories, IUserContainer users, IBorrowedContainer borrowed, ISettingsContainer settings)
 {
     this.authors    = authors;
     this.books      = books;
     this.categories = categories;
     this.users      = users;
     this.borrowed   = borrowed;
     this.settings   = settings;
 }
Esempio n. 10
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="settingsContainer">設定インスタンス</param>
 /// <param name="dispatcher">ディスパッチャ</param>
 protected SettingsBase(
     ISettingsContainer settingsContainer,
     IDispatcher dispatcher = null)
     : base(dispatcher)
 {
     this.SettingsContainer = settingsContainer ?? throw new ArgumentNullException(nameof(settingsContainer));
     this.SettingsContainer.SettingChanging += this.SettingsContainer_SettingChanging;
     this.SettingsContainer.SettingChanged  += this.SettingsContainer_SettingChanged;
 }
        private void LoadControllerSettings()
        {
            Settings = new SettingsContainer(StoragePath.WithFilename("Settings.json"));

            Settings.SetValue("Name", "HA4IoT Controller");
            Settings.SetValue("Description", "The HA4IoT controller which is responsible for this house.");

            Settings.Load();
        }
Esempio n. 12
0
        public SettingsViewModel(ISettingsContainer settingsContainer)
        {
            this.Latitude  = "undefined";
            this.Longitude = "undefined";

            this._settingsContainer = settingsContainer;
            this._settingsContainer.LocationChanged += this.OnLocationChanged;

            this.Title = "Settings";
        }
Esempio n. 13
0
        public AreaSettingsWrapper(ISettingsContainer settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            Settings = settings;
            Settings.SetValue("appSettings", new JsonObject());
        }
Esempio n. 14
0
 public EventsViewModel(INavigator navigator, IEventService service, IDataService localDataService, ISettingsContainer settingsContainer)
 {
     this._navigator         = navigator;
     this._service           = service;
     this._localDataService  = localDataService;
     this._settingsContainer = settingsContainer;
     this.LocalEvents        = this._localDataService.GetItems <Event>();
     this.Title      = "Events";
     this._hasEvents = true;
     this._settingsContainer.LocationChanged += this._settingsContainer_LocationChanged;
 }
Esempio n. 15
0
        public static IUnityContainer ConfigureUnity(ISettingsContainer settingsContainer)
        {
            var container = new UnityContainer()
                            .ConfigureSettingsAspects(settingsContainer)
                            .ConfigureMetadata()
                            .ConfigureStoreModel()
                            .ConfigureWebApiOData()
                            .ConfigureTracer(settingsContainer.AsSettings <IEnvironmentSettings>(), settingsContainer.AsSettings <IConnectionStringSettings>())
                            .ConfigureWebApiTracer();

            return(container);
        }
Esempio n. 16
0
        public static IUnityContainer ConfigureUnity(ISettingsContainer settingsContainer)
        {
            var container = new UnityContainer()
                            .ConfigureTracer(settingsContainer.AsSettings <IEnvironmentSettings>(), settingsContainer.AsSettings <IConnectionStringSettings>())
                            .ConfigureSettingsAspects(settingsContainer)
                            .ConfigureMetadata()
                            .ConfigureEdmModels()
                            .ConfigureStorage(EntryPointSpecificLifetimeManagerFactory)
                            .ConfigureWebApiOData();

            return(container);
        }
        public ComponentSettingsWrapper(ISettingsContainer settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            Settings = settings;

            IsEnabled = true;
            Settings.SetValue("appSettings", new JsonObject());
        }
        public static IUnityContainer ConfigureUnity(ISettingsContainer settingsContainer)
        {
            var container = new UnityContainer()
                .ConfigureTracer(settingsContainer.AsSettings<IEnvironmentSettings>(), settingsContainer.AsSettings<IConnectionStringSettings>())
                .ConfigureSettingsAspects(settingsContainer)
                .ConfigureMetadata()
                .ConfigureEdmModels()
                .ConfigureStorage(EntryPointSpecificLifetimeManagerFactory)
                .ConfigureWebApiOData();

            return container;
        }
Esempio n. 19
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="container">Instance of ISettingsContainer</param>
        /// <param name="dispatcher">Dispatcher to associate</param>
        protected SettingsBase(
            ISettingsContainer container,
            IDispatcher dispatcher = null)
            : base(dispatcher)
        {
            if (container == null)
            {
                throw new ArgumentNullException("settings");
            }

            Container = container;
            Container.SettingChanged += Container_SettingChanged;
        }
        public RollerShutterAutomationSettingsWrapper(ISettingsContainer settings)
            : base(settings)
        {
            SkipBeforeTimestampIsEnabled = false;
            SkipBeforeTimestamp          = TimeSpan.Parse("07:15");

            AutoCloseIfTooHotIsEnabled  = false;
            AutoCloseIfTooHotTemperaure = 25;

            SkipIfFrozenIsEnabled   = false;
            SkipIfFrozenTemperature = 2;

            OpenOnSunriseOffset = TimeSpan.FromMinutes(-30);
            CloseOnSunsetOffset = TimeSpan.FromMinutes(30);
        }
Esempio n. 21
0
 private static bool TryStoreSettings(ISettingsContainer settings, string file)
 {
     lock (settingsFileLock)
     {
         try
         {
             File.WriteAllText(file, SettingsToText(settings), Encoding.UTF8);
             return(true);
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
Esempio n. 22
0
 private static void TextToSettings(string text, ISettingsContainer settings)
 {
     using (StringReader reader = new StringReader(text))
     {
         string line;
         while ((line = reader.ReadLine()) != null)
         {
             var pair = line.Split(new char[] { '=' }, 2);
             if (pair.Length == 2)
             {
                 settings.SetValue(pair[0], pair[1]);
             }
         }
     }
 }
Esempio n. 23
0
        public void Deserialize(Stream stream, ISettingsContainer container)
        {
            var serializer             = new DataContractSerializer(typeof(KeyValueSerializationInfo[]));
            var serializationInfoArray = (KeyValueSerializationInfo[])serializer.ReadObject(stream);

            container.Clear();

            if (serializationInfoArray != null)
            {
                var settings = serializationInfoArray.Select(DeserializeKeyValuePair);
                foreach (var setting in settings)
                {
                    container.Set(setting.Key, setting.Value);
                }
            }
        }
        public SettingsContainerApiDispatcher(ISettingsContainer settingsContainer, string relativeUri, IApiController apiController)
        {
            if (settingsContainer == null)
            {
                throw new ArgumentNullException(nameof(settingsContainer));
            }
            if (relativeUri == null)
            {
                throw new ArgumentNullException(nameof(relativeUri));
            }
            if (apiController == null)
            {
                throw new ArgumentNullException(nameof(apiController));
            }

            _settingsContainer = settingsContainer;
            _apiController     = apiController;

            _relativeUri = relativeUri;
        }
Esempio n. 25
0
 public void Initialize()
 {
     authors    = new AuthorContainer(new List <IAuthor>());
     books      = new BookContainer(new List <IBook>());
     categories = new CategoryContainer(new List <string>());
     users      = new UserContainer(new List <IUser>());
     borrowed   = new BorrowedContainer(new List <IBookBorrowed>());
     settings   = new SettingsContainer(new Settings());
     try
     {
         authors.UpdateSerializedData();
         books.UpdateSerializedData();
         categories.UpdateSerializedData();
         users.UpdateSerializedData();
         borrowed.UpdateSerializedData();
         settings.UpdateSerializedData();
     }
     catch
     {
     }
 }
Esempio n. 26
0
 /// <summary>
 /// Register a settings container
 /// </summary>
 /// <param name="settingsContainer">The settings container</param>
 private void Add(ISettingsContainer settingsContainer)
 {
     _containers.Add(settingsContainer);
 }
Esempio n. 27
0
 /// <summary>
 /// Sets the parent setting object, which is accessed when a setting is not found in the dictionary.
 /// </summary>
 /// <param name="parent"></param>
 public void SetParent(ISettingsContainer parent)
 {
     parentSettingsContainer = parent;
 }
Esempio n. 28
0
 public Settings(ISettingsContainer settings)
     : base(settings)
 {
 }
Esempio n. 29
0
 public RollerShutterSettingsWrapper(ISettingsContainer settings)
     : base(settings)
 {
     MaxPosition    = 20000;
     AutoOffTimeout = TimeSpan.FromSeconds(22);
 }
Esempio n. 30
0
 public ProxySettingsContainer(
     ISettingsContainer parent,
     string tag)
     : this(parent, tag, parent.Tag)
 {
 }
 public SendMailAction(ISettingsContainer settings)
 {
     _settings = settings;
 }
Esempio n. 32
0
 public ButtonSettingsWrapper(ISettingsContainer settings)
     : base(settings)
 {
     PressedLongDuration = TimeSpan.FromSeconds(1.5);
 }
Esempio n. 33
0
        public static IUnityContainer ConfigureUnity(ISettingsContainer settingsContainer, ITracer tracer, ITracerContextManager tracerContextManager)
        {
            IUnityContainer container = new UnityContainer();
            var massProcessors = new IMassProcessor[]
                                 {
                                     new TaskServiceJobsMassProcessor(container),
                                 };
            var storageSettings = settingsContainer.AsSettings<ISqlStoreSettingsAspect>();

            container.RegisterContexts()
                     .AttachQueryableContainerExtension()
                     .UseParameterResolvers(ParameterResolvers.Defaults)
                     .ConfigureMetadata()
                     .ConfigureSettingsAspects(settingsContainer)
                     .ConfigureTracing(tracer, tracerContextManager)
                     .ConfigureSecurityAspects()
                     .ConfigureQuartz()
                     .ConfigureIdentityInfrastructure()
                     .ConfigureWcf()
                     .ConfigureOperationsProcessing()
                     .ConfigureStorage(storageSettings, EntryPointSpecificLifetimeManagerFactory)
                     .ConfigureReplication(EntryPointSpecificLifetimeManagerFactory);

            ReplicationRoot.Instance.PerformTypesMassProcessing(massProcessors, true, typeof(object));

            return container;
        }
Esempio n. 34
0
        public static IUnityContainer ConfigureUnity(ISettingsContainer settingsContainer)
        {
            var container = new UnityContainer()
                .ConfigureSettingsAspects(settingsContainer)
                .ConfigureMetadata()
                .ConfigureStoreModel()
                .ConfigureWebApiOData()
                .ConfigureTracer(settingsContainer.AsSettings<IEnvironmentSettings>(), settingsContainer.AsSettings<IConnectionStringSettings>())
                .ConfigureWebApiTracer();

            return container;
        }
 public TurnOnAndOffAutomationSettingsWrapper(ISettingsContainer settingsContainer)
     : base(settingsContainer)
 {
     Duration = TimeSpan.FromSeconds(60);
 }