+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / How to create instance of a Dynamic Type?

How to create instance of a Dynamic Type?

2 posts, 0 answered
  1. Apptain
    Apptain avatar
    30 posts
    Registered:
    20 Aug 2012
    01 Mar 2011
    Link to this post
    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);
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    02 Mar 2011
    Link to this post
    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!
2 posts, 0 answered