最好使用两个连接字符串或使用链接服务器

问题描述

我在ASP.NET Core中有一个Web应用程序,当前有两个连接字符串,分别连接到两个不同的服务器。用户将在一个字段中输入一个值,它将查询连接字符串fetch,返回结果,然后添加到连接字符串_context

//my two connection strings are 'fetch' and '_context'
public ActionResult FetchData(string name)
{
    var result = fetch.TAbleName.FirstOrDefault(x => x.Name == name);
    //Here the object is serialized,then deserialized into an entity for my other database,then is added
    _context.Add(result);
    _context.Update();
}

基本上,我使用fetch连接字符串来查询结果,然后使用_context作为实际的站点连接字符串,以使用和添加到视图中的所有内容。我只使用fetch来检索数据并将其导入到_context中。

我的问题是,我应该为此使用两个不同的连接字符串,还是只使用_context并使用链接服务器查询结果?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)