简体   繁体   English

我可以使用带有实体框架(asp.net mvc)的另一台服务器上的一台服务器上的存储过程吗?

[英]Can I use a stored procedure from one server on another with entity framework (asp.net mvc)?

I am writing an application which connects to multiple servers and queries their settings and inventory information to store in a database on another server. 我正在编写一个连接到多台服务器并查询其设置和清单信息以存储在另一台服务器的数据库中的应用程序。 The number of servers is dynamically changing, but the server that the database information remains on is constant. 服务器的数量是动态变化的,但是数据库信息保留在其上的服务器是恒定的。

I haven't yet figured out how to create a dynamic connection using Entity Framework, but that is another question (although it would be nice to know if that is possible...). 我还没有弄清楚如何使用Entity Framework创建动态连接,但这是另一个问题(尽管很高兴知道这样做是否可行...)。 For obvious security reasons, they look down upon using raw sql strings in code to query a server and would prefer that any queries are done in the form of stored procedures. 出于明显的安全原因,他们看不起在代码中使用原始sql字符串来查询服务器,并且希望任何查询都以存储过程的形式进行。

Once I begin this and maintain a connection between the two servers, I will need to query the server that I have dynamically connected to using a stored procedure that is on the server where the information will be stored. 一旦开始并维持两台服务器之间的连接,我将需要使用存储信息的服务器上的存储过程来查询已动态连接到的服务器。

Is there a way to do this? 有没有办法做到这一点? Or are stored procedures limited to the server that they are placed upon? 还是存储过程仅限于放置它们的服务器?

Linked Server will work. 链接服务器将正常工作。 For more information check out this link: 有关更多信息,请查看此链接:

https://msdn.microsoft.com/en-us/library/ff772782.aspx https://msdn.microsoft.com/zh-CN/library/ff772782.aspx

暂无
暂无

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

相关问题 如何使用实体框架在ASP.NET MVC中调用存储过程 - How to call stored procedure in ASP.NET MVC with Entity Framework 如何使用使用 hash 加密、C#、ASP.NET MVC、实体框架的存储过程验证帐户 - How can I validate an account with a stored procedure that uses hash encryption, C#, ASP.NET MVC, Entity Framework 实体框架和ASP.NET MVC:无法从另一个控制器进入我控制器上的[HttpPost] - Entity Framework & ASP.NET MVC: can't get to the [HttpPost] on my controller from another one ASP.NET MVC4从带有实体框架的存储过程返回输出 - ASP.NET MVC4 return output from a stored procedure with Entity Framework ASP.NET MVC 将参数从 controller 传递到没有实体框架的存储过程 - ASP.NET MVC pass parameter to stored procedure from controller without Entity Framework C#ASP.NET MVC和实体框架6引发错误“找不到存储过程” - C# ASP.NET MVC & Entity Framework 6 throws error “Stored procedure not found” 使用ASP.NET MVC和Entity Framework将通用列表传递给存储过程 - Pass generic list to stored procedure using ASP.NET MVC and Entity Framework ASP.NET MVC DropDownList 通过没有实体框架的存储过程 - ASP.NET MVC DropDownList via stored procedure without Entity Framework 如何使用ASP.NET MVC 3实体框架中的DBContext映射存储过程 - How to map a stored procedure using DBContext in ASP.NET MVC 3 Entity Framework 实体框架 ASP.NET MVC 5 中事务中的存储过程和数据库上下文操作 - Stored Procedure and Database Context Operation in a Transaction in Entity Framework ASP.NET MVC 5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM