mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 10:11:10 +00:00
eliminates region sections
This commit is contained in:
1 parent
705c02b90d
commit
405fc1ff9a
370 files changed
+47
-1618
No files matched your search
@@ -19,11 +19,8 @@ namespace Lumina.DataAccess.Core.Repositories.Books;
|
||||
/// </summary>
|
||||
internal sealed class BookRepository : IBookRepository
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly LuminaDbContext _luminaDbContext;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BookRepository"/> class.
|
||||
/// </summary>
|
||||
@@ -32,9 +29,7 @@ internal sealed class BookRepository : IBookRepository
|
||||
{
|
||||
_luminaDbContext = luminaDbContext;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Adds a new book.
|
||||
/// </summary>
|
||||
@@ -77,5 +72,4 @@ internal sealed class BookRepository : IBookRepository
|
||||
.Include(book => book.ISBNs)
|
||||
.ToListAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -5,12 +5,10 @@
|
||||
/// </summary>
|
||||
public interface IRepositoryFactory
|
||||
{
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Creates a new repository of type <typeparamref name="TResult"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="TResult">The type of repository to create.</typeparam>
|
||||
/// <returns>A repository of type <typeparamref name="TResult"/>.</returns>
|
||||
TResult CreateRepository<TResult>() where TResult : notnull;
|
||||
#endregion
|
||||
}
|
||||
@@ -12,18 +12,13 @@ namespace Lumina.DataAccess.Core.Repositories.Common.Factory;
|
||||
/// </summary>
|
||||
public class RepositoryDictionary
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly List<KeyValuePair<Type, object>> _container = [];
|
||||
#endregion
|
||||
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets the number of added repositories.
|
||||
/// </summary>
|
||||
public int Count => _container.Count;
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Resets the collection of repositories.
|
||||
/// </summary>
|
||||
@@ -66,5 +61,4 @@ public class RepositoryDictionary
|
||||
{
|
||||
return (TResult)_container.FirstOrDefault(e => e.Key == key).Value;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -10,11 +10,8 @@ namespace Lumina.DataAccess.Core.Repositories.Common.Factory;
|
||||
/// </summary>
|
||||
public class RepositoryFactory : IRepositoryFactory
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RepositoryFactory"/> class.
|
||||
/// </summary>
|
||||
@@ -23,9 +20,7 @@ public class RepositoryFactory : IRepositoryFactory
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Creates a new repository of type <typeparamref name="TResult"/>.
|
||||
/// </summary>
|
||||
@@ -36,5 +31,4 @@ public class RepositoryFactory : IRepositoryFactory
|
||||
{
|
||||
return _serviceProvider.GetRequiredService<TResult>() ?? throw new ArgumentException();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -18,11 +18,8 @@ namespace Lumina.DataAccess.Core.UoW;
|
||||
/// <remarks>To update the database: update-database -p Lumina.DataAccess -s Lumina.Presentation.Api</remarks>
|
||||
public class LuminaDbContext : DbContext
|
||||
{
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
public virtual DbSet<BookModel> Books { get; set; } = null!;
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LuminaDbContext"/> class.
|
||||
/// </summary>
|
||||
@@ -30,9 +27,7 @@ public class LuminaDbContext : DbContext
|
||||
public LuminaDbContext(DbContextOptions<LuminaDbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Configures the entity mappings for the database context.
|
||||
/// </summary>
|
||||
@@ -67,5 +62,4 @@ public class LuminaDbContext : DbContext
|
||||
}
|
||||
return base.SaveChanges();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -17,19 +17,14 @@ namespace Lumina.DataAccess.Core.UoW;
|
||||
/// </summary>
|
||||
public class UnitOfWork : IUnitOfWork
|
||||
{
|
||||
#region ================================================================== FIELD MEMBERS ================================================================================
|
||||
private readonly LuminaDbContext _luminaDbContext;
|
||||
private readonly IRepositoryFactory _repositoryFactory;
|
||||
#endregion
|
||||
|
||||
#region ==================================================================== PROPERTIES =================================================================================
|
||||
/// <summary>
|
||||
/// Gets or sets the collection of available repositories.
|
||||
/// </summary>
|
||||
internal RepositoryDictionary Repositories { get; private set; } = new RepositoryDictionary();
|
||||
#endregion
|
||||
|
||||
#region ====================================================================== CTOR =====================================================================================
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UnitOfWork"/> class.
|
||||
/// </summary>
|
||||
@@ -41,9 +36,7 @@ public class UnitOfWork : IUnitOfWork
|
||||
_luminaDbContext = luminaDbContext;
|
||||
AddRepositories();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
/// <summary>
|
||||
/// Adds all the repositories from the Data Access Layer so that they can be exposed to the Business Layer.
|
||||
/// </summary>
|
||||
@@ -121,5 +114,4 @@ public class UnitOfWork : IUnitOfWork
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Reference in new issue
Block a user