views:

227

answers:

1

I have decorated my model using Metadata classes attached to my model classes via the MetadataType attribute. I have some use the Range attribute, Required attribute, etc. and some custom attributes I have created.

Now I want to hook into the rendering engine (or whatever it is called) of the Dynamic Data framework and be able to change the way the UI is rendered based on my custom attributes as well as the standard System.ComponentModel.DataAnnotations attributes.

Also, I might want to use ASP.NET MVC, so keep that in mind.

How do I do that? Pointing me to links would be great if you don't want to be verbose about explaining the nitty-gritty.

Thanks!

+1  A: 

There is a dynamic data project for ASP.NET MVC, but I think it is pretty much on hold:

http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=15459

I looked at it a while back and it partly worked, but I don't think it works with the latest bits. I think eventually they are going to pull everything together, but it will be some time. What I do right now is I have some helper classes that read the metadata for example to show required fields, but I am not using the full blown rendering of dynamic data. You can pull the metadata like this:

public static MetaColumn GetColumn(Type t, string columnName)
{
  MetaModel model = new MetaModel();
  MetaTable table = model.GetTable(t);
  MetaColumn column = table.GetColumn(columnName);
  return column;
}

public static string GetDisplayName(Type t, string columnName)
{
  MetaColumn column = GetColumn(t, columnName);
  return column.DisplayName;
}

For now I'm just using some of the metadata. Would like to know if you come up with anything further that this.

Trevor de Koekkoek
Thanks, we are delving pretty deep into this thing and hope to have a solution. We are using that MVC app against the latest bits (well, Beta) and things are going well enough. Will let you know if I can remember to do so!!! Thank you for responding!
Jason Bunting