This project has moved. For the latest updates, please go here.

EntityFramework 4.1 - poco files -validation ??

Feb 17, 2012 at 5:54 AM

hey hi,

I ve been switching my model to EF 4.1 which auto-generates poco files..

I am really struck up on implementing validations for the properties.  

"MetadataType" doesnt work in this case.. how the gosh it can be done ??

*********************************************************************************************************************************

Auto generated Poco File
------------------------------- 

public partial class Book
{

public Book()

}

public string BookName { get; set; }

}

=======================================================

My partial class file to implement validation:
---------------------------------------------------

internal interface IBook    
{
[Required] 
string BookName { get; set; }
}

[MetadataType(typeof(IBook))]   
public partial class Book : IBook, IDataErrorInfo
{

[...Implementation...]

}

 

Not works !! :( 

*********************************************************************************************************************************

Please help me on this !!

Thanks..

Coordinator
Feb 18, 2012 at 2:03 PM

Please have a look on this discussion post:

Issue related to the Attribute Metadata Import
 
The information provided in this discussion might solve your issue.