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

Forums / General Discussions / Store data in DynamicData

Store data in DynamicData

15 posts, 0 answered
  1. H.J.E. Coppen
    H.J.E. Coppen avatar
    13 posts
    Registered:
    25 Nov 2008
    01 Sep 2010
    Link to this post
    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.
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    02 Sep 2010
    Link to this post
    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
  3. H.J.E. Coppen
    H.J.E. Coppen avatar
    13 posts
    Registered:
    25 Nov 2008
    07 Sep 2010
    Link to this post
    Is there, for the meantime, a other way to connect to this data table by the dataprovider of Sitefinity.
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    07 Sep 2010
    Link to this post
    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
  5. Garry Clark
    Garry Clark avatar
    26 posts
    Registered:
    27 Jan 2005
    18 Oct 2010
    Link to this post
    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!
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    18 Oct 2010
    Link to this post
    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
  7. Bill Y
    Bill Y avatar
    22 posts
    Registered:
    04 Nov 2010
    18 Nov 2010
    Link to this post
    So, is this still not ready to use in RC?
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    21 Nov 2010
    Link to this post
    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
  9. jocelyn payneau
    jocelyn payneau avatar
    51 posts
    Registered:
    07 Dec 2009
    30 Nov 2010
    Link to this post
    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
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    30 Nov 2010
    Link to this post
    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
  11. Saad
    Saad avatar
    98 posts
    Registered:
    10 Oct 2008
    02 Jan 2011
    Link to this post
    Just add using 

    using Telerik.Sitefinity.Model;

    it`ll work!
  12. H.J.E. Coppen
    H.J.E. Coppen avatar
    13 posts
    Registered:
    25 Nov 2008
    09 Feb 2011
    Link to this post
    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")..............


  13. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Feb 2011
    Link to this post
    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
  14. H.J.E. Coppen
    H.J.E. Coppen avatar
    13 posts
    Registered:
    25 Nov 2008
    09 Feb 2011
    Link to this post
    Hi,

    I created a new table ("VVNInfo"). So I need to get Type("VVNInfo")?  
  15. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Feb 2011
    Link to this post
    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
15 posts, 0 answered