Example #1
0
        /// <summary>
        /// Writes the main content of the model to JSON (asynchronous way).
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="rwOptions">The read/write options.</param>
        /// <param name="ct">The cancellation token</param>
        /// <returns>Task.</returns>
        protected virtual async Task WriteContentToJsonAsync(JsonWriter writer, BitOptions rwOptions, CancellationToken ct)
        {
            // Editors must be saved before operators
            if (rwOptions.Contains(MetaDataReadWriteOptions.Editors))
            {
                await writer.WritePropertyNameAsync("editors", ct).ConfigureAwait(false);

                await Editors.WriteToJsonAsync(writer, rwOptions, true, ct).ConfigureAwait(false);
            }

            if (rwOptions.Contains(MetaDataReadWriteOptions.Entities))
            {
                await writer.WritePropertyNameAsync("maxAttrId", ct).ConfigureAwait(false);

                await writer.WriteValueAsync(_maxEntAttrId, ct).ConfigureAwait(false);

                await writer.WritePropertyNameAsync("entroot", ct).ConfigureAwait(false);

                await EntityRoot.WriteToJsonAsync(writer, rwOptions, ct).ConfigureAwait(false);
            }
        }