This question is locked. New answers and comments are not allowed.
Dear Telerik Team,
I am a bit confused and wanted to know technically what exactly happens when i call each of these command, also which is preferable over another.
My scenario is in desktop application, where there is a LoginForm, in which:
1. User Logs In by giving username, password.
2. I changed password directly in the database against current user.
3. User Logs out.
4. User Logs in again by giving username and new password but context is still holding old password.
PROBLEM STATEMENT: HOW TO GET REFRESH DATA, BELOW IS MY CODE SNIPPED
01.
public
partial
class
LoginForm : Form
02.
{
03.
EntitiesModel _context =
null
;
04.
public
LoginForm()
05.
{
06.
InitializeComponent();
07.
}
08.
private
void
LoginForm_Load(
object
sender, EventArgs e)
09.
{
10.
_context =
new
EntitiesModel(Global.ConnectionString);
11.
}
12.
private
void
btnLogin_Click(
object
sender, EventArgs e)
13.
{
14.
USER user = _context.USERs.FirstOrDefault(u => u.USERNAME == txtUsername.Text.Trim() && u.PASSWORD == txtPassword.Text.Trim());
15.
16.
// after authentication show main menu etc
17.
}
18.
private
void
btnLogout_Click(
object
sender, EventArgs e)
19.
{
20.
//option 1: i dispose off current context here and create new context each time login button is clicked, so that context fetches latest password from database
21.
if
(_context !=
null
)
22.
_context.Dispose();
23.
24.
//option 2: i only release all entities from current context cache and use the same context each time login button is clicked rather creating new context
25.
_context.cache.ReleaseAll();
26.
}