EF updates, database value changes, front-end page does not change, refresh does not change, and re-run the program changes ---- problems encountered during development (solved), ef ----

Source: Internet
Author: User

EF updates, database value changes, front-end page does not change, refresh does not change, and re-run the program changes ---- problems encountered during development (solved), ef ----

First, let's talk about the code scenario in which I encountered this situation. First, let's go to the error code.

UserInfo userInfo = Session ["UserInfo"] as UserInfo; var attentionTopicInfos = userInfo. TopicInfos. Where (t => t. TopicId> 0 );

The problem presented by this Code is as follows: the database value changes, the front-end page does not change, the refresh does not change, and the re-running of the program changes.

Breakpoint debugging-the content of the detected attentionTopicInfos does not change regardless of the update.

 

The last thought ---- userInfo is retrieved from the Session. The session stores the user login information and the content is not updated.

The TopicInfos we need is the navigation attribute, and the content of this attribute is also in the session.

 

Modify code

UserInfo userInfo = Session ["UserInfo"] as UserInfo; userInfo = _ userInfoService. getEntitesQueryable (u => u. userGuidId = userInfo. userGuidId ). first (); // re-query userInfovar attentionTopicInfos = userInfo. topicInfos. where (t => t. topicId> 0 );

 

The problem is resolved successfully. Although the solution is simple, I believe it will often happen during development, and I did not find any related articles when dealing with the problem,

So I would like to share with you here.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.