public object GetObjectToSerialize(object obj, Type targetType)
        {
            var order = obj as Order;

            if (order == null)
            {
                return obj;
            }

            var orderSurrogated = new OrderSurrogated
            {
                CustomerID = order.CustomerID,
                EmployeeID = order.EmployeeID,
                Freight = order.Freight,
                OrderDate = order.OrderDate,
                OrderID = order.OrderID,
                RequiredDate = order.RequiredDate,
                ShipAddress = order.ShipAddress,
                ShipCity = order.ShipCity,
                ShipCountry = order.ShipCountry,
                ShipName = order.ShipName,
                ShipPostalCode = order.ShipPostalCode,
                ShipRegion = order.ShipRegion,
                ShipVia = order.ShipVia,
                ShippedDate = order.ShippedDate
            };

            return orderSurrogated;
        }
Esempio n. 2
0
 public object GetObjectToSerialize(object obj, Type targetType)
 {
     if (obj is Order)
     {
         OrderSurrogated orderSurrogated = new OrderSurrogated
         {
             CustomerID = ((Order)obj).CustomerID,
             EmployeeID = ((Order)obj).EmployeeID,
             Freight = ((Order)obj).Freight,
             OrderDate = ((Order)obj).OrderDate,
             OrderID = ((Order)obj).OrderID,
             RequiredDate = ((Order)obj).RequiredDate,
             ShipAddress = ((Order)obj).ShipAddress,
             ShipCity = ((Order)obj).ShipCity,
             ShipCountry = ((Order)obj).ShipCountry,
             ShipName = ((Order)obj).ShipName,
             ShipPostalCode = ((Order)obj).ShipPostalCode,
             ShipRegion = ((Order)obj).ShipRegion,
             ShipVia = ((Order)obj).ShipVia,
             ShippedDate = ((Order)obj).ShippedDate
         };
         return orderSurrogated;
     }
     return obj;
 }