ASP.NET MVC2 - using LINQ-generated class

Posted by ile on Stack Overflow See other posts from Stack Overflow or by ile
Published on 2010-05-03T12:13:05Z Indexed on 2010/05/03 12:18 UTC
Read the original article Hit count: 381

Filed under:
|

There are few things not clear to me about ASP.NET MV2. In database I have table Contacts with several fields, and there is an additional field XmlFields of which type is xml. In that field are stored additional description fields.
There are 4 classes:

  1. Contact class which corresponds to Contact table and is defined by default when creating LINQ classes
  2. ContactListView class which inherits Contact class and has some additional properties
  3. ContactXmlView class that contains fields from XmlFields field
  4. ContactDetailsView class which merges ContactListView and ContactXmlView into one class and this one is used to display data in view pages

ContactListView class has re-defined some properties from Contact class (so that I can add [Required] filter used for validation) - but I get warning message:

'ObjectTest.Models.Contacts.ContactListView.FirstName' hides inherited member 'SA.Model.Contact.FirstName'. Use the new keyword if hiding was intended.

ContactDetailsView class is also used in a form when creating new contact and adding it to database.

I am not sure if this is correct way, and the warning message confuses me a bit. Any advise about this?

Thanks,
Ile

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-mvc-2