C# 有没有一种方法可以构建从一个表到另一个表的lazyload路径?
我的EF代码第一个站点有两个类,我可以使用lazyloding从类节翻译到类节(即节翻译.Section.XXXX),但我不能从节翻译到节翻译(即节翻译.Section.XXXX)我不知道我需要做些什么才能让我从一个章节翻译到另一个章节 第1.cs节C# 有没有一种方法可以构建从一个表到另一个表的lazyload路径?,c#,webforms,entity-framework-5,asp.net-4.5,C#,Webforms,Entity Framework 5,Asp.net 4.5,我的EF代码第一个站点有两个类,我可以使用lazyloding从类节翻译到类节(即节翻译.Section.XXXX),但我不能从节翻译到节翻译(即节翻译.Section.XXXX)我不知道我需要做些什么才能让我从一个章节翻译到另一个章节 第1.cs节 using FFInfo.DAL.GeneralTranslationTables; using System; using System.Collections.Generic; using System.ComponentModel.DataA
using FFInfo.DAL.GeneralTranslationTables;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace FFInfo.DAL.GeneralTables
{
[Table("Section")]
public class Section
{
[Key, Required, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Int16 SectionID { get; set; }
public Int64? LogoFileID { get; set; }
[Required, MaxLength(15), Column(TypeName = "varchar")]
public string RouteName { get; set; }
[Required, MaxLength(15), Column(TypeName = "varchar")]
public string SectionType { get; set; }
public virtual IList<Section_Translation> SectionTranslations { get; set; }
[ForeignKey("LogoFileID")]
public virtual File File { get; set; }
}
}
与同事交谈时,EF似乎不允许像我希望的那样构建延迟加载
using FFInfo.DAL.GeneralTables;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace FFInfo.DAL.GeneralTranslationTables
{
[Table("SectionTranslation")]
public class Section_Translation
{
[Key, Required, Column(Order = 0)]
public Int16 SectionID { get; set; }
[Key, Required, Column(Order = 1)]
public byte CultureCodeID { get; set; }
[Required]
public string SectionTitle { get; set; }
public string Synopsis { get; set; }
[ForeignKey("SectionID")]
public virtual Section Section { get; set; }
[ForeignKey("CultureID")]
public virtual CultureCode Culture { get; set; }
}
}