I would like to be able to specify MetaData at runtime. I have a DB table that is for generic use. We store all sorts of list style data in it, but the fields are used for different purposes based on the purpose of the list and all have generic names.
What I would like to do is be able to dynamically switch out what the Label and UIHint will be on the fields after I get the data from the database, based on a configuration file for that particular list.
It seems that the ability to switch the MetaData is something that is in the futures release, but I didn't see any samples of how to do it properly. Also, maybe I am barking up the wrong tree with the meta data. What about having a custom FieldTemplate
that would just load the requested field template according to the schema.
In V1 of Dynamic Data the metadata con only be set as web application startup if you want to reload the metadata you will need to restart the the web application.
however if you just want to load the metadata dynamically at runtime (once only at app startup) the look at the
DynamicDataFutures0716.zip which has support for "Add metadata to objects at runtime".
Hope this helps [:D]
Dynamic DataFuturesLoad Metadata at runtime
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
lucasstark
Member
123 Points
42 Posts
MetaData at Runtime
Nov 21, 2008 01:28 PM|LINK
I would like to be able to specify MetaData at runtime. I have a DB table that is for generic use. We store all sorts of list style data in it, but the fields are used for different purposes based on the purpose of the list and all have generic names. What I would like to do is be able to dynamically switch out what the Label and UIHint will be on the fields after I get the data from the database, based on a configuration file for that particular list.
It seems that the ability to switch the MetaData is something that is in the futures release, but I didn't see any samples of how to do it properly. Also, maybe I am barking up the wrong tree with the meta data. What about having a custom FieldTemplate that would just load the requested field template according to the schema.
Thanks,
sjnaughton
All-Star
25698 Points
5169 Posts
MVP
Re: MetaData at Runtime
Nov 21, 2008 02:05 PM|LINK
In V1 of Dynamic Data the metadata con only be set as web application startup if you want to reload the metadata you will need to restart the the web application.
however if you just want to load the metadata dynamically at runtime (once only at app startup) the look at the
DynamicDataFutures0716.zip which has support for "Add metadata to objects at runtime".
Hope this helps [:D]
Dynamic Data Futures Load Metadata at runtime
Always seeking an elegant solution.
scothu
Participant
1424 Points
290 Posts
AspNetTeam
Microsoft
Moderator
Re: MetaData at Runtime
Nov 21, 2008 02:07 PM|LINK
Futures: http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=14475
Check out the Global.asax file. It shows metadata being added dynamically at model registration.
PM, ASP.NET Team, Microsoft
lucasstark
Member
123 Points
42 Posts
Re: MetaData at Runtime
Nov 21, 2008 02:16 PM|LINK
Thanks. I'll take a look