public override async Task Invoke(IOwinContext context)
 {
     if (context.Request.Path == "/random")
     {
         IOwinDependencyScope dependencyScope = context.GetRequestDependencyScope();
         IRepository          repository      = dependencyScope.GetService(typeof(IRepository)) as IRepository;
         await context.Response.WriteAsync(repository.GetRandomText());
     }
     else
     {
         await Next.Invoke(context);
     }
 }
예제 #2
0
 public object GetService(Type serviceType)
 {
     return(_owinDependencyScope.GetService(serviceType));
 }