mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 06:11:10 +00:00
Adds editorconfig and refactors to the established rules
This commit is contained in:
1 parent
712a0f2b27
commit
cd44f11d9e
138 files changed
+1799
-1629
No files matched your search
@@ -126,7 +126,7 @@ public class BookConfiguration : IEntityTypeConfiguration<BookModel>
|
||||
|
||||
ratingBuilder.Property(rating => rating.Source)
|
||||
.HasConversion<string>()
|
||||
.HasMaxLength(50)
|
||||
.HasMaxLength(50)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
@@ -139,12 +139,12 @@ public class BookConfiguration : IEntityTypeConfiguration<BookModel>
|
||||
|
||||
isbnBuilder.Property(isbn => isbn.Value)
|
||||
.HasColumnName("ISBN")
|
||||
.HasMaxLength(13)
|
||||
.HasMaxLength(13)
|
||||
.IsRequired();
|
||||
|
||||
isbnBuilder.Property(isbn => isbn.Format)
|
||||
.HasConversion<string>()
|
||||
.HasMaxLength(6)
|
||||
.HasMaxLength(6)
|
||||
.IsRequired();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,13 +27,10 @@ public static class DataAccessLayerServices
|
||||
/// <returns>The updated <see cref="IServiceCollection"/>.</returns>
|
||||
public static void AddDataAccessLayerServices(this IServiceCollection services)
|
||||
{
|
||||
var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
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();
|
||||
|
||||
@@ -1,216 +1,206 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Lumina.DataAccess.Common.Migrations
|
||||
namespace Lumina.DataAccess.Common.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class InitialMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialMigration : Migration
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Books",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Title = table.Column<string>(type: "TEXT", maxLength: 255, nullable: false),
|
||||
OriginalTitle = table.Column<string>(type: "TEXT", maxLength: 255, nullable: true),
|
||||
Description = table.Column<string>(type: "TEXT", maxLength: 2000, nullable: true),
|
||||
OriginalReleaseDate = table.Column<DateOnly>(type: "TEXT", nullable: true),
|
||||
OriginalReleaseYear = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
ReReleaseDate = table.Column<DateOnly>(type: "TEXT", nullable: true),
|
||||
ReReleaseYear = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
ReleaseCountry = table.Column<string>(type: "TEXT", nullable: true),
|
||||
ReleaseVersion = table.Column<string>(type: "TEXT", nullable: true),
|
||||
LanguageCode = table.Column<string>(type: "TEXT", nullable: true),
|
||||
LanguageName = table.Column<string>(type: "TEXT", nullable: true),
|
||||
LanguageNativeName = table.Column<string>(type: "TEXT", nullable: true),
|
||||
OriginalLanguageCode = table.Column<string>(type: "TEXT", nullable: true),
|
||||
OriginalLanguageName = table.Column<string>(type: "TEXT", nullable: true),
|
||||
OriginalLanguageNativeName = table.Column<string>(type: "TEXT", nullable: true),
|
||||
Publisher = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
|
||||
PageCount = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
Format = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Edition = table.Column<string>(type: "TEXT", maxLength: 50, nullable: true),
|
||||
VolumeNumber = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
ASIN = table.Column<string>(type: "TEXT", maxLength: 10, nullable: true),
|
||||
GoodreadsId = table.Column<string>(type: "TEXT", nullable: true),
|
||||
LCCN = table.Column<string>(type: "TEXT", nullable: true),
|
||||
OCLCNumber = table.Column<string>(type: "TEXT", nullable: true),
|
||||
OpenLibraryId = table.Column<string>(type: "TEXT", maxLength: 50, nullable: true),
|
||||
LibraryThingId = table.Column<string>(type: "TEXT", maxLength: 50, nullable: true),
|
||||
GoogleBooksId = table.Column<string>(type: "TEXT", maxLength: 12, nullable: true),
|
||||
BarnesAndNobleId = table.Column<string>(type: "TEXT", maxLength: 10, nullable: true),
|
||||
AppleBooksId = table.Column<string>(type: "TEXT", nullable: true),
|
||||
Created = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
Updated = table.Column<DateTime>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Books", x => x.Id);
|
||||
});
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Books",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Title = table.Column<string>(type: "TEXT", maxLength: 255, nullable: false),
|
||||
OriginalTitle = table.Column<string>(type: "TEXT", maxLength: 255, nullable: true),
|
||||
Description = table.Column<string>(type: "TEXT", maxLength: 2000, nullable: true),
|
||||
OriginalReleaseDate = table.Column<DateOnly>(type: "TEXT", nullable: true),
|
||||
OriginalReleaseYear = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
ReReleaseDate = table.Column<DateOnly>(type: "TEXT", nullable: true),
|
||||
ReReleaseYear = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
ReleaseCountry = table.Column<string>(type: "TEXT", nullable: true),
|
||||
ReleaseVersion = table.Column<string>(type: "TEXT", nullable: true),
|
||||
LanguageCode = table.Column<string>(type: "TEXT", nullable: true),
|
||||
LanguageName = table.Column<string>(type: "TEXT", nullable: true),
|
||||
LanguageNativeName = table.Column<string>(type: "TEXT", nullable: true),
|
||||
OriginalLanguageCode = table.Column<string>(type: "TEXT", nullable: true),
|
||||
OriginalLanguageName = table.Column<string>(type: "TEXT", nullable: true),
|
||||
OriginalLanguageNativeName = table.Column<string>(type: "TEXT", nullable: true),
|
||||
Publisher = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
|
||||
PageCount = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
Format = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Edition = table.Column<string>(type: "TEXT", maxLength: 50, nullable: true),
|
||||
VolumeNumber = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
ASIN = table.Column<string>(type: "TEXT", maxLength: 10, nullable: true),
|
||||
GoodreadsId = table.Column<string>(type: "TEXT", nullable: true),
|
||||
LCCN = table.Column<string>(type: "TEXT", nullable: true),
|
||||
OCLCNumber = table.Column<string>(type: "TEXT", nullable: true),
|
||||
OpenLibraryId = table.Column<string>(type: "TEXT", maxLength: 50, nullable: true),
|
||||
LibraryThingId = table.Column<string>(type: "TEXT", maxLength: 50, nullable: true),
|
||||
GoogleBooksId = table.Column<string>(type: "TEXT", maxLength: 12, nullable: true),
|
||||
BarnesAndNobleId = table.Column<string>(type: "TEXT", maxLength: 10, nullable: true),
|
||||
AppleBooksId = table.Column<string>(type: "TEXT", nullable: true),
|
||||
Created = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
Updated = table.Column<DateTime>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table => table.PrimaryKey("PK_Books", x => x.Id));
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Genres",
|
||||
columns: table => new
|
||||
{
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Genres", x => x.Name);
|
||||
});
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Genres",
|
||||
columns: table => new
|
||||
{
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false)
|
||||
},
|
||||
constraints: table => table.PrimaryKey("PK_Genres", x => x.Name));
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Tags",
|
||||
columns: table => new
|
||||
{
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Tags", x => x.Name);
|
||||
});
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Tags",
|
||||
columns: table => new
|
||||
{
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false)
|
||||
},
|
||||
constraints: table => table.PrimaryKey("PK_Tags", x => x.Name));
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BookISBNs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
ISBN = table.Column<string>(type: "TEXT", maxLength: 13, nullable: false),
|
||||
Format = table.Column<string>(type: "TEXT", maxLength: 6, nullable: false),
|
||||
BookId = table.Column<Guid>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BookISBNs", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_BookISBNs_Books_BookId",
|
||||
column: x => x.BookId,
|
||||
principalTable: "Books",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BookISBNs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
ISBN = table.Column<string>(type: "TEXT", maxLength: 13, nullable: false),
|
||||
Format = table.Column<string>(type: "TEXT", maxLength: 6, nullable: false),
|
||||
BookId = table.Column<Guid>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BookISBNs", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_BookISBNs_Books_BookId",
|
||||
column: x => x.BookId,
|
||||
principalTable: "Books",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BookRatings",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Source = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
|
||||
BookId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Value = table.Column<decimal>(type: "decimal(3,2)", nullable: false),
|
||||
MaxValue = table.Column<decimal>(type: "decimal(3,2)", nullable: false),
|
||||
VoteCount = table.Column<int>(type: "INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BookRatings", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_BookRatings_Books_BookId",
|
||||
column: x => x.BookId,
|
||||
principalTable: "Books",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BookRatings",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Source = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
|
||||
BookId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
Value = table.Column<decimal>(type: "decimal(3,2)", nullable: false),
|
||||
MaxValue = table.Column<decimal>(type: "decimal(3,2)", nullable: false),
|
||||
VoteCount = table.Column<int>(type: "INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BookRatings", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_BookRatings_Books_BookId",
|
||||
column: x => x.BookId,
|
||||
principalTable: "Books",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BookGenres",
|
||||
columns: table => new
|
||||
{
|
||||
BookId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
GenreId = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BookGenres", x => new { x.BookId, x.GenreId });
|
||||
table.ForeignKey(
|
||||
name: "FK_BookGenres_Books_BookId",
|
||||
column: x => x.BookId,
|
||||
principalTable: "Books",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_BookGenres_Genres_GenreId",
|
||||
column: x => x.GenreId,
|
||||
principalTable: "Genres",
|
||||
principalColumn: "Name",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BookGenres",
|
||||
columns: table => new
|
||||
{
|
||||
BookId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
GenreId = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BookGenres", x => new { x.BookId, x.GenreId });
|
||||
table.ForeignKey(
|
||||
name: "FK_BookGenres_Books_BookId",
|
||||
column: x => x.BookId,
|
||||
principalTable: "Books",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_BookGenres_Genres_GenreId",
|
||||
column: x => x.GenreId,
|
||||
principalTable: "Genres",
|
||||
principalColumn: "Name",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BookTags",
|
||||
columns: table => new
|
||||
{
|
||||
BookId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
TagId = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BookTags", x => new { x.BookId, x.TagId });
|
||||
table.ForeignKey(
|
||||
name: "FK_BookTags_Books_BookId",
|
||||
column: x => x.BookId,
|
||||
principalTable: "Books",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_BookTags_Tags_TagId",
|
||||
column: x => x.TagId,
|
||||
principalTable: "Tags",
|
||||
principalColumn: "Name",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BookTags",
|
||||
columns: table => new
|
||||
{
|
||||
BookId = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
TagId = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BookTags", x => new { x.BookId, x.TagId });
|
||||
table.ForeignKey(
|
||||
name: "FK_BookTags_Books_BookId",
|
||||
column: x => x.BookId,
|
||||
principalTable: "Books",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_BookTags_Tags_TagId",
|
||||
column: x => x.TagId,
|
||||
principalTable: "Tags",
|
||||
principalColumn: "Name",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BookGenres_GenreId",
|
||||
table: "BookGenres",
|
||||
column: "GenreId");
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BookGenres_GenreId",
|
||||
table: "BookGenres",
|
||||
column: "GenreId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BookISBNs_BookId",
|
||||
table: "BookISBNs",
|
||||
column: "BookId");
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BookISBNs_BookId",
|
||||
table: "BookISBNs",
|
||||
column: "BookId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BookRatings_BookId",
|
||||
table: "BookRatings",
|
||||
column: "BookId");
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BookRatings_BookId",
|
||||
table: "BookRatings",
|
||||
column: "BookId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BookTags_TagId",
|
||||
table: "BookTags",
|
||||
column: "TagId");
|
||||
}
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BookTags_TagId",
|
||||
table: "BookTags",
|
||||
column: "TagId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "BookGenres");
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "BookGenres");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BookISBNs");
|
||||
migrationBuilder.DropTable(
|
||||
name: "BookISBNs");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BookRatings");
|
||||
migrationBuilder.DropTable(
|
||||
name: "BookRatings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BookTags");
|
||||
migrationBuilder.DropTable(
|
||||
name: "BookTags");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Genres");
|
||||
migrationBuilder.DropTable(
|
||||
name: "Genres");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Books");
|
||||
migrationBuilder.DropTable(
|
||||
name: "Books");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Tags");
|
||||
}
|
||||
migrationBuilder.DropTable(
|
||||
name: "Tags");
|
||||
}
|
||||
}
|
||||
@@ -43,16 +43,16 @@ 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)
|
||||
{
|
||||
var jobExists = await _luminaDbContext.Books.AnyAsync(_book => _book.Id == book.Id, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
bool jobExists = await _luminaDbContext.Books.AnyAsync(_book => _book.Id == book.Id, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
if (jobExists)
|
||||
return Errors.WrittenContent.BookAlreadyExists;
|
||||
|
||||
// fetch existing tags and genres
|
||||
var existingTags = await _luminaDbContext.Set<TagModel>()
|
||||
List<TagModel> existingTags = await _luminaDbContext.Set<TagModel>()
|
||||
.Where(t => book.Tags.Select(bt => bt.Name).Contains(t.Name))
|
||||
.ToListAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var existingGenres = await _luminaDbContext.Set<GenreModel>()
|
||||
List<GenreModel> existingGenres = await _luminaDbContext.Set<GenreModel>()
|
||||
.Where(g => book.Genres.Select(bg => bg.Name).Contains(g.Name))
|
||||
.ToListAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class RepositoryDictionary
|
||||
/// <summary>
|
||||
/// Gets the number of added repositories.
|
||||
/// </summary>
|
||||
public int Count { get { return _container.Count; } }
|
||||
public int Count => _container.Count;
|
||||
#endregion
|
||||
|
||||
#region ===================================================================== METHODS ===================================================================================
|
||||
|
||||
@@ -53,10 +53,10 @@ public class LuminaDbContext : DbContext
|
||||
public override int SaveChanges()
|
||||
{
|
||||
// get all the entity entries that are either added or modified
|
||||
var entries = ChangeTracker.Entries()
|
||||
IEnumerable<Microsoft.EntityFrameworkCore.ChangeTracking.EntityEntry> entries = ChangeTracker.Entries()
|
||||
.Where(e => e.Entity is IStorageEntity &&
|
||||
(e.State is EntityState.Added or EntityState.Modified));
|
||||
foreach (var entityEntry in entries)
|
||||
foreach (Microsoft.EntityFrameworkCore.ChangeTracking.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)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<BaseOutputPath>$(SolutionDir)..\bin\server\</BaseOutputPath>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -30,5 +30,4 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in new issue
Block a user