问题
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