I want to preserve the DI abstraction layer Kephas provides, but in my particular case I need to register a service which is imported from a third-party library. Given this, I cannot annotate the service with the [AppServiceContract] attribute required for service registration. Is there a way to achieve this?
How can I register services in Kephas using a fluent API?
19 views Asked by Auguste Leroi At
1
Yes there is. Here are the steps to follow:
IConventionsRegistrar.Sample code:
There is a second way of registering services, however by the means of service descriptors instead of a fluent API. For this case, follow the steps:
IAppServiceInfoProvider.Sample code with the same registrations as above:
Both cases are autodiscovered and, at the proper time, the registration methods are called. However, in the second case, the advantage is that the registrations are available as service metadata for querying at a later time.