views:

58

answers:

0

Poco generator for EF 4 is great!

it took me a while to figure out how to use my existing classes as POCO's but i did and it works.

One thing i can't seem to still be able to figure out, is how to use the same class for 2 entities.

Seems that the POCO class has to have the same name as the Entity it is going in place of, and not just the same signature.

So if i generate entities for 2 views (which return identical results) v_SomeViewA, and v_SomeViewB. Than generate the entities, and rename them to ViewA, ViewB. This will in turn generate POCO's with the same name.

now let's say that i have a class called View with the same signature as ViewA and ViewB POCO's. It appears that i can't, and that I must rename my View class to ViewA or ViewB and therefore can't use it for both..

I mean i can edit the generated context class, which has the generic methods: pseudocode:

public ObjectSet<ViewA> ViewAs
{
    get { return ... CreateObjectSet<ViewA>("ViewAs");
}

etc.. so i should be able to simply modify this to:

public ObjectSet<View> ViewAs
{
    get { return ... CreateObjectSet<View>("ViewAs");
}

but this just breaks with the generic message that mapping information was not found for View etc..

do POCO classes have to have the same name as the entity? is there a way to use the same class for 2 entities if their signatures are identical?