예제 #1
0
 /// <summary>
 /// Creates a new <see cref="ResourceEventDefinition{TResource, TDomain}" /> with a change type
 /// of <see cref="ResourceEventChangeType.Deleted" /> and an event sub id of <c>deleted</c>.
 /// </summary>
 /// <returns>A new resource event definition.</returns>
 public ResourceEventDefinition <TResource> Deleted()
 {
     return(new ResourceEventDefinition <TResource>(
                ResourceEventChangeType.Deleted,
                ResourceEvent <TResource> .CreateId("deleted"),
                this._mapper));
 }
예제 #2
0
 /// <summary>
 /// Creates a new <see cref="ResourceEventDefinition{TResource, TDomain}" /> with a change type
 /// of <see cref="ResourceEventChangeType.Updated" /> and the given event sub id.
 /// </summary>
 /// <param name="eventSubId">The "sub" ID, unique within a resource's event namespace.</param>
 /// <returns>A new resource event definition.</returns>
 public ResourceEventDefinition <TResource> Updated(string eventSubId)
 {
     return(new ResourceEventDefinition <TResource>(
                ResourceEventChangeType.Updated,
                ResourceEvent <TResource> .CreateId(eventSubId),
                this._mapper));
 }
예제 #3
0
        public override void Write(Utf8JsonWriter writer, ResourceEvent <T> value, JsonSerializerOptions options)
        {
            writer.WriteStartObject();

            writer.WriteString(_object, value.Object);
            writer.WriteString(_eventId, value.EventId);
            writer.WriteString(_changeType, value.ChangeType.ToString());
            writer.WriteString(_created, value.Created);
            writer.WriteString(_resourceObject, value.ResourceObject);

            if (value.Href != null)
            {
                writer.WriteString(_href, value.Href);
            }

            if (value.CorrelationId != null)
            {
                writer.WritePropertyName(_correlationId);
                JsonSerializer.Serialize(writer, value.CorrelationId, options);
            }

            if (value.Data != null)
            {
                writer.WritePropertyName(_data);
                JsonSerializer.Serialize(writer, value.Data, options);
            }

            if (value.ChangedValues != null)
            {
                writer.WritePropertyName(_changedValues);
                JsonSerializer.Serialize(writer, value.ChangedValues, options);
            }

            if (value.Metadata != null)
            {
                writer.WritePropertyName(_metadata);
                JsonSerializer.Serialize(writer, value.Metadata, options);
            }

            if (value.SecureData != null)
            {
                writer.WritePropertyName(_secureData);
                JsonSerializer.Serialize(writer, value.SecureData, options);
            }

            writer.WriteEndObject();
        }
예제 #4
0
 public Task AddAsync(ResourceEvent resourceEvent)
 {
     return(Task.CompletedTask);
 }
예제 #5
0
 private static void ReadValue(ref Utf8JsonReader reader, ResourceEvent <T> value, JsonSerializerOptions options)
 {
     if (TryReadStringProperty(ref reader, _eventId, out var propertyValue))
     {
         value.EventId = propertyValue;
     }
예제 #6
0
 /// <summary>
 /// Creates a new <see cref="ResourceEventDefinitionWithMapper{TResource, TDomain}" /> with a change type
 /// of <see cref="ResourceEventChangeType.Deleted" /> and the given event sub id.
 /// </summary>
 /// <param name="eventSubId">The "sub" ID, unique within a resource's event namespace.</param>
 /// <returns>A new resource event definition.</returns>
 public TReturn Deleted(string eventSubId)
 {
     return(this.Create(
                ResourceEventChangeType.Deleted,
                ResourceEvent <TResource> .CreateId(eventSubId)));
 }
예제 #7
0
 /// <summary>
 /// Creates a new <see cref="ResourceEventDefinitionWithMapper{TResource, TDomain}" /> with a change type
 /// of <see cref="ResourceEventChangeType.Deleted" /> and an event sub id of <c>deleted</c>.
 /// </summary>
 /// <returns>A new resource event definition.</returns>
 public TReturn Deleted()
 {
     return(this.Create(
                ResourceEventChangeType.Deleted,
                ResourceEvent <TResource> .CreateId("deleted")));
 }
예제 #8
0
 /// <summary>
 /// Creates a new <see cref="ResourceEventDefinitionWithMapper{TResource, TDomain}" /> with a change type
 /// of <see cref="ResourceEventChangeType.Updated" /> and an event sub id of <c>updated</c>.
 /// </summary>
 /// <returns>A new resource event definition.</returns>
 public TReturn Updated()
 {
     return(this.Create(
                ResourceEventChangeType.Updated,
                ResourceEvent <TResource> .CreateId("updated")));
 }