How to create a business object in MVC

Home > Search > How-to
  by

To create a Class Library object:

  1. In Solution Explorer, right-click on the root of the hierarchy and select Add > New Project.
  2. In the Add New Project pop-up box, select Class Library, name the object BusinessLayer, and select OK.

In Solution Explorer, under BusinessLayer will be a few objects. One of the objects is Class1.cs. Rename this object to the name of a SQL table that contains data. For the purpose of this tutorial, let's say the name of the table in SQL in Content.

Add a class file:

  1. In Solution Explorer, right-click on BusinessLayer and select Add > Class.
  2. Select Class and name the class ContentBusinessLayer.cs.
  3. Do the following to the ContentBusinessLayer.cs file:
    • Add the word public before public class ContentBusinessLayer
    • Add the ADO stuff . . .
    • Add using System.Configuration; to the top of the file
    • Add using System.Data; to the top of the file
    • Add using System.Data.SqlClient; to the top of the file

Add References:

  1. In Solution Explorer, right-click on References and select Add Reference.
  2. Select System.Configuration and click OK.


Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments