PC Review


Reply
Thread Tools Rate Thread

Confusing Error related to MappingSource?

 
 
=?Utf-8?B?QmVuamFtaW4=?=
Guest
Posts: n/a
 
      26th Oct 2007
I'm trying to force LINQ to SQL to do some inheritance modeled around the
"Table per Concrete Class" methodology as opposed to the normal "Table per
Class Hierarchy" model it officially supports. To do this, I omitted all the
properties of the inheritance relationship (Discriminator information and
such) and provided the proper Table attribute to associate my derived class
with its own table by addint a new partial class implementation manually.

So what I end up with is a base class that has all the columns in it, and
two derived classes that inherit from it in the designer, and have no
additional properties. Then in another file, I declare both derived classes
just to supply the Table attribute, providing each derived class' table name.

The problem I run into is this error message:
"Data member 'Int32 DocNum' of type '(my base class)' is not part of the
mapping for type '(my derived class)'. Is the member above the root of an
inheritance hierarchy?"

Now I've checked the contents of the MappingSource. I retrieved
context.Mapping.GetMetaType(GetType(<my derived class>)).DataMembers and was
able to verify in the debug window that the DocNum property was defined in
that MetaType information, and the DeclaringType matched <my derived class>,
so I don't know what it's complaining about. Is there any way to make this
work? Any explanation what this error is complaining about? I did notice
that if I create a property in my derived class that shadows the base class
DocNum property, then that property doesn't have the error any more (the next
property does). But the point is not to have to re-declare all the
properties in all me derived classes again. Why doesn't it pick up the base
class' attributes, even though the mapping info makes it look like it did?
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MappingSource could not be found (DBLinq) Matthijs de Z Microsoft C# .NET 0 27th Jan 2010 11:49 AM
Error that a value is needed in a related table that isn't related Pamela Microsoft Access Database Table Design 1 10th Jul 2008 04:10 PM
Confusing Error - Please Help!!! mahesh.nimbalkar@gmail.com Microsoft Dot NET Framework Forms 1 27th May 2007 04:19 PM
confusing error mgm Windows XP General 0 28th Aug 2003 05:10 AM
confusing error using .NET C++ Al Havrilla Microsoft VC .NET 0 13th Aug 2003 07:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:14 AM.