Skip to main content

DatabaseSettingsFile

A class in Root.Township, Alta.Utilities.

A settings "file" stored through the Alta web API's settings endpoint instead of on disk. Most file operations do nothing.

Constructors​

MemberWhat it is
DatabaseSettingsFile(string name)Creates a DatabaseSettingsFile from name.

Fields​

2 private and internal fields
MemberWhat it is
private Task readingTaskThe API read in progress, or null.
private Task writingTaskThe API write in progress, or null.

Properties​

MemberWhat it is
IAltaFileFormat Content { get; set; }The last content read or to be written.
string FullName { get; }Same as Name, the settings key.
bool HasChanged { get; }Always true.
bool IsExisting { get; }Always true.
bool IsReading { get; private set; }Meant to show a read is running. It's cleared as soon as the read starts, so it's rarely true.
bool IsWriting { get; private set; }True while a write is running.
string Name { get; }The settings key used with the API.

Methods​

MemberWhat it is
void Delete(bool isDeletingBackup = false)Does nothing.
Task DeleteAsync(bool isDeletingBackup = false)Does nothing.
void FinishReading()Blocks until a running read finishes.
void FinishWriting()Blocks until a running write finishes.
void MoveTo(IAltaFolder folder)Does nothing.
void QueueUnload()Does nothing.
Task QueueUnloadAsync()Does nothing.
Task<T> ReadAsync<T>()Fetches the settings text from the API and reads it into a new content object. Empty text leaves it at defaults.
async Task<T> ReadAsync<T>(Func<T> create)Fetches the settings text from the API and reads it into a new content object. Empty text leaves it at defaults.
void Refresh()Does nothing.
void ResetHasChanged()Does nothing.
async void WriteAsync()Writes Content to text and sends it to the API, waiting for any earlier write first.
2 private and internal methods
MemberWhat it is
private async Task<T> ReadInternal<T>(Func<T> create)Fetches the settings text by name from the web API settings client and parses it into a new content object.
private async Task WriteInternal()Serialises the content to text and sends it to the web API settings client under this name.