简体   繁体   English

ASP.NET 内核 Web API 应用内多数据库

[英]ASP.NET Core Web API multi database in app

I currently work to develop POS (Point of Sales) based on ASP.NET Core and I am using Entity Framework Core.我目前正在开发基于 ASP.NET 核心的 POS(销售点),我正在使用实体框架核心。

What I need is create separate account for each institution that will be use our POS system at same time create its own database (customer database) dynamically (migration in EFC).我需要为每个将使用我们的 POS 系统的机构创建单独的帐户,同时动态创建自己的数据库(客户数据库)(在 EFC 中迁移)。

Finally when user (or institution) logs in, I have to verify the customer's account and link it with their database.最后,当用户(或机构)登录时,我必须验证客户的帐户并将其与他们的数据库链接。

What is the framework that I need to get this job done?我需要什么框架来完成这项工作?

I had a similar problem with you before, except that my software was connected to distributed database.我之前也遇到过类似的问题,只是我的软件连接到分布式数据库。 In this case, I used the dynamic unit of work and the repository pattern.在这种情况下,我使用了动态工作单元和存储库模式。 Also, to create a connection string for connect to each database, I kept them in another central database, and also in the dynamic unit of work you can create the dynamic repository of each database automatically and connect to the relevant database by receiving the connection string.另外,为了创建连接到每个数据库的连接字符串,我将它们保存在另一个中央数据库中,并且在动态工作单元中,您可以自动创建每个数据库的动态存储库并通过接收连接字符串连接到相关数据库. You can also see the sample here , but you must to change repositroy and unit of work to generic mode.您也可以在此处查看示例,但您必须将存储库和工作单元更改为通用模式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM