Exemplo 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;
        }
Exemplo n.º 3
0
 public WithBackupSettingsFileExpoter(
     string targetFilePath,
     ISettingsContainer container,
     ISettingsSerializer serializer)
     : this(targetFilePath, targetFilePath + ".bak", container, serializer)
 {
 }
Exemplo 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;
        }
Exemplo 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));
        }
Exemplo 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);
        }
Exemplo 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;
        }
Exemplo 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);
        }
Exemplo n.º 9
0
 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;
 }
Exemplo 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;
 }
Exemplo n.º 11
0
        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();
        }
Exemplo n.º 12
0
        public SettingsViewModel(ISettingsContainer settingsContainer)
        {
            this.Latitude  = "undefined";
            this.Longitude = "undefined";

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

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

            Settings = settings;
            Settings.SetValue("appSettings", new JsonObject());
        }
Exemplo 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;
 }
Exemplo 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);
        }
Exemplo 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;
        }
Exemplo 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);
        }
Exemplo 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);
         }
     }
 }
Exemplo 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]);
             }
         }
     }
 }
Exemplo 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;
        }
Exemplo 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
     {
     }
 }
Exemplo n.º 26
0
 /// <summary>
 /// Register a settings container
 /// </summary>
 /// <param name="settingsContainer">The settings container</param>
 private void Add(ISettingsContainer settingsContainer)
 {
     _containers.Add(settingsContainer);
 }
Exemplo 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;
 }
Exemplo n.º 28
0
 public Settings(ISettingsContainer settings)
     : base(settings)
 {
 }
Exemplo n.º 29
0
 public RollerShutterSettingsWrapper(ISettingsContainer settings)
     : base(settings)
 {
     MaxPosition    = 20000;
     AutoOffTimeout = TimeSpan.FromSeconds(22);
 }
Exemplo n.º 30
0
 public ProxySettingsContainer(
     ISettingsContainer parent,
     string tag)
     : this(parent, tag, parent.Tag)
 {
 }
 public SendMailAction(ISettingsContainer settings)
 {
     _settings = settings;
 }
Exemplo n.º 32
0
 public ButtonSettingsWrapper(ISettingsContainer settings)
     : base(settings)
 {
     PressedLongDuration = TimeSpan.FromSeconds(1.5);
 }
Exemplo 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;
        }
Exemplo 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);
 }