mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 07:11:10 +00:00
Implements directory browser dialog, part 6: hidden file system items toggle
This commit is contained in:
1 parent
cd44f11d9e
commit
debad9ef74
74 files changed
+596
-427
No files matched your search
@@ -1,4 +1,4 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Common.Base;
|
||||
using Lumina.Application.Common.DataAccess.UoW;
|
||||
using Lumina.DataAccess.Core.Repositories.Common.Factory;
|
||||
@@ -30,7 +30,10 @@ public static class DataAccessLayerServices
|
||||
string? basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
if (!Directory.Exists(basePath))
|
||||
throw new DirectoryNotFoundException($"The base path '{basePath}' does not exist.");
|
||||
services.AddDbContext<LuminaDbContext>(options => options.UseSqlite($"Data Source={Path.Combine(basePath, "Lumina.db")}"));
|
||||
services.AddDbContext<LuminaDbContext>(options =>
|
||||
{
|
||||
options.UseSqlite($"Data Source={Path.Combine(basePath, "Lumina.db")}");
|
||||
});
|
||||
services.AddScoped<IUnitOfWork, UnitOfWork>();
|
||||
|
||||
Type[]? dataAccessLayerTypes = Assembly.GetExecutingAssembly().GetTypes();
|
||||
@@ -55,4 +58,4 @@ public static class DataAccessLayerServices
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.Books;
|
||||
using Lumina.Contracts.Models.Common;
|
||||
@@ -43,7 +43,7 @@ internal sealed class BookRepository : IBookRepository
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successfull operation, or an error.</returns>
|
||||
public async Task<ErrorOr<Created>> InsertAsync(BookModel book, CancellationToken cancellationToken)
|
||||
{
|
||||
bool jobExists = await _luminaDbContext.Books.AnyAsync(_book => _book.Id == book.Id, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
bool jobExists = await _luminaDbContext.Books.AnyAsync(repositoryBook => repositoryBook.Id == book.Id, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
if (jobExists)
|
||||
return Errors.WrittenContent.BookAlreadyExists;
|
||||
|
||||
@@ -78,4 +78,4 @@ internal sealed class BookRepository : IBookRepository
|
||||
.ToListAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Models.Common;
|
||||
using Lumina.Contracts.Models.WrittenContentLibrary.BookLibrary;
|
||||
using Lumina.Domain.Common.Events;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -39,9 +40,8 @@ public class LuminaDbContext : DbContext
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
// find all the entity configurations in the assembly and apply them
|
||||
modelBuilder
|
||||
.Ignore<List<IDomainEvent>>()
|
||||
.ApplyConfigurationsFromAssembly(typeof(LuminaDbContext).Assembly);
|
||||
modelBuilder.Ignore<List<IDomainEvent>>()
|
||||
.ApplyConfigurationsFromAssembly(typeof(LuminaDbContext).Assembly);
|
||||
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
@@ -53,10 +53,10 @@ public class LuminaDbContext : DbContext
|
||||
public override int SaveChanges()
|
||||
{
|
||||
// get all the entity entries that are either added or modified
|
||||
IEnumerable<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry> entries = ChangeTracker.Entries()
|
||||
.Where(e => e.Entity is IStorageEntity &&
|
||||
(e.State is EntityState.Added or EntityState.Modified));
|
||||
foreach (Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry? entityEntry in entries)
|
||||
IEnumerable<EntityEntry> entries = ChangeTracker.Entries()
|
||||
.Where(e => e.Entity is IStorageEntity &&
|
||||
(e.State is EntityState.Added or EntityState.Modified));
|
||||
foreach (EntityEntry? entityEntry in entries)
|
||||
{
|
||||
// if the entity is in Added state, set the Created property to the current date and time
|
||||
if (entityEntry.State == EntityState.Added)
|
||||
@@ -68,4 +68,4 @@ public class LuminaDbContext : DbContext
|
||||
return base.SaveChanges();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user