Re: Inheritance in LINQ-SQL Framework and/or ADO.NET Entity Framework

Frans Bouma <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.advanced
Message-ID <004b01c91959$bbe96a30$33bc3e90$@nl>
> Does the ADO.NET Entity Framework support inheritance across assemblies?
> In other words, can I declare some "base" objects in one assembly, then in
> another assembly, inherit and extend those objects?

        Not sure, but I really don't think it's wise to do so anyway. Having
two schemas which have fields in common in perhaps a subset of the entities
isn't a reason to share code among the two projects: if one schema needs a
change in a table which is apparently 'the same' you are in trouble.

                FB

>
> Thanks,
> Mike
>
> On Wed, Sep 17, 2008 at 3:21 PM, Shawn Wildermuth <
> [email protected]> wrote:
>
> > Entity Framework or NHibernate both support the notion you looking for
> > though separating your data access without inheritance (e.g. composition
> > versus inheritance) might be a better solution overall.
> >
> > -----Original Message-----
> > From: Discussion of advanced .NET topics.
> > [mailto:[email protected]] On Behalf Of Mike Andrews
> > Sent: Wednesday, September 17, 2008 10:13 AM
> > To: [email protected]
> > Subject: Re: [ADVANCED-DOTNET] Inheritance in LINQ-SQL Framework and/or
> > ADO.NET Entity Framework
> >
> > Hi Lain,
> >
> > Thanks for the quick response.  I finally found the answer (through
several
> > online posts).
> > The current design of the LINQ-SQL system does not allow cross-assembly
> > inheritance nor conventional inheritance, per se.
> > Hopefully MS will rectify this situation with the next release or perhaps
> > the ADO.NET entity framework will work on this account.
> >
> > What I did find out is that I can mimic the behavior I need by using
> > interfaces.  I'm not exceptionally fond of this, but I'm going to give it
a
> > try.
> >
> > Thanks,
> > Mike
> >
> >
> > On Wed, Sep 17, 2008 at 3:45 AM, Iain Smallwood <[email protected]
> > >wrote:
> >
> > > Hi Mike,
> > >
> > > I do not use the dbml designer, as it seems to get a bit too complicated
> > > once you get many tables etc involved or want to change the schenma - I
> > > prefer SQLMetal, though it should amount to the same thing.
> > >
> > > I am not sure what is causing your problem but I am able to a) extend
the
> > > class in another assembly b) add extra gubbins to the class through an
> > > additional partial class in the same assembly, using this approach.
> > >
> > > From the look of your error I would suspect a critical difference in
some
> > > of
> > > the attribute decorations for the extra columns or something of that
> > > nature.
> > > Sorry if I am not much help - just trying to get going on this side of
> > > things myself and answered as no-one else did.
> > >
> > > cheers,
> > > Iain
> > >
> > > On Tue, Sep 16, 2008 at 9:26 PM, Mike Andrews
> > > <[email protected]>wrote:
> > >
> > > > I have a problem for which I cannot seem to discern a reasonable
> > > solution.
> > > > I would like to use the LINQ-SQL classes and objects for doing my
> > > database
> > > > manipulations but both seem to be lacking in the area that I need and
I
> > > > would like to know if any of you have a reasonable solution/answer (or
> > > just
> > > > to tell me it can't be done would be fine).
> > > >
> > > > I currently have a base set of classes setup in a dbml file and the
> > > > corresponding code (built using the built-in designer) contained in
> > > library
> > > > assembly.
> > > > I now want to re-use that work that was done and extend those classes
> > in
> > > > another assembly.
> > > >
> > > > For example, lets say have I have table Employee in the main database
> > > > schema
> > > > from which I'm deriving this project.
> > > > I now have a new database with the exact same schema save that the
> > > Employee
> > > > table now has an added column that was not previously present in the
> > > other
> > > > schema.
> > > > I want to be able to "inherit" the "Employee" class from the primary
> > > > assembly and extend it with an added column.
> > > > I have been able to accomplish this feat, and the designer seems to
> > > "allow"
> > > > this sort of behavior, however, an exception occurs when I try to
> > execute
> > > > the code.
> > > >
> > > > The exception reads:
> > > >
> > > > Data member 'System.Guid SetID' of type 'Lib1.Set' is not part of the
> > > > mapping for type 'E2Set'. Is the member above the root of an
> > inheritance
> > > > hierarchy?
> > > >
> > > > I'm really at a loss here on what to do next or how to overcome this.
> > >  Any
> > > > help would be most appreciated.
> > > >
> > > > Thanks,
> > > > Mike
> > > >
> > > > ===================================
> > > > This list is hosted by DevelopMentor(R)  http://www.develop.com
> > > >
> > > > View archives and manage your subscription(s) at
> > > > http://discuss.develop.com
> > > >
> > >
> > > ===================================
> > > This list is hosted by DevelopMentor(R)  http://www.develop.com
> > >
> > > View archives and manage your subscription(s) at
> > > http://discuss.develop.com
> > >
> >
> > ===================================
> > This list is hosted by DevelopMentorR  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com
> >
> > ===================================
> > This list is hosted by DevelopMentor(R)  http://www.develop.com
> >
> > View archives and manage your subscription(s) at
> > http://discuss.develop.com
> >
>
> ===================================
> This list is hosted by DevelopMentorR  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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.