As a workaround, you can define your service this way:

public class AccountService : Account.AccountBase
   {
       private readonly IServiceProvider _provider;
       private readonly IServiceScopeFactory _scopeFactory;

        public AccountService(IServiceProvider provider)
       {
           _provider = provider;
           _scopeFactory = _provider.GetRequiredService<IServiceScopeFactory
>();
       }

        public override Task<Empty> DisableAccount(DisableAccountRequest 
request, ServerCallContext context)
       {
           using (var scope = _scopeFactory.CreateScope())
           {
               // resolve your services here
           }
       }
   }



在 2015年8月1日星期六 UTC+8上午5:08:44,Rob Cecil写道:
>
> Been looking through this:
>
> https://github.com/grpc/grpc/tree/master/src/csharp
>
> And I wonder how people are actually managing/hosting their gRPC services?
>
> Thanks!
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/1868f9d9-6a7f-452c-a556-3bb9962a8b90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to