abstract event class

Let us say we have an abstract class ExternalDomainEvent and three derived classes ExternalDomainEventA, ExternalDomainEventB, ExternalDomainEventC. I also have a method that returns ExternalDomainEvent where ExternalDomainEvent is either instance of ExternalDomainEventA or ExternalDomainEventB or ExternalDomainEventC.

When I add an instance of ExternalDomainEvent to a stream I seem to lose the information of whether ExternalDomainEvent is an instance of ExternalDomainEventA or ExternalDomainEventB or ExternalDomainEventC.

Is it necessary to add the actual type as meta data or can I obtain the original type during catchup?



Maybe you can put your code? We don't do anything at all with types so
this is definitely in your code :slight_smile:

Thanks. I am currently using this:


more precisely :

public async Task AppendToStreamAsync(string stream, int expectedVersion, params NewEventData[] events)


var url = _endpoint + “/streams/” + stream;

Log.Info(_log, “Appending {0} events to {1}”, events==null?0 :events.Length, stream);

using (var client = GetClient())


var request = new HttpRequestMessage(HttpMethod.Post, url);

request.Content = new StringContent(JsonConvert.SerializeObject(events), Encoding.UTF8, “application/vnd.eventstore.events+json”);

request.Headers.Add(“ES-ExpectedVersion”, expectedVersion.ToString());

var result = await _httpClientProxy.SendAsync(client, request);

if (!result.IsSuccessStatusCode)


Log.Error(_log, “Error appending {0} events to {1}”, events == null ? 0 : events.Length, url);

throw new EventStoreHttpException(result.Content.ToString(), result.ReasonPhrase, result.StatusCode);




Where do you set the event type? Its being passed in

Could you please be so kind and point me in the right direction on how to set this via this http approach?

This isn't our code. It is either set in the body of the http post or
a head from our perspective the library appears to use the body

That said you pass into this function something called neweventdata
which has the event type on it.

You are setting this in the code one level up from the code you sent
(you pass an array of NewEventData to the function you are calling)