This is a migrated thread and some comments may be shown as answers.

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

5 Answers 71 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Liu
Top achievements
Rank 1
Liu asked on 02 Aug 2014, 04:48 AM

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?

5 Answers, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 04 Aug 2014, 07:40 PM
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.
 
0
Liu
Top achievements
Rank 1
answered on 05 Aug 2014, 04:14 PM
 [quote]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.
 
[/quote]
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);
            }
0
Thomas
Telerik team
answered on 05 Aug 2014, 07:44 PM
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.
 
0
Liu
Top achievements
Rank 1
answered on 06 Aug 2014, 06:36 AM
[quote]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.
 
[/quote]
CalculateAvg is the stored procedure.I just do follow the teaching material Using the Context API Approach.
0
Thomas
Telerik team
answered on 08 Aug 2014, 07:41 AM
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.
 
Tags
General Discussions
Asked by
Liu
Top achievements
Rank 1
Answers by
Thomas
Telerik team
Liu
Top achievements
Rank 1
Share this question
or