Ejemplo n.º 1
0
        public IDeliveryFlyweight MakeLocation(DeliveryLocationData intrinsicState)
        {
            var key = CreateId(intrinsicState);

            if (_locations.ContainsKey(key))
            {
                return(_locations[key]);
            }

            _locations[key] = new DeliveryLocation(intrinsicState);
            return(_locations[key]);
        }
Ejemplo n.º 2
0
 private string CreateId(DeliveryLocationData data)
 {
     return(data.Street.ToLower() + data.City.ToLower());
 }
Ejemplo n.º 3
0
 public DeliveryLocation(DeliveryLocationData intrinsicState)
 {
     _intrinsicState = intrinsicState;
 }