Entity framework using Data Repository pattern

Posted by JamesStuddart on Stack Overflow See other posts from Stack Overflow or by JamesStuddart
Published on 2010-05-12T09:12:29Z Indexed on 2010/05/12 9:14 UTC
Read the original article Hit count: 182

Hi all,

I have been implementing a new project which I have decided to use the repository pattern and Entity Framework.

I have sucessfuly implemented basic CRUD methods and I have no moved onto my DeepLoads.

From all the examples and documentation I can find to do this I need to call something like this:

public Foo DeepLoadFoo()
{
    return (from foobah in Context.Items.Include("bah").Include("foo").Include("foofoo") select foo).Single();
}

This doesnt work for me, maybe I am trying to be too lazy but what I would like to achieve would be something along the lines of this:

public Foo DeepLoadFoo(Foo entity, Type[] childTypes)
{
    return (from foobah in Context.Items.Include(childTypes).Single();
}

Is anything like this possible, or am I stuck with include.include.include.include?

Thanks

© Stack Overflow or respective owner

Related posts about entity-framework-4

Related posts about n-tier