Framework Madness!

And other adventures C# and …

Posts Tagged ‘dynamic data

Data Annotations : MVC 2 Preview 1

with 4 comments

That title is a mouth full.

Moving on – if you don’t know by now the MVC team posted their first draft of v2 last night along with a few blogs posts and a Scott Hanselman Channel 9 video. And while the first hint at Areas looks incomplete, the work on Data Annotations looks very promising.

I have been doing a major eCommerce project at work leveraging 3.5 Dynamic Data along with Entity Framework for the admin. Using Dynamic Data has really cut my development time and I couldn’t fathom leveraging MVC without similar support. Well, MCV v2 Data Annotation support thus far appears similar but stripped down like the MCV types like it. Support comes from several improvements:

  • Display and Editor Templates: these are user controls that can be used to create display and editing output for properties specified by Data Annotations applied to the model. These are similar to field templates. However, they can be used for more than just values types, you can make controls for complex types as well.
  • Strong Typed UI Helpers: these extensions of the Html object inside a view not only allow for using lambda expressions for specifying output but also act as the gateway to leveraging Display and Editor templates. And of course using lambda expressions adds compile time support.
  • Data Annotation Validation: model validation now supports data type validations in the controller and returning the same view returns the correct validation error messages.

This really gets my interest in MVC going. The lack of controls is frustrating but I could live with out them. I cannot however live with out Data Annotation UI and validation support so this makes MVC much more approachable in the near term. The rest of the details are in the revised road map.

It looks like future previews will improve on all current features and add a few additional things to boot. How much get’s added to MVC v2 ultimately will be limited by the teams stated goal of being on the  VS 2010 DVD which will probably ship next spring.

More information:


Written by Lynn Eriksen

July 31, 2009 at 6:39 am

Posted in Uncategorized

Tagged with , ,

EntityDataSource Paging problems with providers for MySql

with one comment

Last week I was working on a small internal project that involved taking payment info, processing it thru a gateway, and saving to a database. I picked the Entity Framework for general data management and Dynamic Data to create my admin. Everything was good.

Snoopy should always be allowed!!!So I have gotten my admin set up quickly (used the XML Asp.Net membership providers on CodePlex – and I’m in the admin and trying to sort test payment records in the GridView. But it will not sort. So I look thru all the settings and everything appears correct. I try to look at the ESQL on the Selecting event but have a hard time finding that. I even eventually switch from dotConnect by Devart to Connector/net from MySql and still the same problem. No sorting – still! I feel like Snoopy in a hospital.

The only solution to get sorting was to TURN OFF AutoPaging – and that may be VERY problematic if database paging is turned off.  I really don’t want to return a large number of records for no reason, and MySQL does have paging support. So I am going to try to find some time to get make a sample project and sit down with Connector/Net, which I can get source for, and try to get at the bottom of it. Not sure when, but I’m hoping this blog post helps keep my feet to the fire.


Update: 2009-06-23 at 12:12 pm

Today I was able to confirm my suspicions.

When AutoPage is turned on for the EntityDataSource two commands are issued.

  • The first command looks up to total number of rows.
  • The second command applies the correct paging syntax at the end (for MySql this is ‘Limit start,count’) but the Order By syntax is ignored.

When paging is turned off there is a single command issued with out paging but they ‘Order By’ syntax is generated.

Update: 2009-06-24 at 11 am

Further investigation yesterday suggests this may be a issue with the providers in question or the EF assemblies in the framework, not the entity data source. I will try to investigate further today and post my finding to Microsoft, Devart and MySql.

Update: 2009-06-24 at 1:43 pm

Posted bug reports:

Also posted to the Devart Entity Framework forum.

Written by Lynn Eriksen

June 22, 2009 at 10:42 pm