Bootstrap FreeKB - MVC - Create a business object
MVC - Create a business object

Updated:   |  MVC articles

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.



Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


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