0
Entity Framework 3.5 SP1을 사용하고 있는데 아래 작업을 수행하는 더 깨끗한 방법을 찾으려고합니다.ObjectContext에서 열정적 쿼리 구성하기
나는 EF 모델을 가지고 있으며 일부 Eager Loaded 엔티티를 추가하고 있으며 이들 모두가 컨텍스트에서 "Eager"속성에 있어야합니다. 우리는 원래 엔티티 집합 이름을 변경하려고했지만 속성을 사용하는 것이 훨씬 깨끗해 보였고 엔티티 집합 이름을 그대로 유지했습니다.
예 :
Context
- EntityType
- AnotherType
- Eager (all of these would have .Includes to pull in all assoc. tables)
- EntityType
- AnotherType
은 현재 내가 구성을 사용하고 있지만 내가 원하는 일을 할 수있는 쉬운 방법이 같은 느낌.
namespace Entities{
public partial class TestObjectContext
{
EagerExtensions Eager { get;set;}
public TestObjectContext(){
Eager = new EagerExtensions (this);
}
}
public partial class EagerExtensions
{
TestObjectContext context;
public EagerExtensions(TestObjectContext _context){
context = _context;
}
public IQueryable<TestEntity> TestEntity
{
get
{
return context.TestEntity
.Include("TestEntityType")
.Include("Test.Attached.AttachedType")
.AsQueryable();
}
}
}
}
public class Tester{
public void ShowHowIWantIt(){
TestObjectContext context= new TestObjectContext();
var query = from a in context.Eager.TestEntity select a;
}
}
그것은 당신이 뭘 하려는지 매우 분명하지 않다. 일반적인 건축 목표에 대해 자세히 설명해 주시겠습니까? –
나는 위에서 언급 한대로 희망을 갖고 도움이 될 것입니다. 나는 일을 시작합니다. 작곡 만이 갈 수있는 길입니다. – Nix