Automatically generate buddy classes from model in C#
Posted
by JohnnyO
on Stack Overflow
See other posts from Stack Overflow
or by JohnnyO
Published on 2010-04-28T19:10:24Z
Indexed on
2010/04/28
19:17 UTC
Read the original article
Hit count: 334
I use Linq to Sql (although this is equally applicable in Entity Framework) for my models, and I'm finding myself creating buddy classes for my models all the time. I find this time consuming and repetitive. Is there an easy way to automatically generate these buddy classes based on the models? Perhaps a visual studio macro?
An example of a buddy class that I'd like to create:
[MetadataType(typeof(PersonMetadata))]
public partial class Person
{
}
public class PersonMetadata
{
public object Id { get; set; }
public object FirstName { get; set; }
}
Thanks in advance.
© Stack Overflow or respective owner