C# has a feature called Using alias directives. They allows you do make an alias of a type like this:
using CustomerId = MyComp.MyProject.Core.EntityKey<Customer, int>;
This feature however only works on a per-file basis. I'm looking for a way -any way- to do this project-wide or even solution-wide.
The reason I want to do this is because I want to remove the verbosity of writing things like EntityKey<Customer, int>
, EntityKey<Order, long>
, etc. I like to prevent having to define those aliasses in each file. The EntityKey<TEntity, TKey>
is a struct
, so I can't create derived classes.
No, that does not exist. Aliases are strictly per-file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With