Dynamic Fields

This topic covers the concept of working with dynamic fields.

Creating a new dynamic field

Creating new dynamic field (meta field in 3.x) could be done easily with the fluent API. In the following example, we will create a new dynamic field to the News content items. This field will be accessible for every news item.

using Telerik.Sitefinity;
using Telerik.Sitefinity.News.Model;
using Telerik.Sitefinity.Metadata.Model;
...
 
protected void addDynamicField_Click(object sender, EventArgs e)
{
    App.WorkWith()
       .DynamicData()
       .Type(typeof(NewsItem))
       .Field()
            .TryCreateNew("ResearcherName", typeof(string))
            .SaveChanges(true);
}

As you can see from the example, we are working with the DynamicData facade. This facade provides methods for retrieving the field information (for example). DynamicData() itself (DynamicData) gives the developers methods for both working with a single field, or collection of fields.

As mentioned in the Dynamic Data section, this code will create a new ResearcherName column in the table related to the NewsItem type. This is possible thanks to the Telerik OpenAccess ORM.

Next steps

+1-888-365-2779
sales@sitefinity.com

Related topics:

Feedback

How useful is this article?

Tell us more

Submit
Your message was successfully sent.

We appreciate your feedback.

Your message could not be sent.

OK