コード例 #1
0
        public void Delete(object id)
        {
            var property = _context.FindPrimaryKey(typeof(TEntity));

            if (property != null)
            {
                var entity = Activator.CreateInstance <TEntity>();
                property.PropertyInfo.SetValue(entity, id);
                ((DbContext)_context).Entry(entity).State = EntityState.Deleted;
            }
            else
            {
                var entity = Entities.Find(id);
                if (entity != null)
                {
                    Delete(entity);
                }
            }
        }
コード例 #2
0
 private string KeyPropertiesCache(Type type)
 {
     return(_context.FindPrimaryKey(type).Name);
 }