I would say that using inheritance in LINQ to SQL isn't a good approach.
Entity Framework is better than most but you might consider either using
LINQ for SQL or EF (or nHibernate) as your data access layer and using the
dal as the 'fillers' for real business objects.

Thanks,

Shawn Wildermuth
http://adoguy.com
http://wildermuthconsulting.com
http://geekdinners.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker

The Silverlight Tour is coming to a city near you!

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Frans Bouma
Sent: Friday, April 18, 2008 9:05 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] LINQ to SQL and inheritanc....

> I'm just having a mess about with LINQ and inheritance, I've basically
> created the canonical example, base class (lets say Animal), and derived
> class (lets say Dog) and set up the inheritance relations.
>
> I notice that once I set up the relationship the Derived class is not
> present in the data context as a "System.Data.Linq.Table<Dogs> Dogs".

        are they all mapped onto the same table with a discriminator?

> hmmm....seems a little wierd, it would be nice to query and bind to Dogs
> directly (if you see what I mean).
>
> So I create a form and grid and bind to the Animals base Table (as it's
> the only one I've got and remove all the stuff I'm not interested
> in.....add something to the grid and of course it defaults to the base
> type.

        you can forget databinding if inheritance is involved: databinding
in
grids works with a single set of properties, and typically grids pick either
the first entry in the bound set to determine these or ask the ITypedList
implementation of the set, if available.

        if you have 2 subtypes of animal: Dog and JellyFish, both will have
their own unique properties: what should a grid do: display these columns or
not? If so, what should be happening when a row represents a dog and a
column
specific for jellyfish is changed?

                FB

===================================
This list is hosted by DevelopMentor.  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to