Currently my web app uses unity IoC. I am trying to use Unity to register all my dependencies that the Identityserver needs for my custom userservice. I am also hosting the identityserver in the same web application.
Asked
Active
Viewed 476 times
1 Answers
1
I was able with ServiceLocator
In Startup.cs
app.Map("/identity", idsrvApp =>
{
var factory = InMemoryFactory.Create(
clients: Clients.Get(),
scopes: StandardScopes.All);
factory.UserService = new Registration<IUserService>(resolver => Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance<IUserService>());
And In my Unity config
container.RegisterType<IUserService, LocalRegistrationUserService>();
And In My custom User service
public class LocalRegistrationUserService : IUserService
{
IUser userBusiness;
public LocalRegistrationUserService(IUser userBusiness)
{
this.userBusiness = userBusiness;
}

Unik
- 11
- 1