Store data in DynamicData

Posted by Community Admin on 03-Aug-2018 14:19

Store data in DynamicData

All Replies

Posted by Community Admin on 01-Sep-2010 00:00

I Created a new DynamicData Table ‘VVNInfo’ as showed below.


            App.WorkWith()
                  .DynamicData()
                  .Type()
                  .CreateNew("VVNInfo", "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);

Now I would like to store some data in this table. Can you tell me how I can do this. In the example below this is done for de Documents. But how does it work with the dynamic data table.

            string title = firstName + " " + lastName;
            
            if (App.WorkWith().Documents().Where(d => d.Title == title).Get().Count() > 0) throw new Exception("The user already submitted his document");

            var settings = App.Prepare();
            settings.TransactionName = "myTransaction";

            App.Prepare(settings).WorkWith().Document().ContentManager.Provider.SuppressSecurityChecks = true;

            App.Prepare(settings).WorkWith().Document().CreateNew().Do(item =>
            
                item.Parent = App.Prepare(settings).WorkWith().DocumentLibraries().Where(l => l.Title == "JobApplications").Get().FirstOrDefault();
                item.Title = title;
                item.UrlName = title + "_Application";
                item.SetValue("FirstName", firstName);
                item.SetValue("LastName", lastName);
                item.SetValue("Phone", phone);
                item.SetValue("HowDidYouHear", howDidYouHear);
            ).UploadMedia(applicationFile.InputStream, applicationFile.GetExtension()).SaveChanges();


Kind Regards,

Hugo Coppen.

Posted by Community Admin on 02-Sep-2010 00:00

Hello H.J.E. Coppen,

Thank you for using our services.

The Fluent API does not support working with Dynamic Data in terms of instantiating items and saving them in the database. Support for this will come with the Release Candidate, planned to for release in October.

Kind regards,
Radoslav Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 07-Sep-2010 00:00

Is there, for the meantime, a other way to connect to this data table by the dataprovider of Sitefinity.

Posted by Community Admin on 07-Sep-2010 00:00

Hi H.J.E. Coppen,

Unfortunately there a no Native API methods exposed for working with dynamic data either. This means that for the purposes of working with the dynamic data you need to create a MetaDataProvider which inherits from the OpenAccessMetaDataProvider class and implement the CreateItem methods. Right now those methods are not supported. We are planning a release by the end of this month and we are planning to implement this in the FluentAPI.

Sincerely yours,
Radoslav Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 18-Oct-2010 00:00

Radoslav,
Any update on the next release with the Fluent API being able to manipulate DynamicData tables? If not would it just be best to use OpenAccess as I normally would and create a DataModel?

I had a similar thread going, http://www.sitefinity.com/devnet/forums/sitefinity-4-x/sdk/fluent-api-and-dynamicdata.aspx,  which I was pointed to this one from.

Thanks!

Posted by Community Admin on 18-Oct-2010 00:00

Hi Garry Clark,

Thank you for joining the conversation.

We still have much work to do with the dynamic data and is not yet ready for use. Once we have it polished up we will update our documentation with samples on how to work with it.

Regards,
Radoslav Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 18-Nov-2010 00:00

So, is this still not ready to use in RC?

Posted by Community Admin on 21-Nov-2010 00:00

Hello Bill,

There is a DynamicFieldsFacade that you can use

Regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 30-Nov-2010 00:00

Hello,

I have the same problem with the "How to create a module" tutorial.
Here is the visual studio compilator message: 'Telerik.Sitefinity.Libraries.Model.Document does'nt contains a definition for SetValue...". Do I need to insert an assembly reference?

Is this is now available in RC? My RC4 version is dated from 22 november 2010. I need this works for my project because we start with RC. Is there any walkthrough? Have you some examples?

Regards

Jocelyn PAYNEAU

Posted by Community Admin on 30-Nov-2010 00:00

Hi jocelyn,

SetValue is a data extension. Please make sure that you have reference to Telerik.Sitefinity.Model

Name: Telerik.Sitefinity.Model.DataExtensions
Assembly: Telerik.Sitefinity.Model
The extension is available in the RC.

Greetings,
Ivan Dimitrov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

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

Just add using 

using Telerik.Sitefinity.Model;

it`ll work!

Posted by Community Admin on 09-Feb-2011 00:00

Is there a example how to use DynamicFieldsFacade? So how do I store Data in a dynamic created table (VVNInfo).

App.WorkWith()
                  .DynamicData()
                  .Type()
                  .CreateNew("VVNInfo", "Telerik.Sitefinity.DynamicTypes.Model")..............


Posted by Community Admin on 09-Feb-2011 00:00

Hi,

Here is a sample that create a new field for NewsItem and then set it

App.WorkWith().DynamicData().Type(typeof(NewsItem)).Field().CreateNew("somevalue", typeof(string)).SaveChanges();
            
var itm = App.WorkWith().NewsItems().Where(ni => ni.Title == "test").Get().SingleOrDefault();
itm.SetValue("CustomFiledName", "someValue");


Best wishes,
Ivan Dimitrov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 09-Feb-2011 00:00

Hi,

I created a new table ("VVNInfo"). So I need to get Type("VVNInfo")?  

Posted by Community Admin on 09-Feb-2011 00:00

Hi,

I am not sure how creating the table is related to the dynamic type. You should have a type that implements IDynamicFieldsContainer. This is the requirement to use DynamicData.
You can use DynamicData with types like NewsItem, ContentItem, EventItem etc.

Best wishes,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed