Subset of the schema metadata enabled scenarios (the most common ones) built on the Entity Framework Designer extensibility model.
They enable rich development experience in tools and auto-generation of code.
I've written a T4 that uses the PEM to generate data annotations instead of C# validation code: http://blogs.microsoft.co.il/blogs/idof/archive/2010/10/03/combining-entity-framework-self-tracking-extensible-metadata-and-data-annotations.aspx
It isn't perfect, but if anyone wants to use the PEM with data annotations, I guess they can enhance the capabilities of the template.
It's a nice try, but I wonder if you can write a template that doesn't overrides the code generated by other template. I would like to use this in tandem with some other template I already extended. Any thoughts on releasing the source code?
Any program that handles metadata from different systems and allows autogeneration of code is a must have program. Thankyou to Iranel Crivat of Microsoft for making this a free program!
We are looking to do something very similar but add our domain specific metadata.
Is the source code available to allow PEM to be customized and integrated into other tools?
-Tony
First wanted to thank Irinel for working on this and getting it out -- I'm implementing it as my server side validation for an EF4 project.
I'll have more questions -- but a couple for now are:
1) For a string field, where I setup a DataFieldLength with a length restriction of 2 to 1000 - it generates the following -- which is obviously not correct.
// DataFieldLength
if((this.Name != null && this.Name.Length > 1000)) { errors.Add("Name\tError: Name must be between 2 and 1000."); isOK = false; }
2) Also for required -- it's checking NULL but would be preferable to check "string.IsNullOrWhiteSpace()" -- or at least make that an option.
//Required
if((this.Name == null)) { errors.Add("Name\tError: Name is Required."); isOK = false; }
3) Also, aside from parsing it out (which is what I'm doing) - not seeing how to get rid of "Name\tError:" section of the error message -- I just want to see the custom message.
Looking forward to this being expanded upon.
...Lance Larsen (www.lancelarsen.com)