c# - Is using navigation properties to "Add" related items slow? -
i have device
list of other devicelogentry
. device.logs
navigational property , add new logs so
device.logs.add(newentry);
logs defined so
public virtual icollection<devicelogentry> logs { get; set; }
my question load entire logs
table before adding new one? if (this slow logs contains lots of entries). better (faster) alternative?
looks issue aren't fixing now: http://entityframework.codeplex.com/workitem/683
couple of things try.
- disable lazy loading entity removing virtual
- do addition other way around if applicable
for point 2, case of exposing deviceid on log table, , instead of doing:
device.logs.add(newentry);
would like:
newentry.deviceid = _deviceid; context.logs.add(newentry);
Comments
Post a Comment