ADO.NET Objects - Model Data Annotations

I use the approach described here: -

http://blogs.msdn.com/b/adonet/archive/2010/12/06/ef-feature-ctp5-code-first-walkthrough.aspx

I would like to use the surface designer to develop my model, and then use partial classes to include data annotations for validation. However, if I use an incomplete class and then try to reference an existing property, the compiler complains that the property already exists.

How can I overcome this?


eg.

public partial class Product
{
    [Required(ErrorMessage="Name is required")]
    public string Name { get; set; }
} 

The compiler says: "Name is already defined."

+3
source share
1 answer

Source: https://habr.com/ru/post/1779883/


All Articles