我正在围绕 Access DB 创建一个实体框架包装器,但我无法修改架构。
我有一个名为 Component 的实体和一个名为 TerminalInfo 的实体。关系是 1:0..1。我想将结果映射到名为 Terminal 的第三类。
这就是我到目前为止所拥有的。
我收到以下语法错误。
未定义或导入预定义类型“System.ValueTuple`2”
public class TerminalUtility
{
public ProjectContext context { get; private set; }
public TerminalUtility(ProjectContext context)
{
this.context = context;
}
public IQueryable<Terminal> GetTerminals()
{
IQueryable<Terminal> terminals = context.TerminalInfos
.Join(
context.Components,
C => C.Id,
TI => TI.Id,
(C, TI),
new Terminal(C,TI)
);
return terminals;
}
}
[Table("Component")]
public class Component
{
[Key]
[Column("Counter")]
public int Id { get; set; }
[Column("Name")]
public string Name { get; set; }
public string HigherName { get; set; }
public string LowerName { get; set; }
public int SortOrder { get; set; }
/*Various other not relavent properties */
}
[Table("CompPart")]
public class TerminalInfo
{
[Key]
[Column("Counter")]
public int Id { get; set; }
[Column("CompPartName")]
public string LevelName { get; set; }
[Column("CompPartSort")]
public short LevelSorting { get; set; }
/*Various other not relavent properties */
}
public class Terminal
{
private Component _comp;
private TerminalInfo _term;
public Terminal(Component comp, TerminalInfo term)
{
_comp = comp;
_term = term;
}
private int _Id;
public int Id { get => _Id; set { _Id = value; _comp.Id = value; _term.Id = value; } }
public string ProductName => _comp.Name; //** Name - Component
public string TerminalBlock { get => _comp.HigherName; set => _comp.HigherName = value; } //** HigherName in Component
public string TerminalNumber { get => _comp.LowerName; set => _comp.LowerName = value; } //* LowerName in Component
public int TerminalSortOrder { get => _comp.SortOrder; set=> _comp.SortOrder = value; } //** SortOrder in Component
public string LevelName { get=> _term.LevelName; set => _term.LevelName = value; } //** CompPartName in CompPart
public short LevelSorting { get => _term.LevelSorting; set => _term.LevelSorting = value; } //** CompPartSort in CompPart
}
ETA:这与未定义或导入预定义类型“System.ValueTuple´2”无关
问题是 Lambda 表达式中的拼写错误。