Sunday, 18 October 2009

Using ASP.NET MVC 1.0 with Dynamic Data...

Getting Started:

Dynamic data is part of 3.5 SP1, but if you want to use MVC you need to specify that the DLLs should be copied to your \bin folder:

Setting “Copy Local” to True for the highlighted DLLs will copy them to the output folder automatically when you build and publish. Makes a bin-deploy of the MVC project easier.

...And Then:

Then, go to this site:

...and get this sample:

You need to reference system.web.dynamicdata:

Here's what needs to be done to enable configuration of DD for a new site:

Need to use entities data source DD project if using entities:

Need to reference the System.Web.Entity assembly:

...or you get this error message: “The type or namespace name 'EntityDataSource' does not exist in the namespace 'System.Web.UI.WebControls'”

Copy the following code into your Global.asax.cs file in order to get your Dynamic Data working in the original MVC project, with your existing entities:

MetaModel model = new MetaModel();
model.RegisterContext(typeof(), new ContextConfiguration() { ScaffoldAllTables = true });
routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
Model = model

Authentication – good article:

Dynamic Data – displaying database errors:

Entities Framework: If/When you get this error - “Unable to create a constant value of type 'Closure type'. Only primitive types ('such as Int32, String, and Guid') are supported in this context.”:

Need Dynamic Data Futures DLL

Handling DD custom views:

Other Tips:

File upload field template:

If you put html tags into any of the fields you want to edit in your dynamic data views, you will cause it to stop working.

Good link for DD date formatting:

No comments:

Post a comment

Migrating (and Open-Sourcing) an Historical Codebase: SVN-to-Git

I have a SVN repo on my local machine that I have been shoving stuff into since before I knew how to use revision control systems properly (...