How to avoid the cache or concurrency in telerik data access ORM?

6 posts, 0 answers
  1. Liu
    Liu avatar
    3 posts
    Member since:
    Aug 2014

    Posted 01 Aug 2014 Link to this post


    Now I want to calculate the average concentration of pm2.5 these days in each city through stored procedure .The first input parameter of the stored procedure is cityname string like Beijing,NewYork,and the other input parameters are beginTime and endTime.And the output class is called AvgPM25.
    public class AvgPM25{
    public String CityName{get;set;}
    public decimal AvgValue{get;set;}
    }

    I pass parameters like
    Beijing,NewYork,20140801,20140802
    ,it calculate and output the result.Now my problem is sometimes I try to change the parameters like search time,and the input parameters are like
    Beijing,NewYork,20130801,20140802
    ,but it still output the result which is the previous search result.Is this problem due to the cache or concurrentcy?I try to set identity of 'CityName' of the AvgPM25 class property to be True,and set the cache policy to be NoCache,and set the concurrency mode to be Changed but still have this problem?How to fix it?

  2. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 04 Aug 2014 Link to this post

    Hi Liu,

    OpenAccess does not cache the results of stored procedure calls. I guess, that the changed parameters will not lead to different results because the data in the database is not changed (yet).
    Can you post how you are calling the stored procedure? Also, you do not need to make the result type persistent.

    Regards,
    Thomas
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  3. DevCraft banner
  4. Liu
    Liu avatar
    3 posts
    Member since:
    Aug 2014

    Posted 05 Aug 2014 in reply to Thomas Link to this post

     
    Thomas said:Hi Liu,

    OpenAccess does not cache the results of stored procedure calls. I guess, that the changed parameters will not lead to different results because the data in the database is not changed (yet).
    Can you post how you are calling the stored procedure? Also, you do not need to make the result type persistent.

    Regards,
    Thomas
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     

    Yes,my stored procedure do not change the database.My stored procedure just calculate and output the average concentration of pm2.5.
    "you do not need to make the result type persistent" what does this mean?If the result type is persistent,and then What is the role of this persistent?  .I call the stored procedure like this:
     using (var dbContext = new EntitiesModel())
                {
                    return dbContext.CalculateAvg(CityName,startDateTime, endDateTime);
                }
  5. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 05 Aug 2014 Link to this post

    Hello Liu/Xi,

    could you please be so kind and paste the CalculateAvg method here too?

    Regards,
    Thomas
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  6. Liu
    Liu avatar
    3 posts
    Member since:
    Aug 2014

    Posted 06 Aug 2014 in reply to Thomas Link to this post

    Thomas said:Hello Liu/Xi,

    could you please be so kind and paste the CalculateAvg method here too?

    Regards,
    Thomas
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     

    CalculateAvg is the stored procedure.I just do follow the teaching material Using the Context API Approach.
  7. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 08 Aug 2014 Link to this post

    Hello Liu,

    I don't see that we are caching results from stored procedure calls. Just in case you use the second level cache (database level cache): Could you turn off caching to see if this makes a differerence?

    Regards,
    Thomas
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
Back to Top
DevCraft banner