public void AddDestination(Destination dest)
        {
            ObjectStateEntry existingOse;
            //create entity key on the fly in case we're using POCOs
            var destinationEntityKey = _context.CreateEntityKey(_context.CreateObjectSet <Destination>().Name, dest);

            if (!_context.ObjectStateManager.TryGetObjectStateEntry(destinationEntityKey, out existingOse))
            {
                _context.Destinations.AddObject(dest);
            }
            _currentTrip.DestinationID = dest.DestinationID;
        }
示例#2
0
 public List <T> GetUntrackedList <T>(Expression <Func <T, object> > sortProperty) where T : class
 {
     {
         var storedList = GetStoredList <T>();
         if (storedList == null)
         {
             var query = _context.CreateObjectSet <T>();
             query.MergeOption = MergeOption.NoTracking;
             storedList        = query.OrderBy(sortProperty).ToList();
             SetStoredList(storedList);
         }
         return(storedList);
     }
 }