Replies: 2 comments 2 replies
-
I don't believe you need to/should even add the grain to IServiceCollection, as each grain has a primary key and theres no way to specify that primary key without using some kind of custom resolver. The orleans way is to get the grain from the IGrainFactory or IClusterClient. As far as your application parts, it appears correct however you do have both duplicate assembly referenced for MyUserGrain and IMyUserGrain, not sure if Orleans filters out additional ones. You can also add parts from app domain
|
Beta Was this translation helpful? Give feedback.
-
application parts does not exist in leates version of Orleans.Runtime 3.7.2 |
Beta Was this translation helpful? Give feedback.
-
I want to be able to have a base grain class in one assembly and subclass it in another.
For example, let's say there is shared assembly with the following:
In another project I want to extend this grain to do more things.
There is other code in the shared assembly that needs to reference the IUserGrain interface, and code in my assembly that needs to reference the IMyUserGrain interface to access the additional functionality, but I obviously want them to reach the same underlying Grain.
Using dependency injection I would do something like:
Through much trial and error I have found a way that seems to work. By hiding the base class grain in a separate assembly and only including the base interfaces (in their own assembly):
However I am unsure if this will create one or two instances of MyUserGrain - if there are two it's a bit of a non-starter.
Does anyone know if this approach is valid, and if there is a better way that is more aligned with the IServiceCollection approach?
Beta Was this translation helpful? Give feedback.
All reactions