Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derivation of Category name / StreamPrefix is broken #11

Open
bartelink opened this issue Oct 14, 2021 · 0 comments
Open

Derivation of Category name / StreamPrefix is broken #11

bartelink opened this issue Oct 14, 2021 · 0 comments

Comments

@bartelink
Copy link
Contributor

bartelink commented Oct 14, 2021

The logic in StreamNameMapper.ToStreamPrefix:

public static string ToStreamPrefix(Type streamType) => Instance.typeNameMap.GetOrAdd(streamType, (_) =>
{
var modulePrefix = streamType.Namespace!.Split(".").First();
return $"{modulePrefix}_{streamType.Name}";
});

is problematic at present as it appears to map MyCompany.Domain.Cart to MyCompany_ItemAdded

While I'm not a fan of seeing the naming of events as a global thing in the first instance*, I feel that this code is worse than useless as you'll inevitably end up with multiple MyCompany_Added things if you start from this code, which will conceal the objective of the code

I'd be more than happy to make a PR to remove the prefixing logic, but would settle for any resolution that's more likely to end up with a useful convention as people inevitably paste this code around the world ;)

  • (for me, the event types should be relative to a Category and not even be subject to a global uniqueness constraint within a given store)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant