PC Review


Reply
Thread Tools Rate Thread

Custom Entity classes are killing me.

 
 
Tom B
Guest
Posts: n/a
 
      20th May 2005
Hello all,

I just read Karl Seguin's article "On the Way to Mastering ASP.Net:
Introducing Custom Entity Classes"
http://msdn.microsoft.com/library/de...CustEntCls.asp

I realize it's about ASP.Net, but figured the same principles apply for
Windows Form classes..

Here's my question/problem

In the article he refers to a Person class and a Role class. Since a person
could have several roles, an array of Roles is in the Person class.

SO.... what about the fact that Roles would contain many Persons. If I load
a Person class with all of its roles (in the constructor) and load all of
the persons within the roles constructor it will go on forever.

How is this handled? Is this where the lazy load stuff I've heard of comes
from?

Thanks in advance.

Tom B


 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
Guest
Posts: n/a
 
      20th May 2005
It really depends on what you are accomplishing. One idea is to have the role
membership null until you are actually pulling members of a role. For person,
you can do the same thing with roles, but it is not as critical if one can be
nullable.

You can work with objects that wrap DataSets to avoid some of the
complexity, but that would be slightly different than the suggestions in the
article.

Hope this helps, as I feel I am rambling a bit right now.


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************


"Tom B" wrote:

> Hello all,
>
> I just read Karl Seguin's article "On the Way to Mastering ASP.Net:
> Introducing Custom Entity Classes"
> http://msdn.microsoft.com/library/de...CustEntCls.asp
>
> I realize it's about ASP.Net, but figured the same principles apply for
> Windows Form classes..
>
> Here's my question/problem
>
> In the article he refers to a Person class and a Role class. Since a person
> could have several roles, an array of Roles is in the Person class.
>
> SO.... what about the fact that Roles would contain many Persons. If I load
> a Person class with all of its roles (in the constructor) and load all of
> the persons within the roles constructor it will go on forever.
>
> How is this handled? Is this where the lazy load stuff I've heard of comes
> from?
>
> Thanks in advance.
>
> Tom B
>
>
>

 
Reply With Quote
 
Tom B
Guest
Posts: n/a
 
      20th May 2005
Thanks.

That's kind of what I was thinking.
I'd really like to see a good example somewhere. Most MS examples use
datasets, and then there whitepapers tell you not too.

oh well.
Thanks again,

TOm B

"Cowboy (Gregory A. Beamer) - MVP" <(E-Mail Removed)> wrote
in message news:A783BE7D-8A37-4D6D-9B7F-(E-Mail Removed)...
> It really depends on what you are accomplishing. One idea is to have the

role
> membership null until you are actually pulling members of a role. For

person,
> you can do the same thing with roles, but it is not as critical if one can

be
> nullable.
>
> You can work with objects that wrap DataSets to avoid some of the
> complexity, but that would be slightly different than the suggestions in

the
> article.
>
> Hope this helps, as I feel I am rambling a bit right now.
>
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
>
> ***************************
> Think Outside the Box!
> ***************************
>
>
> "Tom B" wrote:
>
> > Hello all,
> >
> > I just read Karl Seguin's article "On the Way to Mastering ASP.Net:
> > Introducing Custom Entity Classes"
> >

http://msdn.microsoft.com/library/de...CustEntCls.asp
> >
> > I realize it's about ASP.Net, but figured the same principles apply for
> > Windows Form classes..
> >
> > Here's my question/problem
> >
> > In the article he refers to a Person class and a Role class. Since a

person
> > could have several roles, an array of Roles is in the Person class.
> >
> > SO.... what about the fact that Roles would contain many Persons. If I

load
> > a Person class with all of its roles (in the constructor) and load all

of
> > the persons within the roles constructor it will go on forever.
> >
> > How is this handled? Is this where the lazy load stuff I've heard of

comes
> > from?
> >
> > Thanks in advance.
> >
> > Tom B
> >
> >
> >



 
Reply With Quote
 
Tom B
Guest
Posts: n/a
 
      20th May 2005
"there whitepapers" should have been "their whitepapers"


"Tom B" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks.
>
> That's kind of what I was thinking.
> I'd really like to see a good example somewhere. Most MS examples use
> datasets, and then there whitepapers tell you not too.
>
> oh well.
> Thanks again,
>
> TOm B
>
> "Cowboy (Gregory A. Beamer) - MVP" <(E-Mail Removed)>

wrote
> in message news:A783BE7D-8A37-4D6D-9B7F-(E-Mail Removed)...
> > It really depends on what you are accomplishing. One idea is to have the

> role
> > membership null until you are actually pulling members of a role. For

> person,
> > you can do the same thing with roles, but it is not as critical if one

can
> be
> > nullable.
> >
> > You can work with objects that wrap DataSets to avoid some of the
> > complexity, but that would be slightly different than the suggestions in

> the
> > article.
> >
> > Hope this helps, as I feel I am rambling a bit right now.
> >
> >
> > --
> > Gregory A. Beamer
> > MVP; MCP: +I, SE, SD, DBA
> >
> > ***************************
> > Think Outside the Box!
> > ***************************
> >
> >
> > "Tom B" wrote:
> >
> > > Hello all,
> > >
> > > I just read Karl Seguin's article "On the Way to Mastering ASP.Net:
> > > Introducing Custom Entity Classes"
> > >

>

http://msdn.microsoft.com/library/de...CustEntCls.asp
> > >
> > > I realize it's about ASP.Net, but figured the same principles apply

for
> > > Windows Form classes..
> > >
> > > Here's my question/problem
> > >
> > > In the article he refers to a Person class and a Role class. Since a

> person
> > > could have several roles, an array of Roles is in the Person class.
> > >
> > > SO.... what about the fact that Roles would contain many Persons. If

I
> load
> > > a Person class with all of its roles (in the constructor) and load all

> of
> > > the persons within the roles constructor it will go on forever.
> > >
> > > How is this handled? Is this where the lazy load stuff I've heard of

> comes
> > > from?
> > >
> > > Thanks in advance.
> > >
> > > Tom B
> > >
> > >
> > >

>
>



 
Reply With Quote
 
pitdog@gmail.com
Guest
Posts: n/a
 
      21st May 2005
Hey Tom,

This is the a pretty old idea. Though in .Net it may be something new.
This is a common J2EE way to do things in the web realm. Things like
Struts and JavaBeans follow this concept of coverting data into objects
or requests into objects for that matter dont think these can only be
used with the database. I use these to ecapsulate form data as well.

I understand your frustration with his example however you must
understand that all of this depends on what your system needs when
thinking about object relationships. I think you need not get hung up
on the example he gives. Just understand the idea of taking the data
from the data set and putting it into more abstracted domain type
objects.

Here is how I do almost all .net web apps.

Codebehind -> service class -> Dal classes

the serveice layer makes calls into the DAL layer and get the dataset
in return. The Service layer then creates the "Entity Objects" from the
datasets. The service then returns this to the code behind and it is
bound to controls there.

The reason I put Entity Objects in quotes is they are not really entity
objects. That is a term that java uses for persistant data. meaining
they are tied to a records in the database. This is not the case with
what he is describing in this artical. I call these "Entity Objects"
ValueHolders.

Thanks for posting this link it was a nice read. I really enjoyed it.

Thanks,
Brette

 
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
Re: Using Existing Classes in Entity Framework Gregory A. Beamer Microsoft ADO .NET 0 27th Oct 2009 03:32 PM
Entity framework and custom-ORM interoperability Yash Ganthe Microsoft ADO .NET 1 10th Aug 2009 12:16 PM
Building expression trees to filter derived entity classes Fritz Microsoft C# .NET 11 26th Mar 2009 04:29 PM
generate entity classes butch77@web.de Microsoft C# .NET 3 9th Oct 2007 04:23 PM
beginner's custom entity design question JJ Microsoft ASP .NET 0 12th Feb 2007 04:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:46 AM.