.NET 应用程序中的微服务解决方案结构 [英] Microservice solution structure in .NET applications

查看:52
本文介绍了.NET 应用程序中的微服务解决方案结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用微服务方法开发一个应用程序,我很难定义这些微服务在 Visual Studio 项目中的样子.

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.

我最初的方法是为每个微服务创建一个 Visual Studio 解决方案.每个解决方案都会有以下项目:

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

  • 主持人
  • 业务 API
  • 数据访问层
  • 模型
  • 接口(用于 DI)
  • 数据访问模拟
  • 业务 API 测试

所以每个微服务有 7 个项目.不知何故,感觉每个解决方案都在重新实施很多项目.

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

这种方法正确吗?有没有人用 .net 构建过微服务?您的项目配置如何?

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

推荐答案

这是一个非常笼统的问题,但作为指导原则,我建议从小处着手,并仅在必要时进行扩展.

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

那么您需要的最小设置是什么?可能是主机、逻辑(包括业务、模型、DAL 等,它们可以位于不同的文件夹下)和测试.

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

这篇关于.NET 应用程序中的微服务解决方案结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆