Database accessing

3 views
Skip to first unread message

Sreenivas

unread,
Dec 17, 2008, 5:03:40 AM12/17/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hi,
I have 3 classes namely ,
1)Task
2)Customer
3)Project

and their DB classes are
1)DbTask
2)DbCustomer
3)DbProject
respectively.Is it a good idea to interact Business logic classes
(Task ,Customer,Project) with Db
classes??
I heard creating DAO for .net is old fashioned one ,
(http://social.msdn.microsoft.com/forums/en-US/adodotnetdataproviders/
thread/7d30fbe3-b06d-48b9-a2c1-125acd608445/)
is it true?
Thanks in advance..


Cerebrus

unread,
Dec 17, 2008, 2:10:11 PM12/17/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
What's a DB class ?

Benj Nunez

unread,
Dec 17, 2008, 9:52:38 PM12/17/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hi!

Ironically, I am one of the Java Programmers here in our office but I
use C# for one our clients! I practice the use of the
MVC (Model View Controller) pattern. I had to adjust the use of this
pattern a bit in C# since it's a different "environment"
altogether. :-)

I suggest you create some tiers for you apps. It goes like this:

TaskEntry - class that hold your getters and setters. Not really
needed. But if you want the "look and feel" of Java, I suggest you
try this. :)
TaskEntryDao - the "interface" part of your app. Declaration of
methods.
TaskEntryDaoImpl - the class which holds/implements the definition of
your methods declared under TaskEntryDao.
TaskEntryService - class that instantiates and uses the
TaskEntryDaoImpl class.
TaskEntryForm - the gui part of your app (optional). Instantiates the
TaskEntryService and use the methods it exposes.

Optional:
StringHolder.cs - helper class that has getters and setters that help
display the contents of a collection
in a visual control. It is similar to TaskEntry.

The reason why I have a stringHolder class is because I noticed that I
don't get to display the contents of
my collection to a visual control by using my user-defined xxxEntry
class.

The xxxEntry class goes like this (even in Java)

class MyClassEntry
{
string Name;
string Address;

public void setName(string Name)
{
this.Name = Name;
}

public string getName()
{
return Name;
}

...
}

StringHolder.cs Helper class will go like this:

class StringHolder
{
private string shName;
private string shAddress;

public string shName
{
get
{
return Name;
}
set
{
Name = value;
}
}

public StringHolder(string AName)
{
this.Name = AName;
}

}


I have a sample utility app that uses this mvc-like pattern. If
interested, I'll be glad to email it to you.


Cheers!



Benj

Sreenivas

unread,
Dec 18, 2008, 1:18:50 AM12/18/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Generally,we write database interaction code in DB classes..
eg:DBTask.cs

Cerebrus

unread,
Dec 18, 2008, 2:57:20 PM12/18/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I suspected that you would answer something along those lines. My
point is why do you need a separate class to handle DB interactions
with each DB object / table ? Tier based development is usually
understood to contain the following very basic layers :

1. UI layer
2. Application/Biz Logic Layer.
3. DataLayer
4. DataStore.

As such you should have a general Datalayer that handles all database
interaction and passes ADO.NET objects to your Business logic layer.
These objects are then converted after applying business rules to
custom objects that are usable by the UI layer to display/add/modify
the data.
> > > Thanks in advance..- Hide quoted text -
>
> - Show quoted text -

Sreenivas

unread,
Dec 18, 2008, 11:25:53 PM12/18/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Cerebrus can give me some sites or book names for designing .net
applications ..

Cerebrus

unread,
Dec 19, 2008, 1:35:31 AM12/19/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Ummm... unfortunately, Cerebrus can't. He learnt all this from
experience and having an open mind. ;-)
> > > - Show quoted text -- Hide quoted text -

Sreenivas

unread,
Dec 19, 2008, 2:15:54 AM12/19/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Welcome :)

Brandon Betances

unread,
Dec 19, 2008, 5:58:07 AM12/19/08
to DotNetDe...@googlegroups.com
Thank you :)

sundar irene

unread,
Dec 19, 2008, 7:16:11 AM12/19/08
to DotNetDe...@googlegroups.com
s DAO is old u better go for ado.net technology
Reply all
Reply to author
Forward
0 new messages