Пример #1
0
        public static Device CloneDeviceDeep(SystemContext context, Device device)
        {
            var cloneDevice = (Device)context.Entry(device).CurrentValues.ToObject();

            if (device.DisturbanceRecordings != null && device.DisturbanceRecordings.Count > 0)
            {
                cloneDevice.DisturbanceRecordings = CloneAllDisturbanceRecordings(context, device);
            }

            return(cloneDevice);
        }
Пример #2
0
 public static Device CloneDeviceShallow(SystemContext context, Device device)
 {
     return((Device)context
            .Entry(device)
            .CurrentValues.ToObject());
 }
Пример #3
0
 public static DisturbanceRecording CloneDisturbanceRecording(SystemContext context, DisturbanceRecording disturbanceRecording)
 {
     return((DisturbanceRecording)context
            .Entry(disturbanceRecording)
            .CurrentValues.ToObject());
 }