How to create instance of a Dynamic Type? - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

How to create instance of a Dynamic Type?

  • How to create instance of a Dynamic Type?
  • 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);
  • 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!