Add support for projectable method overloads
If I try to define 2+ projectable methods with the same name on the same class but give them different argument lists, then the source generator triggers an error indicating that classes with the same name cannot be provided by the same source generator. It appears this is because the class name is generated via the namespace+class+method. Would it be difficult/problematic to expand this so that the generated class names also include the number and type of the arguments? For example...
namespace MyNamespace
{
class MyClass
{
[Projectable] public MyImage? FindImage(DbContext db, int id) => db.Set<MyImage>().Where(m => true);
[Projectable] public MyImage? FindImage(DbContext db, Uri uri) => db.Set<MyImage>().Where(m => true);
[Projectable] public MyImage? FindImage(DbContext db, Uri folder, string tagName) => db.Set<MyImage>().Where(m => true);
}
}
EntityFrameworkCore.Projectables.Generated.MyNamespace_MyClass_FindImage_P1_System_Int32EntityFrameworkCore.Projectables.Generated.MyNamespace_MyClass_FindImage_P1_System_UriEntityFrameworkCore.Projectables.Generated.MyNamespace_MyClass_FindImage_P1_System_Uri_P2_System_String
It's important to note that this is more of a nice-to-have. I attempted to do method overloads and ran into this error, after which I had to work around it by using a naming convention like, FindImageById, FindImageByUri, FindImageByFolderAndTag, etc. It did not significantly impact my ability to use this library, but it was something I wanted to do and which I was disappointed to discover I could not do. However, I can understand if one would not wish to work on adding it as a feature.
Thanks for suggesting this, I agree that this should be supported and the suggested approach sounds fair.
For now a helpful error would probably be a good patch. I didn't realize this limitation and was hitting my head against a wall on this for ages. When I added overloaded methods every query would start failing as their projectables couldn't be resolved.
Turns out it was because of a newly added overload!!