Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / May 2005

Tip: Looking for answers? Try searching our database.

Custom Entity classes are killing me.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tom B - 20 May 2005 16:34 GMT
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/default.asp?url=/library/en-us/dnaspp/html/Cus
tEntCls.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
Cowboy (Gregory A. Beamer) - MVP - 20 May 2005 19:24 GMT
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.

Signature

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

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

> Hello all,
>
[quoted text clipped - 20 lines]
>
> Tom B
Tom B - 20 May 2005 21:03 GMT
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

> 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,
[quoted text clipped - 11 lines]
> > I just read Karl Seguin's article "On the Way to Mastering ASP.Net:
> > Introducing Custom Entity Classes"

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/Cus
tEntCls.asp


> > I realize it's about ASP.Net, but figured the same principles apply for
> > Windows Form classes..
[quoted text clipped - 14 lines]
> >
> > Tom B
Tom B - 20 May 2005 21:11 GMT
"there whitepapers" should have been "their whitepapers"

> Thanks.
>
[quoted text clipped - 26 lines]
> > > I just read Karl Seguin's article "On the Way to Mastering ASP.Net:
> > > Introducing Custom Entity Classes"

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/Cus
tEntCls.asp


> > > I realize it's about ASP.Net, but figured the same principles apply for
> > > Windows Form classes..
[quoted text clipped - 18 lines]
> > >
> > > Tom B
pitdog@gmail.com - 21 May 2005 04:08 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.