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: 402
c#
|asp.net-mvc-2
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:
Contact
class which corresponds toContact
table and is defined by default when creating LINQ classesContactListView
class which inheritsContact
class and has some additional propertiesContactXmlView
class that contains fields fromXmlFields
fieldContactDetailsView
class which mergesContactListView
andContactXmlView
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