• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

Is this design ok?

In App_Code, i have the DBML folder and a AllClass folder. In AllClass folder i have my whateverclass.cs
In aspx.cs code behind, I instantiate the whateverclass.cs and call it's public method which calls the DBML or stored proc.

All my methods in whateverclass.cs are public. I have Update, Select and Insert methods, call stored proc. All the database
calls.

Is this a good way of coding this..is this not truly an object oriented design...it's like a one-on-one relationship with the database. Page calls database, pulls info, saves, updates, etc.

When I look at the code, i dont have reusable code. I have a class that logs user action. This should be ok, no? (I don't have
an architect on this app)
0
Camillia
Asked:
Camillia
  • 3
1 Solution
 
MrunalCommented:
Better way, you can add another project into your solution as 'Class library' for Data Access Layer (DAL) and write all static methods which will call DB and returns data from database.

Which will generate dll and then you can add reference of this dll into your main project.
So after this you can directly call,
ClassName.MethodName()

Hope this clears you and made your project's architecture better. :-)
0
 
CamilliaAuthor Commented:
I'm using LINQ so I have a DBML...you mean separate that DBML into another project..along with the whateverclass.cs I have?..make the DBML and all other xxx.cs classes into a separate DAL?
0
 
MrunalCommented:
exactly.
0
 
MrunalCommented:
so that it will be proper three tier architecture.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now