public interface IRequestContext #5437
-
hi @volkanceylan in NET5 version of serenity.services can you make IRequestContext as partial interface.? so that we can add / inject any additional properties/services by extending Serenity.Services.ServiceEndpoint, that are required by application to pass through service endpoints to repositories. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You can write your own interface what inherited from IRequestContext. Then inject this as IRequestContext with your class what implement this interface. Where do you need to use your extra properties, cast your IRequestContext to your custom one and use. Or create base ServiceEndpoint for all of your endpoints then cast this IRequestContext to your custom context and set it to a property for use. Also you can override this property with new keyword and your custom interface. Partial classes are merged to one class when compiled. Interfaces are works as same. If we ship the nuget with partial interface, It will converted to standart interface and you can't use benefits of it.
|
Beta Was this translation helpful? Give feedback.
You can write your own interface what inherited from IRequestContext. Then inject this as IRequestContext with your class what implement this interface. Where do you need to use your extra properties, cast your IRequestContext to your custom one and use. Or create base ServiceEndpoint for all of your endpoints then cast this IRequestContext to your custom context and set it to a property for use. Also you can override this property with new keyword and your custom interface.
Partial classes are merged to one class when compiled. Interfaces are works as same. If we ship the nuget with partial interface, It will converted to standart interface and you can't use benefits of it.