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

Forums / Developing with Sitefinity / GetContents ID and use external Tables

GetContents ID and use external Tables

4 posts, 0 answered
  1. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    22 Dec 2008
    Link to this post
    Hi,

    I have read all post about GetContents method and how use it but I can't solution for my current problem.
    During Inserting, (post a news or an events) before saveButton1 is completed, exist some way to see the future ID item and store to one external table and how?. I need to link one complementary table of datas with my news using the ID of item or similar as internal relation. Actually i use one Metafield as key to the link.

    I need one advice is same way. I use one external table to store complexes elements in more than 40 columns varchar and some int, in other way this elements are in Metafields stored (double data storage). What is more speed searching method : using GetMethods for Metafields or searching with current methods from sql query and table looping in array. Exist another way to see the Metafields stored like single speed method.
     
    Thanks. 
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    22 Dec 2008
    Link to this post
    Hi Pierre,

    Unfortunately it is not possible to get the content ID before the button click is performed. We are creating the item after the postback is sent, and the postback is generated by the button click.
    I am pasting the code which help you to get the generic content ID after the postback for any case:
    global.asax
        void Application_Start(object sender, EventArgs e) 
        { 
            Telerik.Cms.Engine.ContentManager.Executing += new EventHandler<Telerik.ExecutingEventArgs>(ContentManager_Executing); 
     
        } 
     
        void ContentManager_Executing(object sender, Telerik.ExecutingEventArgs e) 
        { 
            if (e.CommandName="CreateContent"
            { 
                Telerik.Cms.Engine.IContent cnt = e.CommandArguments as Telerik.Cms.Engine.IContent; 
                if (cnt!=null && cnt.ProviderName == "News"
                { 
                    //get the id, you can post it to your tables.
                     cnt.ID; 
                } 
            } 
        } 

    Kind regards,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    22 Dec 2008
    Link to this post
    Hi Georgi,

    Thanks I will try using global asax. Could you see the other question about performance of querying using GetMethods or standard SQL queries to see the contents. I work in very sensitive time response application using Ajax methods to post my response and querying the metafields from sf or external tables. I use mixed tables with contents inside sf tables metafields and external tables with others items. This have some consequences about storage place and performance and I need to make some tactical choice before send in production mode. Have you performed some test ? The critical point for me is the time to build the dataset, because after i need to iterate throw the items to generate the Ajax response. Some advice?

    Regards
     
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    29 Dec 2008
    Link to this post
    Hi Pierre,

    Querying the database instead of GetContents() could be faster in some cases, and it really depends on the number of items. Direct querying will be faster because you will skip the Data access layer, which makes the APIs convenient with some performance cost. You might think for some sort of caching and some cache refresh dependency (for example taking back the fresh data from the database on every 5 minutes, otherwise take the data from the memory). If you succeed to take the data from the memory instead of the database, you will have no worries.

    Kind regards,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered