I'm making a gateway for a client project to consume microservices. In this gateway, the way the client will consume the application is through an interface. The implementation of this interface will be created dynamically (at compile time). So I need to know how to inject the dynamically generated class dependency. Example:
[MicroServiceHost("MsProduct")]
public interface IProductService
{
[MicroService("GetAllProducts")]
IRestResponse GetAllProducts(List<KeyValuePair<object, object>> parameters = null);
[MicroService("AddProduct")]
IRestResponse AddProduct(List<KeyValuePair<object, object>> parameters = null);
}
public class MsProductController : Controller
{
IProductService _productService;
public MsProductController(IProductService productService)
{
_productService = productService;
}
public ActionResult GetAll()
{
var request = _productService.GetAllProducts();
var r = request.Content;
return View();
}
}