MVC - Create a business object

by
Jeremy Canfield |
Updated: March 20 2020
| MVC articles
To create a Class Library object:
- In Solution Explorer, right-click on the root of the hierarchy and select Add > New Project.
- 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:
- In Solution Explorer, right-click on BusinessLayer and select Add > Class.
- Select Class and name the class ContentBusinessLayer.cs.
- 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:
- In Solution Explorer, right-click on References and select Add Reference.
- Select System.Configuration and click OK.
Did you find this article helpful?
If so, consider buying me a coffee over at