Example #1
0
        /// <summary>
        /// Makes changes to an existing entity in the persistent storage.
        /// </summary>
        /// <typeparam name="TEntity">Type of the stored entity.</typeparam>
        /// <param name="id">Identifier of the entity that should be changed.</param>
        /// <param name="changes">Changes to apply to the entity.</param>
        /// <returns>A task that will complete when the changes have been applied.</returns>
        public async Task Change <TEntity>(int id, Action <TEntity> changes) where TEntity : EntityBase
        {
            var entity = await _db.Set <TEntity>().SingleAsync(x => x.Id == id);

            changes(entity);
        }
 /// <summary>
 /// Gets a queryable to access entities of the specified type.
 /// </summary>
 /// <typeparam name="T">Type of the entities to query.</typeparam>
 /// <returns>A queryable to access entities of the specified type.</returns>
 public IQueryable <T> Get <T>() where T : EntityBase
 {
     return(_db.Set <T>());
 }