C# MVC 模型视图连接 2 个不同的数据库列

问题描述

这是我第一次尝试将信息从一个数据库连接到另一个数据库我有一个会计数据库一个常规站点数据库。试图将它们分开。我有一个显示交易的页面,但我正在通过 Id 从常规数据库获取一些列的信息。下面是我的模型。我没有在其他数据库中的项目的字段中显示任何内容

    public class Transaction
{
    [Key]
    public Guid TransactionId { get; set; }
    public string Description { get; set; }
    public int? CompanyId { get; set; }
    public Guid? vendorId { get; set; }
    public string InCheckNumber { get; set; }
    public string OutCheckNumber { get; set; }
    public string InvoiceNumber { get; set; }
    public string PurchaSEOrderNumber { get; set; }
    public Guid LedgerAccountId { get; set; }
    public decimal? DebitAmount { get; set; }
    public decimal? CreditAmount { get; set; }
    public DateTime TransactionDate { get; set; }
    public string ModifiedBy { get; set; }
    public DateTime? ModifiedDate { get; set; }
    public string SavedDocument { get; set; }
    public DateTime CreatedDate { get; set; }
    public string CreatedBy { get; set; }
    public bool IsCredit { get; set; }
    public bool IsDebit { get; set; }
    public Guid Type { get; set; } 

    [ForeignKey("LedgerAccountId")]
    public LedgerAccount LedgerAccount { get; set; }
    [ForeignKey("CompanyId")]
    public CompanyNames Company { get; set; }
    [ForeignKey("vendorId")]
    public vendors vendor { get; set; }

}

我已将 General.Entities 的“使用”添加到此模型中。我还需要为此添加其他内容吗?

提前致谢。

更新: 见问题 - Link to answer of question

解决方法

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

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

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