Added documentation
This commit is contained in:
		
							parent
							
								
									b534dfdf85
								
							
						
					
					
						commit
						f7186fd3cc
					
				@ -75,6 +75,9 @@ public sealed class DataContext : DbContext, IDataContext
 | 
				
			|||||||
        IEnumerable<JsonTranslation> Translations
 | 
					        IEnumerable<JsonTranslation> Translations
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// Represents a unique identifier for a JSON export and import.
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
    internal readonly record struct JsonUniqueId(string Code, Guid UniqueId, string Prefix = "")
 | 
					    internal readonly record struct JsonUniqueId(string Code, Guid UniqueId, string Prefix = "")
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public override string ToString() => string.IsNullOrWhiteSpace(this.Prefix) ? $"{this.Code}::{this.UniqueId}" : $"{this.Prefix}::{this.Code}::{this.UniqueId}";
 | 
					        public override string ToString() => string.IsNullOrWhiteSpace(this.Prefix) ? $"{this.Code}::{this.UniqueId}" : $"{this.Prefix}::{this.Code}::{this.UniqueId}";
 | 
				
			||||||
@ -82,6 +85,9 @@ public sealed class DataContext : DbContext, IDataContext
 | 
				
			|||||||
        public static implicit operator string(JsonUniqueId id) => id.ToString();
 | 
					        public static implicit operator string(JsonUniqueId id) => id.ToString();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// A JSON converter to serialize and deserialize JsonUniqueId instances.
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
    private sealed class JsonUniqueIdConverter : JsonConverter<JsonUniqueId>
 | 
					    private sealed class JsonUniqueIdConverter : JsonConverter<JsonUniqueId>
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public override JsonUniqueId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
 | 
					        public override JsonUniqueId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
 | 
				
			||||||
@ -138,6 +144,10 @@ public sealed class DataContext : DbContext, IDataContext
 | 
				
			|||||||
        JsonUniqueId TextElementUniqueId
 | 
					        JsonUniqueId TextElementUniqueId
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    /// <summary>
 | 
				
			||||||
 | 
					    /// Exports this database to a JSON file.
 | 
				
			||||||
 | 
					    /// </summary>
 | 
				
			||||||
 | 
					    /// <param name="path">The path to the JSON file.</param>
 | 
				
			||||||
    public async Task ExportAsync(string path)
 | 
					    public async Task ExportAsync(string path)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        var jsonSettings = new JsonSerializerOptions
 | 
					        var jsonSettings = new JsonSerializerOptions
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user