-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
[Feature request] Allow interface inheritance to extend service #62
Comments
I was a bout to post a bout this issue too ! I'm happy to see im not alone in needing this:) |
Since the library's code checks the Attribute by name you could implement your own ServiceContractAttribute class and enable inheritance. I tested it while trying to make it work in Unity3D since for some reason I couldn't import the required dll. |
@TieSKey Not that simple I'm afraid. Nevertheless, I was able to fork it and make it work for me by adding few lines in ProxyEmitter:
and ServerBinder:
I wonder if this kind of functionality could be baked in, perhaps as opt-in via attribute. |
+1 for this, this would help cut down a lot on duplicate code |
Sorry for quick bump, but I would like to know if that it's something that might be explored in the future. This library seems perfect for my usage as it allows for easy DataAnnotations interceptor validation on both Server side and Blazor WASM (as you cannot easily add attributes to messages generated from standard GRPC lib). I'm currently using version 1.0.22 with mentioned above changes that allow for very simple inheritance (I'm aware that all services in "inheritance chain" will be propagated to the topmost service, but that's still better than nothing for my use case) and it's working quite fine. However I would like to know if that kind of inheritance might be included in the future releases in order to make sure that I can avoid patching every single release to enable it. |
@mateusz-pietrzak yes, I think we'll definitely get something along these lines into the lib; I just need to find time to think through all the edges and corners here, etc |
Any updates on this? |
This is supported via |
Would it be possible to have [ServiceContract] interface inherit another generic interface in order to reduce code duplication for simple CRUD services and allow generic reusage in components? Based on this example:
If interface that service marked with [ServiceContract] inherits (in this case IDataService) does not implement [ServiceContract] then it's methods could be incorporated into outmost service (ITestDataService) with it's address (in this case MyApp.TestDataService). Alternatively introduce new attribute, something like [ServiceContractExtension] which would allow this functionality without breaking the way it works at the moment. Currently those methods would raise NotSupportedException since IDataService is not marked with [ServiceContract].
The text was updated successfully, but these errors were encountered: