Dynamic data and creating new fields
I've used the following code to create two new custom fields for images:
App.WorkWith().DynamicData().Type(typeof(Image)).Field().TryCreateNew(CaptionFieldName, typeof(string)).SaveChanges(true); App.WorkWith().DynamicData().Type(typeof(Image)).Field().TryCreateNew(DestinationUrlFieldName, typeof(string)).SaveChanges(true);When run both of these fields get created, but instead of being strings (I want them as short text) they get created as "unknown" types and are therefore not available when managing images. What do I need to do different to ensure these fields for created properly?
Hi,
Make sure you call prior to executing the assigning of the custom fields.
var metaManager = Telerik.Sitefinity.Data.Metadata.MetadataManager.GetManager();
var type = metaManager.CreateMetaType(
typeof
(Image));
metaManager.SaveChanges();