Table of Contents

Tevent naming

Name tevents by nesting their interfaces: each level is a tevent interface nested in the one above it, and inheriting it.

interface IUserTevent : ITaggregateTevent
{
   internal interface IProfile : IUserTevent
   {
      internal interface IPropertyUpdated : IProfile
      {
         internal interface IName : IPropertyUpdated
         {
            string Name { get; }
         }
      }
   }
}

A subscriber then names exactly the tevent it means, however deep it is:

registrar
  .ForTevent<IUserTevent.IProfile.IPropertyUpdated.IName>(updated => WriteLine($"The profile's name is now {updated.Name}"));

The name says where the tevent belongs: IUserTevent.IProfile.IPropertyUpdated.IName is the name of a user's profile, updated. A flat name such as IUserProfileNamePropertyUpdatedTevent doesn't say it: it could as well be a tevent of a UserProfile taggregate. Nor do namespaces: wherever the IDE shortens a type to its own name, a tevent in User.Tevents.Profile.PropertyUpdated reads as just IName:

registrar.ForTevent<IName>(updated => WriteLine($"The name of something is now {updated}"));

Only the root interface ends in Tevent; the levels below it don't repeat it. They may drop the I as well: IUserTevent.Profile.PropertyUpdated.Name.