.NETGURU
ECC design pattern class
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngarchitecture' list.


Francesco Sanfilippo
The following is a skeleton of an ECC design for the Person,
PersonCollection, and PersonEngine objects in my community site. Does this
skeleton look OK?

FS

using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using pr2002.DataAccess;

namespace pr2002.DataDesign
{

    public interface IBusinessObject : IDisposable
    {
    }

    class Person : IBusinessObject
    {
        public void Dispose()
        {
        }
    }

    public interface IBusinessObjectCollection : IDisposable
    {
    }

    class PersonCollection : System.Collections.CollectionBase,
IBusinessObjectCollection
    {
        public void Dispose()
        {
        }
    }

    public interface IBusinessObjectEngine : IDisposable
    {
    }

    class PersonEngine : IBusinessObjectEngine
    {
        public void Dispose()
        {
        }
    }

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
http://www.hotmail.com

Reply to this message...
 
    
chris
IMO, it looks pretty good for the context you are working with. My only
question is why have an interface that implements IDisposable and not extend
that interface? It seems that by doing this, you're just creating extra
overhead by having to call IDisposable thru IBusinessObject. Perhaps I
missed the point of using the custom interfaces, but it seems to me that if
the base interface has the same functionality as the derived interface, why
not just use the base interface?

-Chris Frazier
.NET Solution Developer
Velocity Databank, Inc.
www.velocitydatabank.com

-----Original Message-----
From: Francesco Sanfilippo [mailto:Click here to reveal e-mail address]
Sent: Tuesday, July 09, 2002 11:24 PM
To: aspngarchitecture
Subject: [aspngarchitecture] ECC design pattern class

The following is a skeleton of an ECC design for the Person,
PersonCollection, and PersonEngine objects in my community site. Does this
skeleton look OK?

FS

using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using pr2002.DataAccess;

namespace pr2002.DataDesign
{

    public interface IBusinessObject : IDisposable
    {
    }

    class Person : IBusinessObject
    {
        public void Dispose()
        {
        }
    }

    public interface IBusinessObjectCollection : IDisposable
    {
    }

    class PersonCollection : System.Collections.CollectionBase,
IBusinessObjectCollection
    {
        public void Dispose()
        {
        }
    }

    public interface IBusinessObjectEngine : IDisposable
    {
    }

    class PersonEngine : IBusinessObjectEngine
    {
        public void Dispose()
        {
        }
    }

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
http://www.hotmail.com

| [aspngarchitecture] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngarchitecture.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
    
Francesco Sanfilippo
[Original message clipped]

I am just trying to reinforce that any IBusinessObject will be IDisposable.
Are you saying to do this instead...?

public interface IBusinessObject
{
}

class Person : IBusinessObject, IDisposable
{
public void Dispose()
{
}
}

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

Reply to this message...
 
    
Mark Feinholz
My business object design pattern doesn't have an engine, just
collections and classes. The collections and classes each derrive from
custom BusinessObject and BusinessObjectCollection classes (not
interfaces). These classes contain all of the code that all of the
classes need to manage themselves in the hierarchy, persist themselves
to the db, load themselves, etc.

I considered going the interface route but there was just way too much
common code that ended up in the base classes. For example, there are a
couple of events that cause key changes to be cascaded down to children
and object state changes to be pushed up to parents (so they know they
have a dirty child below them), There are OnInsert and OnRemove events
that manage attaching objects to the hierarchy and removing them, there
is common Update logic that starts an update (opens a connection and
transaction) and pushes it down through the hierarchy, there are a bunch
of common properties like ObjectState, Key, ParentKey, etc. etc.

Either a Business Object or a BusinessCollection object can be at the
top of the hierarchy. Both types of Objects can have as many Loadxxx
methods as they need - the client application will know to run the
CorrectLoad method on the top level object in the hierarchy. Load
methods are smart enough to load up the entire hierarchy with a single
dataReader that returns multiple rowsets.

Business methods are put in either the business objects or their
collection classes. Changes in the object hierarchy are persisted by
the client application running by running "Update" on an object in the
hierarchy - the update proceeds from that object on down - obviously the
client application would typically run "Update" on the top level object
- the one they ran the Load on.

By the way, I don't see the need to create separate objects to manage
the persistence of my business objects like I've heard a few people
doing. This object structure will work fine if I need to remote it via
a web service - I'll just call the web service and say "Return me a
loaded object/object hierarchy", the serialization process doesn't send
around code, only state. Then when I'm done updating the object I'll
send it back to the web process - after "RemovingUnchanged" objects from
the hierarchy to lighten the load - and tell the web service to run the
"Update" method on the object.

hth, Mark.
-----Original Message-----
From: Francesco Sanfilippo [mailto:Click here to reveal e-mail address]
Sent: Tuesday, July 09, 2002 9:24 PM
To: aspngarchitecture
Subject: [aspngarchitecture] ECC design pattern class

The following is a skeleton of an ECC design for the Person,
PersonCollection, and PersonEngine objects in my community site. Does
this
skeleton look OK?

FS

using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using pr2002.DataAccess;

namespace pr2002.DataDesign
{

    public interface IBusinessObject : IDisposable
    {
    }

    class Person : IBusinessObject
    {
        public void Dispose()
        {
        }
    }

    public interface IBusinessObjectCollection : IDisposable
    {
    }

    class PersonCollection : System.Collections.CollectionBase,
IBusinessObjectCollection
    {
        public void Dispose()
        {
        }
    }

    public interface IBusinessObjectEngine : IDisposable
    {
    }

    class PersonEngine : IBusinessObjectEngine
    {
        public void Dispose()
        {
        }
    }

_________________________________________________________________
Join the world's largest e-mail service with MSN Hotmail.
http://www.hotmail.com

| [aspngarchitecture] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngarchitecture.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
    
Paul D. Murphy
If you hit news.asplists.com with your NNTP client and read back over
the archives of this lists. I posted a solid base class for an engine
and the class based on the ECC pattern. The class base exposes
protected/internal flags for IsNew, IsDirty and IsDelete. The engine
base supports middle tier data caching in ASP.NET context.

Paul

[Original message clipped]

Reply to this message...
 
    
Russ McClelland
V2hhdCBpcyB0aGUgcHVycG9zZSBvZiBoYXZpbmcgdGhlIGNsYXNzZXMgaW1wbGVtZW50IGVtcHR5
IGludGVyZmFjZXM/DQpEb2VzIGl0IGJ1eSB5b3UgYW55dGhpbmc/ICBPZiBjb3Vyc2UgeW91IGdl
dCB0aGUgdHlwZSBzYWZldHkgb2Yga25vd2luZw0KdGhhdCBhbiBvYmplY3Q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VibGljIHZvaWQg
RGlzcG9zZSgpDQoJICAgICAgICAgICAgICAgIHsNCgkgICAgICAgICAgICAgICAgfQ0KCSAgICAg
ICAgfQ0KCQ0KCQ0KX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX19fX19fX18NCglKb2luIHRoZSB3b3JsZOKAmXMgbGFyZ2VzdCBlLW1haWwg
c2VydmljZSB3aXRoIE1TTiBIb3RtYWlsLg0KCWh0dHA6Ly93d3cuaG90bWFpbC5jb20NCgkNCgkN
Cgl8IFthc3BuZ2FyY2hpdGVjdHVyZV0gbWVtYmVyIHJ1c3MubWNjbGVsbGFuZEBzbWFydG9iangu
Y29tID0NCllPVVIgSUQNCgl8IGh0dHA6Ly93d3cuYXNwbGlzdHMuY29tL2FzcGxpc3RzL2FzcG5n
YXJjaGl0ZWN0dXJlLmFzcCA9DQpKT0lOL1FVSVQNCgl8IGh0dHA6Ly93d3cuYXNwbGlzdHMuY29t
L3NlYXJjaCA9IFNFQVJDSCBBcmNoaXZlcw0KCQ0KCQ0KDQo
Reply to this message...
 
    
Francesco Sanfilippo
The interfaces won'tbe empty for long...this is skeleton code, meaning I
haven't added any methods or properties yet. I just want to know if I have
this much done properly or not...

FS

[Original message clipped]

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
http://www.hotmail.com

Reply to this message...
 
    
mail
I'm implementing a framework with similar guidelines for a course in my
university.
The use i found for the engine is not that one of having persiting logic
or businnes logic. I implements those in the colection, but i use the
engine for controling object creation, for example i won't let you
create an order item without an order. And i plan to extend this to
check for security and autentication. Please argue on these aproach so i
know if I'm in the right direction.

-----Original Message-----
From: "Mark Feinholz" <Click here to reveal e-mail address>
To: "aspngarchitecture" <Click here to reveal e-mail address>
Date: Wed, 10 Jul 2002 10:28:21 -0700
Subject: [aspngarchitecture] RE: ECC design pattern class

[Original message clipped]

Reply to this message...
 
 
System.Collections.CollectionBase
System.IDisposable




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification