C# POCO T4 template, generate interfaces?

Posted by Jonna on Stack Overflow See other posts from Stack Overflow or by Jonna
Published on 2010-12-28T22:49:42Z Indexed on 2010/12/28 22:54 UTC
Read the original article Hit count: 294

Filed under:
|
|

Does anyone know of any tweaked version of POCO T4 template that generates interfaces along with classes? i.e. if I have Movie and Actor entities in .edmx file, I need to get the following classes and interfaces.

interface IMovie
{
    string MovieName { get; set; }
    ICollection<IActor> Actors { get; set; } //instead of ICollection<Actor>
}

class Movie : IMovie
{
    string MovieName { get; set; }
    ICollection<IActor> Actors { get; set; } //instead of ICollection<Actor>
}

interface IActor
{
    string ActorName { get; set; }
}

class Actor
{
    string ActorName { get; set; }
}

Also, just in case I write my own entities, does POCO proxies(I need them for lazy loading) work with the interface declarations as shown above?

© Stack Overflow or respective owner

Related posts about c#

Related posts about entity-framework