How to hide or sort columns in DynamicData

Dynamic Data is an open source database handling framework, developed and managed by Microsoft.

As much as it's easy for use, and in many ways friendly, DynamicData is lacking of many important features.
In this short tutorial I will try to explain how to add basic features to DynamicData.

First step in creating a better DynamicData with LINQ and MS-SQL Server application, is not to allow scaffold.
If a table should be available , simply create a partial class that will scaffold that table for you .
In Global.asax.cs file :

 model.RegisterContext(typeof(DatabaseDataContext), new ContextConfiguration() { ScaffoldAllTables = false }); 

Scaffolding a table :
Assuming that the table name is 'MyTable' , the LINQ manifestation is 'MyTable'

 using System.ComponentModel.DataAnnotations; using System.ComponentModel; namespace MyApplication { [MetadataType(typeof(MyTableMetaData))] public partial class MyTable { } [DisplayName("My table friendly name")] [ScaffoldTable(true)] public class MyTableMetaData { } } 

Identify The Display Modes

DynamicData offers four different display modes :
1. List
2. Edit
3. Details
4. Create

Often we want to show a field in one of the modes while hiding it from the rest. The first natural step would be to create an enum, that will help us identify the pages later.
 

Posted by Segev Shmueli on April 04, 2009 at 06:02 PM

About the blog

Application : CJ's open blog
version : Alpha2
Roadmap : Coming soon
Get the source

Come say hello

segev@segevs.com

See me