Service Fabric 远程处理到 WebApi
Service Fabric Remoting to WebApi
我们是 运行 几个无状态可靠服务,在使用反向代理的服务到服务通信方面存在性能问题 (http://localhost:19081/{app}/{svc}/bleh). Without getting into the details there, we are looking into using remoting as described here: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-remoting
但是,我很难弄清楚如何在服务类型 class 中公开 API 方法,因为它们目前存在于我们的控制器中。控制器通过依赖项注入获取所需的存储库实例等...,因此我正在研究如何在没有某种冗余实例或循环依赖的情况下完成此操作。
我在 "PersonService.cs" 上坐在这里盯着看:
internal sealed class PersonService: StatelessService, IPersonService
{
public PersonService(StatelessServiceContext context)
: base(context)
{ }
...
public PersonResponse GetPersonFromDb()
{
//lost here :(
}
我的控制器运行良好,其中有:
public PersonController(IPersonRepository personRepository)
{
_personRepository = personRepository;
}
...
public IActionResult GetPerson()
{
var personResponse = _dbRepository.GetPerson();
return new ObjectResult(personResponse);
}
D:
你不能将存储库传递给你的服务,类似于此吗?
public PersonService(StatelessServiceContext context, IPersonRepository personRepository)
: base(context)
{
_personRepository = personRepository;
}
public PersonResponse GetPersonFromDb()
{
var personResponse = _personRepository.GetPerson();
return personResponse;
}
我们是 运行 几个无状态可靠服务,在使用反向代理的服务到服务通信方面存在性能问题 (http://localhost:19081/{app}/{svc}/bleh). Without getting into the details there, we are looking into using remoting as described here: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-remoting
但是,我很难弄清楚如何在服务类型 class 中公开 API 方法,因为它们目前存在于我们的控制器中。控制器通过依赖项注入获取所需的存储库实例等...,因此我正在研究如何在没有某种冗余实例或循环依赖的情况下完成此操作。
我在 "PersonService.cs" 上坐在这里盯着看:
internal sealed class PersonService: StatelessService, IPersonService
{
public PersonService(StatelessServiceContext context)
: base(context)
{ }
...
public PersonResponse GetPersonFromDb()
{
//lost here :(
}
我的控制器运行良好,其中有:
public PersonController(IPersonRepository personRepository)
{
_personRepository = personRepository;
}
...
public IActionResult GetPerson()
{
var personResponse = _dbRepository.GetPerson();
return new ObjectResult(personResponse);
}
D:
你不能将存储库传递给你的服务,类似于此吗?
public PersonService(StatelessServiceContext context, IPersonRepository personRepository)
: base(context)
{
_personRepository = personRepository;
}
public PersonResponse GetPersonFromDb()
{
var personResponse = _personRepository.GetPerson();
return personResponse;
}