Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 1st, 2006, 01:12 AM
Authorized User
 
Join Date: Jun 2005
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to aldwinenriquez
Default Design Patter Question

I have a generic Lock entity which Locks a record in the database.

It contains a generic method called
LockRecord(objectType,objectInstance)

I have different objects implementing the lock, which do you is better?

1.

Object1 class

LockObject1(object1instance)
{
//do necessary stuffs for object1instance
Lock.LockRecord(objectType.Object1,object1instance )
}

Object2 class

LockObject2(object2instance)
{
//do necessary stuffs for object2instance
Lock.LockRecord(objectType.Object2,object2instance )
}

or

2. at the LockRecord method i will have the following:

LockRecord(objectType,objectInstance)
{
switch(objectType)
{
case objectType.object1 : do object1 stuff;break;
case objectType.object2 : do object2 stuff;break;
.
.
.
}
}

I think option 1 is better because of loose coupling. Do you guys heve a better way of implementing this?

"Dont you ever give up!"
__________________
\"Dont you ever give up!\"





Similar Threads
Thread Thread Starter Forum Replies Last Post
design question androoo ADO.NET 1 November 13th, 2004 09:41 AM
design question androoo Classic ASP Databases 1 November 13th, 2004 09:41 AM
design question androoo General .NET 1 November 13th, 2004 09:40 AM
design question androoo .NET Web Services 1 November 13th, 2004 09:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.