Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Repository{TSetting}"/> class.
 /// Creates a new <see cref="Repository{TSetting}"/> with <paramref name="settings"/>.
 /// </summary>
 /// <param name="serialize">The <see cref="Serialize{TSetting}"/>.</param>
 /// <param name="settings">The <typeparamref name="TSetting"/>.</param>
 protected Repository(TSetting settings, Serialize <TSetting> serialize)
     : this(settings, Backup.Backuper.Create(settings.BackupSettings), serialize)
 {
 }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SingletonRepository{TSetting}"/> class.
 /// Creates a new <see cref="Repository{TSetting}"/> with default settings.
 /// If the directory contains a settings file it is read and used.
 /// If not a new default setting is created and saved.
 /// </summary>
 /// <param name="settingsCreator">Creates settings if file is missing</param>
 /// <param name="backuper">
 /// The backuper.
 /// Note that a custom backuper may not use the backupsettings.
 /// </param>
 /// <param name="serialize">Serialization logic.</param>
 protected SingletonRepository(Func <TSetting> settingsCreator, IBackuper backuper, Serialize <TSetting> serialize)
     : base(settingsCreator, backuper, serialize)
 {
     this.fileCache.Add(this.GetFileInfoCore <TSetting>().FullName, this.Settings);
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SingletonRepository{TSetting}"/> class.
 /// Creates a new <see cref="Repository{TSetting}"/> with <paramref name="settings"/>.
 /// </summary>
 /// <param name="settings">Setting controlling behavior.</param>
 /// <param name="backuper">
 /// The backuper.
 /// Note that a custom backuper may not use the backupsettings.
 /// </param>
 /// <param name="serialize">Serialization logic.</param>
 protected SingletonRepository(TSetting settings, IBackuper backuper, Serialize <TSetting> serialize)
     : base(settings, backuper, serialize)
 {
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataRepository{TSetting}"/> class.
 /// Creates a new <see cref="Repository{TSetting}"/> with default settings.
 /// If the directory contains a settings file it is read and used.
 /// If not a new default setting is created and saved.
 /// </summary>
 /// <param name="settingsCreator">Creates settings if file is missing.</param>
 /// <param name="backuper">
 /// The backuper.
 /// Note that a custom backuper may not use the backupsettings.
 /// </param>
 /// <param name="serialize">Serialization logic.</param>
 protected DataRepository(Func <TSetting> settingsCreator, IBackuper backuper, Serialize <TSetting> serialize)
     : base(settingsCreator, backuper, serialize)
 {
 }