Is this design ok?

Posted on 2011-10-05
Last Modified: 2012-06-21
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 not truly an object oriented'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)
Question by:Camillia
    LVL 22

    Accepted 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. :-)
    LVL 7

    Author Comment

    I'm using LINQ so I have a 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?
    LVL 22

    Expert Comment

    LVL 22

    Expert Comment

    so that it will be proper three tier architecture.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Suggested Solutions

    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now