rostamiani
Member
- Joined
- Oct 9, 2009
- Messages
- 15
- Programming Experience
- 10+
I'm using Entity Framework 6 with VB.NET.
The problem is that when I add a new 'user' object to the context, an additional user is added.
This is the code:
See the count of users before and after adding

The first user that is added is NewUser object and the second one is CurrentUser!!!
Is this a bug?
The problem is that when I add a new 'user' object to the context, an additional user is added.
This is the code:
VB.NET:
Dim Db As New DbModel
' Create a new user
Dim NewUser = New User With {
.UserName = txtUserName.Text.Trim,
.Password = txtPassword.Text.Trim,
.Department = cmbDepartment.SelectedValue,
.UserGroup = CmbUserGroup.SelectedValue,
.Owner = CurrentUser,
.Enabled = True
}
' Add new user to the model
Db.Users.Add(NewUser)
See the count of users before and after adding

The first user that is added is NewUser object and the second one is CurrentUser!!!
Is this a bug?