我正在尝试使用旧应用程序中的一组数据并将其移动到 MSSQL 数据库中。我使用 EF 在 C# 中创建了一个应用程序来管理数据。类结构代表旧版应用程序中的旧 C 样式数组,但具有一些类顺序。
这是三个主要的类。还涉及其他属性,但我在这里只包含了主窗体和内存占用 (AccountDetails)。构建此结构后,它具有一个模拟 - 从 50 到 100 个帐户,然后每个帐户具有 1000 个或更多帐户详细信息对象。
如果我一次添加整个结构 - 并保存更改,我会收到内存错误。如何添加所有 AccountDetail 对象并将其链接为一个对象结构?我可以单独添加它们吗(尽管此处未包含所有详细信息,但我已正确设置了所有 ID 和一个到 Many 的设置)。
public class Simulation
{
public string Name { get; set; }
public List<Account> Accounts { get; set; }
}
public class Account
{
public int Id { get; set; }
public string Name { get; set; }
public int Type { get; set; }
public List<AccountDetail> Details { get; set; }
}
// trouble in here....
public class AccountDetail
{
public int Id { get; set; }
public int Type { get; set; }
public int Scenario { get; set; }
public double M01 { get; set; }
..... class has 60 doubles for 5 years of payments ....
public double M60 { get; set; }
}
谢谢,
K。