diff --git a/src/DotNetToolkit.Repository.EntityFramework/Internal/EfRepositoryContext.cs b/src/DotNetToolkit.Repository.EntityFramework/Internal/EfRepositoryContext.cs index ea8f2f5b..2d6509fa 100644 --- a/src/DotNetToolkit.Repository.EntityFramework/Internal/EfRepositoryContext.cs +++ b/src/DotNetToolkit.Repository.EntityFramework/Internal/EfRepositoryContext.cs @@ -16,10 +16,6 @@ using Transactions; using Utility; - /// - /// An implementation of . - /// - /// internal class EfRepositoryContext : LinqRepositoryContextBaseAsync, IEfRepositoryContext { #region Fields @@ -30,10 +26,6 @@ internal class EfRepositoryContext : LinqRepositoryContextBaseAsync, IEfReposito #region Constructors - /// - /// Initializes a new instance of the class. - /// - /// The context. public EfRepositoryContext(DbContext context) { Conventions = RepositoryConventions.Default(); @@ -46,42 +38,22 @@ public EfRepositoryContext(DbContext context) #region Implementation of IEfRepositoryContext - /// - /// Gets the underlying context. - /// public DbContext UnderlyingContext { get { return _context; } } #endregion #region Implementation of IRepositoryContext - /// - /// Returns the entity's query. - /// - /// The type of the of the entity. - /// The entity's query. protected override IQueryable AsQueryable() { return _context.Set().AsQueryable(); } - /// - /// Apply a fetching options to the specified entity's query. - /// - /// The entity's query with the applied options. protected override IQueryable ApplyFetchingOptions(IQueryable query, IQueryOptions options) { return query.ApplyFetchingOptions(Conventions, options); } - /// - /// Creates a raw SQL query that is executed directly in the database and returns a collection of entities. - /// - /// The SQL query string. - /// The command type. - /// The parameters to apply to the SQL query string. - /// A function to project each entity into a new form. - /// A list which each entity has been projected into a new form. public override IEnumerable ExecuteSqlQuery(string sql, CommandType cmdType, Dictionary parameters, Func projector) { Guard.NotEmpty(sql, nameof(sql)); @@ -112,13 +84,6 @@ public override IEnumerable ExecuteSqlQuery(string sql, Comman } } - /// - /// Creates a raw SQL query that is executed directly in the database. - /// - /// The SQL query string. - /// The command type. - /// The parameters to apply to the SQL query string. - /// The number of rows affected. public override int ExecuteSqlCommand(string sql, CommandType cmdType, Dictionary parameters) { Guard.NotEmpty(sql, nameof(sql)); @@ -149,10 +114,6 @@ public override int ExecuteSqlCommand(string sql, CommandType cmdType, Dictionar } } - /// - /// Begins the transaction. - /// - /// The transaction. public override ITransactionManager BeginTransaction() { CurrentTransaction = new EfTransactionManager(_context.Database.BeginTransaction()); @@ -160,21 +121,11 @@ public override ITransactionManager BeginTransaction() return CurrentTransaction; } - /// - /// Tracks the specified entity in memory and will be inserted into the database when is called. - /// - /// The type of the entity. - /// The entity. public override void Add(TEntity entity) { _context.Set().Add(Guard.NotNull(entity, nameof(entity))); } - /// - /// Tracks the specified entity in memory and will be updated in the database when is called. - /// - /// The type of the entity. - /// The entity. public override void Update(TEntity entity) { Guard.NotNull(entity, nameof(entity)); @@ -198,11 +149,6 @@ public override void Update(TEntity entity) } } - /// - /// Tracks the specified entity in memory and will be removed from the database when is called. - /// - /// The type of the entity. - /// The entity. public override void Remove(TEntity entity) { Guard.NotNull(entity, nameof(entity)); @@ -224,24 +170,11 @@ public override void Remove(TEntity entity) } } - /// - /// Saves all changes made in this context to the database. - /// - /// - /// The number of state entries written to the database. - /// public override int SaveChanges() { return _context.SaveChanges(); } - /// - /// Finds an entity with the given primary key values in the repository. - /// - /// The type of the of the entity. - /// Defines the child objects that should be retrieved when loading the entity. - /// The values of the primary key for the entity to be found. - /// The entity found in the repository. public override TEntity Find(IFetchQueryStrategy fetchStrategy, params object[] keyValues) { Guard.NotEmpty(keyValues, nameof(keyValues)); @@ -260,55 +193,31 @@ public override TEntity Find(IFetchQueryStrategy fetchStrategy #region Implementation of IRepositoryContextAsync - /// - /// An overridable method to return the first element of a sequence, or a default value if the sequence contains no elements. - /// protected override Task FirstOrDefaultAsync(IQueryable source, CancellationToken cancellationToken) { return source.FirstOrDefaultAsync(cancellationToken); } - /// - /// An overridable method to create a from an by enumerating it asynchronously. - /// protected override Task> ToListAsync(IQueryable source, CancellationToken cancellationToken) { return source.ToListAsync(cancellationToken); } - /// - /// An overridable method to return the number of elements in a sequence. - /// protected override Task CountAsync(IQueryable source, CancellationToken cancellationToken) { return source.CountAsync(cancellationToken); } - /// - /// An overridable method to determine whether a sequence contains any elements. - /// protected override Task AnyAsync(IQueryable source, CancellationToken cancellationToken) { return source.AnyAsync(cancellationToken); } - /// - /// An overridable method to create a from an by enumerating it asynchronously according to a specified key selector and an element selector function. - /// protected override Task> ToDictionaryAsync(IQueryable source, Func keySelector, Func elementSelector, CancellationToken cancellationToken) { return source.ToDictionaryAsync(keySelector, elementSelector, cancellationToken); } - /// - /// Asynchronously creates raw SQL query that is executed directly in the database and returns a collection of entities. - /// - /// The SQL query string. - /// The command type. - /// The parameters to apply to the SQL query string. - /// A function to project each entity into a new form. - /// A to observe while waiting for the task to complete. - /// The that represents the asynchronous operation, containing a list which each entity has been projected into a new form. public override async Task> ExecuteSqlQueryAsync(string sql, CommandType cmdType, Dictionary parameters, Func projector, CancellationToken cancellationToken = new CancellationToken()) { Guard.NotEmpty(sql, nameof(sql)); @@ -339,14 +248,6 @@ protected override Task> ToDictionaryAsync - /// Asynchronously creates raw SQL query that is executed directly in the database. - /// - /// The SQL query string. - /// The command type. - /// The parameters to apply to the SQL query string. - /// A to observe while waiting for the task to complete. - /// The that represents the asynchronous operation, containing the number of rows affected. public override async Task ExecuteSqlCommandAsync(string sql, CommandType cmdType, Dictionary parameters, CancellationToken cancellationToken = new CancellationToken()) { Guard.NotEmpty(sql, nameof(sql)); @@ -377,24 +278,11 @@ protected override Task> ToDictionaryAsync - /// Asynchronously saves all changes made in this context to the database. - /// - /// A to observe while waiting for the task to complete. - /// The that represents the asynchronous operation, containing the number of state entries written to the database. public override Task SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken()) { return _context.SaveChangesAsync(cancellationToken); } - /// - /// Asynchronously finds an entity with the given primary key values in the repository. - /// - /// The type of the of the entity. - /// A to observe while waiting for the task to complete. - /// Defines the child objects that should be retrieved when loading the entity. - /// The values of the primary key for the entity to be found. - /// The that represents the asynchronous operation, containing the entity found in the repository. public override async Task FindAsync(CancellationToken cancellationToken, IFetchQueryStrategy fetchStrategy, params object[] keyValues) { Guard.NotEmpty(keyValues, nameof(keyValues)); @@ -413,9 +301,6 @@ public override async Task FindAsync(CancellationToken cancell #region Implementation of IDisposable - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// public override void Dispose() { _context.Dispose();