i have such code
var menu = _dataManager.Menu.Details(id);
var menu2 = _dataManager.Menu.Details(id);
menu.Name = "AAA";
in this case menu2.Name will be "AAA", i guess it because of reference, but how can i solve it?
i have such code
var menu = _dataManager.Menu.Details(id);
var menu2 = _dataManager.Menu.Details(id);
menu.Name = "AAA";
in this case menu2.Name will be "AAA", i guess it because of reference, but how can i solve it?
Entity lazy loads data. Force the load and disconnect it from the Model and then it will not be AAA.
Eager load:
DataLoadOptions op = new DataLoadOptions();
op.LoadWith<Details>(x => x.Menu);
//etc...
_dataManager.LoadOptions = op;
Update: It appears that in the past I disconnect by copying the data out to a non-entity POCO.
Most likely the Details
method is set to return a single instance of the menu item regardless of how many times you put it into different variable names.
One solution would be to use a different dataManager object for the second menu item.