How to create instance of a Dynamic Type?

Posted by Community Admin on 05-Aug-2018 22:39

How to create instance of a Dynamic Type?

All Replies

Posted by Community Admin on 01-Mar-2011 00:00

In the documentation you have the below example for how to create a DynamicType, but after creating the dynamic "ContactInfo" type how can I create an instance of it?

 App.WorkWith()
       .DynamicData()
       .Type()
       .CreateNew("ContactInfo", "Telerik.Sitefinity.DynamicTypes.Model")
       .Do(dt => dt.DatabaseInheritance = DatabaseInheritanceType.vertical)
       .Field()
            .CreateNew("FirstName", typeof(string))
            .Done()
       .Field()
            .CreateNew("LastName", typeof(string))
            .Done()
       .Field()
            .CreateNew("Age", typeof(int))
            .Done()
       .SaveChanges(true);

Posted by Community Admin on 02-Mar-2011 00:00

Hello Joseph,

You need to create manager and provider if you want to use the custom type as an instance.The Sitefinity API does not currently allow you to manage dynamic types without having a manager. We are planning to include a new manager that will automate this and make it easier for you to create new dynamic types and work with them. Please take a look at this post for more information.


Greetings,
Ivan Dimitrov
the Telerik team

Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!

This thread is closed