buddy-class

Getting buddy class information?

I'm trying to read buddy class metadata information for usage outside of the normal asp.net mvc 2 validation process. I thought it would be as simple as saying: DataAnnotationsModelMetadataProvider metadataProvider = new DataAnnotationsModelMetadataProvider(); var metaData = metadataProvider.GetMetadataForType(() => new T(), typeof (T...

Validation does not work when I use Validator.TryValidateObject.

DataAnnotations does not work with buddy class. The following code always validate true. Why ? var isValid = Validator.TryValidateObject(new Customer(), Context, results, true); and here is the buddy class. public partial class Customer { public string Name { get; set; } public int Age { get; set; } } [MetadataType(typeo...

DataAnnotation attributes buddy class strangeness - ASP.NET MVC

Given this POCO class that was automatically generated by an EntityFramework T4 template (has not and can not be manually edited in any way): public partial class Customer { [Required] [StringLength(20, ErrorMessage = "Customer Number - Please enter no more than 20 characters.")] [DisplayName("Customer Number")] public v...

Add LINQ Auto-Generated Value Marker [Column(IsDbGenerated=true)] in Buddy Class

Hello, is it possible to decorate a field of a LINQ generated class with [Column(IsDbGenerated=true)] using a buddy class (which is linked to the LINQ class via [MetadataType(typeof(BuddyMetadata))]) ? My goal is to be able to clear and repopulate the LINQ ORM designer without having to set the "Auto Generate Value" property manually ev...

Do Buddy Classes only work for DataAnnotations?

Do buddy classes only work for dataannotations, or for any attribute? I've been trying to attach a ColumnAttribute to a field in my buddy class, but it appears that it doesn't get processed in the original class. The two classes are linked via MetadataType. ...