Пример #1
0
        /// <summary>
        /// Update an existing ErrorMessage
        /// </summary>
        /// <param name="entity"></param>
        public void Update(ErrorMessage entity)
        {
            var set   = _entityContext.Set <ErrorMessage>();
            var entry = set.Local.SingleOrDefault(f => f.Id == entity.Id);

            if (entry != null)
            {
                var attachedFeature = _entityContext.Entry(entry);
                attachedFeature.CurrentValues.SetValues(entity);
                attachedFeature.State = EntityState.Modified;
            }
            else
            {
                _entityContext.ErrorMessages.Attach(entity);
                _entityContext.Entry(entity).State = EntityState.Modified;
            }
        }
        /// <summary>
        /// Update an existing CallStackPattern
        /// </summary>
        /// <param name="entity"></param>
        public void Update(CallStackPattern entity)
        {
            var set   = _entityContext.Set <CallStackPattern>();
            var entry = set.Local.SingleOrDefault(f => f.id == entity.id);

            if (entry != null)
            {
                var attachedFeature = _entityContext.Entry(entry);
                attachedFeature.CurrentValues.SetValues(entity);
                attachedFeature.State = EntityState.Modified;
            }
            else
            {
                _entityContext.CallStackPatterns.Attach(entity);
                _entityContext.Entry(entity).State = EntityState.Modified;
            }
        }
Пример #3
0
 /// <summary>
 /// Return a queryable string for query construction.
 ///
 /// NOTE - This is bad. Replace this method with proper expression tree construction and strictly return
 /// enumerated lisSet<T>(). All data handling should happen within the repository.
 /// </summary>
 /// <returns></returns>
 public IQueryable <T> ListAll()
 {
     return(_entityContext.Set <T>());
 }