Nuget软件包用于微服务中的DBContext
我们的团队正在使用微服务架构。它们都写在C#(和.NET 6)中。我们有一个单一的SQL Server数据库,该数据库在所有服务(共享数据库模式)上共享。
在某些服务中,我们将实体框架用作ORM与DB对话。
当我们更改数据库中的某些内容(我们使用DBUP迁移)时,我们必须手动更新消耗它们的所有微观服务中影响的实体。
为了避免,我们正在评估包装dbContext
及其实体中的nuget软件包,以便可以从任何服务中消费。
我想知道这是否被认为是一种好的实践/方法,并且是否有任何缺点(除了在.NET上没有开发的服务无法消耗包装的事实)。
Our team is working with a micro service architecture. All of them are written in C# (and .NET 6). We have a single SQL Server database, shared across all the services (shared database pattern).
In some of the services we use Entity Framework as ORM to dialog with the db.
When we change something in the database (we use DbUp migrations) we have to manually update the entities affected in all the micro services that consume them.
To avoid that we are evaluating packaging the DbContext
and its entities into a Nuget package so it can be consumed from any service.
I was wondering if this is considered a good practice/approach or not, and if has any drawback (besides the fact that services that are not developed on .NET won't be able to consume the package).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论