The ASP.NET Core solution (mws.api/mws.application/mws.domain/ mws.infrastructure) existed only as untracked working files. Adding it to version control, plus a .gitignore for build output and local tooling directories, so the CQRS/mediator refactor plan has a real git history to branch and diff against.
26 lines
841 B
C#
26 lines
841 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
using Mws.Domain.Documents;
|
|
|
|
namespace Mws.Infrastructure.Persistence.Configuration;
|
|
|
|
public class DocumentConfiguration : IEntityTypeConfiguration<Document>
|
|
{
|
|
public void Configure(EntityTypeBuilder<Document> e)
|
|
{
|
|
e.ToTable("documents");
|
|
e.HasKey(d => d.Id);
|
|
e.Property(d => d.Title).HasMaxLength(300).IsRequired();
|
|
e.Property(d => d.Type).HasConversion<string>().HasMaxLength(20);
|
|
e.Property(d => d.Content).HasColumnType("text");
|
|
|
|
e.HasIndex(d => new { d.ProjectId, d.ParentId });
|
|
e.HasIndex(d => d.ParentId);
|
|
|
|
e.HasOne(d => d.Parent)
|
|
.WithMany(d => d.Children)
|
|
.HasForeignKey(d => d.ParentId)
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
}
|
|
}
|