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