Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microservice solution structure in .NET applications

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?

like image 523
Mat-Tap Avatar asked Jan 20 '16 19:01

Mat-Tap


People also ask

Can .net be used for microservices?

ASP.NET comes with built-in support for developing and deploying your microservices using Docker containers. . NET includes APIs to easily consume microservices from any application you build, including mobile, desktop, games, web, and more.

What is microservices in .NET C#?

Microservices are small, modular, and independently deployable services. Docker containers (for Linux and Windows) simplify deployment and testing by bundling a service and its dependencies into a single unit, which is then run in an isolated environment.


1 Answers

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...).

like image 196
Rotem Hermon Avatar answered Oct 20 '22 02:10

Rotem Hermon