Dynamic MVC Order Entry Tutorial - Create Customers

This tutorial has been updated to version 3.0.
Sat, 24 Oct. 2014 - Chris Perry

Create A Customer Model With Entity Framework Code First

We will need to create a Customer and CustomerRegion class similar to the images above. We will also need to add the appropriate DbSet property in the data context class.

We have added the DynamicEntity and DynamicMenuItem attributes to our new classes. The DynamicMenuItem attribute allows us to customize the menus generated in the layout view.

After adding a new migration and updating the database using code first scripts we learned in tutorial one, the application should look like the images below.

Understanding Dynamic Filtering

We will need to create some customer region records. Open up the "Customer Regions" menu item and click the create hyperlink. Once we have created several customer region records, click the customer menu item.

The customer list screen displays a customer region filter automatically. The dynamic filtering functionality performs database level filtering. This is ideal for large amounts of data. If the number of customer regions grows to be larger than 50 records, the dynamic filter will be displayed as an autocomplete textbox instead of a drop down list.

Understanding Dynamic Routes


To understand how all this works we first need to understand Dynamic Routes. Dynamic MVC will generate a dynamic route automatically for any Dynamic Entity that does not have a controller defined using standard MVC convention. If no controller is found then any request will be routed to the Dynamic Controller.

Understanding The Dynamic Controller

The Dynamic Controller contains action methods needed for the Index, Create, Edit, Details, and Delete dynamic views. It calls the necessary methods on IDynamicRepository to perform all needed data access methods.

Understanding Dynamic Views

Each dynamic view is added to the shared folder. This allows them to be called from any controller. Any customizations made to the views in the shared folder will be applied to every Dynamic Entity. To customize a view for a specific entity, we would first create a new controller that inherits from DynamicController and then simply copy the Dynamic View into the view folder for that custom controller.

COMMENTS Add Comment
  • All things coddenires, this is a first class post
    85XUfbPvlo | 3/30/2016 8:08:09 AM
  • At last, soenome comes up with the "right" answer! http://oysypuspu.com [url=http://sxxcjulzatg.com]sxxcjulzatg[/url] [link=http://dyowtlgkh.com]dyowtlgkh[/link]
    hKXX1d2a | 4/8/2016 9:04:46 AM