Automatically generate buddy classes from model in C#
- by JohnnyO
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.