public object GetDeserializedObject(object obj, Type targetType) { var orderSurrogated = obj as OrderSurrogated; if (orderSurrogated == null) { return obj; } var order = new Order { CustomerID = orderSurrogated.CustomerID, EmployeeID = orderSurrogated.EmployeeID, Freight = orderSurrogated.Freight, OrderDate = orderSurrogated.OrderDate, OrderID = orderSurrogated.OrderID, RequiredDate = orderSurrogated.RequiredDate, ShipAddress = orderSurrogated.ShipAddress, ShipCity = orderSurrogated.ShipCity, ShipCountry = orderSurrogated.ShipCountry, ShipName = orderSurrogated.ShipName, ShipPostalCode = orderSurrogated.ShipPostalCode, ShipRegion = orderSurrogated.ShipRegion, ShipVia = orderSurrogated.ShipVia, ShippedDate = orderSurrogated.ShippedDate }; return order; }
public object GetDeserializedObject(object obj, Type targetType) { if (obj is OrderSurrogated) { Order order = new Order { CustomerID = ((OrderSurrogated)obj).CustomerID, EmployeeID = ((OrderSurrogated)obj).EmployeeID, Freight = ((OrderSurrogated)obj).Freight, OrderDate = ((OrderSurrogated)obj).OrderDate, OrderID = ((OrderSurrogated)obj).OrderID, RequiredDate = ((OrderSurrogated)obj).RequiredDate, ShipAddress = ((OrderSurrogated)obj).ShipAddress, ShipCity = ((OrderSurrogated)obj).ShipCity, ShipCountry = ((OrderSurrogated)obj).ShipCountry, ShipName = ((OrderSurrogated)obj).ShipName, ShipPostalCode = ((OrderSurrogated)obj).ShipPostalCode, ShipRegion = ((OrderSurrogated)obj).ShipRegion, ShipVia = ((OrderSurrogated)obj).ShipVia, ShippedDate = ((OrderSurrogated)obj).ShippedDate }; return order; } return obj; }