This project is read-only.

Scaffolding with CamoteQ


For the purposes of this demonstration let us conceptualize a web app where we have a products page where we can perform Add, Edit, and Delete with products. Our demonstration app should also allow products to be categorized and that we will also have a maintenance page for category where we do add, edit ad delete as well.

Model Classes

If you have already built your solution then you are ready to perform scaffolding. The first step is to define the model classes in the Shared project. In the Shared project right click on the Models folder and select Add -> Class, and name the class as Category.

Modify the class so that it will have the attributes CategoryId and CategoryName as shown below. Then let us add another class and we will name it Product this time.

After you build your solution you are ready to perform the scaffolding. Right click on the application project in the solution explorer and select Add -> New Item.

Go to Visual C# -> Web -> CamoteQ and select the Scaffolding item template. Do not bother to name the item as the item name will be decided on the data model class that you will select after this step.

Next, the CamoteQ Scaffolding dialog box will appear.

In the CamoteQ Scaffolding dialog box click on the dropdown list and select Category. After that do the same with Product then rebuild the solution.

When prompted to reload click the Reload All button.

That's it!

Connection String

We are just about ready to run the application. But first we need to define the connection string so that the app will know what database server it will use. In the app.config in the data layer project add the connection sting below.

<add name="DatabaseContext" providerName="System.Data.SqlClient" connectionString="Server=.\SQLEXPRESS;Database=YourDatabase;Integrated Security=True;"/>

Add the same connection string in your web.config. Finally, run the application!

Last edited Jun 20, 2014 at 2:19 AM by mfcguru, version 21