• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • 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

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)
  • 3
1 Solution
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,

Hope this clears you and made your project's architecture better. :-)
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?
so that it will be proper three tier architecture.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

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