Skip to content

Commit

Permalink
feat: add GetAll method
Browse files Browse the repository at this point in the history
  • Loading branch information
rigofunc committed Nov 4, 2017
1 parent 028822b commit 6ed4815
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Host/Models/BlogggingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public BloggingContext(DbContextOptions<BloggingContext> options)

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.EnableAutoHistory();
modelBuilder.EnableAutoHistory(null);
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/Microsoft.EntityFrameworkCore.UnitOfWork/IRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,13 @@ Task<TEntity> GetFirstOrDefaultAsync(Expression<Func<TEntity, bool>> predicate =
/// <returns>A <see cref="Task{TEntity}"/> that represents the asynchronous find operation. The task result contains the found entity or null.</returns>
Task<TEntity> FindAsync(object[] keyValues, CancellationToken cancellationToken);

/// <summary>
/// Gets all entities. This method is not recommended
/// </summary>
/// <returns>The <see cref="IQueryable{TEntity}"/>.</returns>
[Obsolete("This method is not recommended, please use GetPagedList or GetPagedListAsync methods")]
IQueryable<TEntity> GetAll();

/// <summary>
/// Gets the count based on a predicate.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>A plugin for Microsoft.EntityFrameworkCore to support repository, unit of work patterns, and multiple database with distributed transaction supported.</Description>
<VersionPrefix>2.0.0</VersionPrefix>
<VersionPrefix>2.0.2</VersionPrefix>
<Authors>rigofunc;[email protected];</Authors>
<TargetFramework>netstandard2.0</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
Expand Down
12 changes: 12 additions & 0 deletions src/Microsoft.EntityFrameworkCore.UnitOfWork/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ public void ChangeTable(string table)
}
}


/// <summary>
/// Gets all entities. This method is not recommended
/// </summary>
/// <returns>The <see cref="IQueryable{TEntity}"/>.</returns>
[Obsolete("This method is not recommended, please use GetPagedList or GetPagedListAsync methods")]
public IQueryable<TEntity> GetAll()
{
return _dbSet;
}


/// <summary>
/// Gets the <see cref="IPagedList{TEntity}"/> based on a predicate, orderby delegate and page information. This method default no-tracking query.
/// </summary>
Expand Down

0 comments on commit 6ed4815

Please sign in to comment.