Microservice solution structure in .NET applications

百般思念 提交于 2021-02-07 13:19:31

问题


I'm developing an application using the microservices approach, and I'm having a hard time defining how those microservices will look like on a visual studio project.

My initial approach is to create one visual studio solution for every microservice. Every solution will have the following projects:

  • Host
  • Business API
  • Data Access Layer
  • Model
  • Interfaces (for DI)
  • Data Access Mock
  • Tests for Business API

So there are 7 projects per microservice. Somehow it feels a lot of projects being reimplemented for every solution.

Is this approach correct? Has anybody built microservices with .net? How does your projects configuration look like?


回答1:


This is a very general question, but as a guideline I would suggest starting small and minimal, and expanding only if necessity dictates it.

So what is the minimal setup you need? Probably Host, Logic (including business, model, DAL etc., they can be just under different folders) and Tests.

Start from that. See how that works. See if you really need anything more. Learn and iterate. That's part of the mindset you can really use when moving into the microservices way of thinking (and there's some agile connection there...).



来源:https://stackoverflow.com/questions/34909182/microservice-solution-structure-in-net-applications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!