Files
Govor/Govor.Domain/Configurations/GroupMembershipConfiguration.cs
Artemy 6d1c53beeb Refactor: migrate Core -> Domain and reorganize projects
Large refactor that renames/moves core types into a new Govor.Domain surface and reorganizes the Application layer. Models, configurations, migrations and many files moved from Govor.Core/Govor.Data to Govor.Domain; numerous Application services, interfaces and implementations were relocated or added (authentication, friends, messages, medias, push notifications, user sessions, storage, synching, private chats, etc.). Tests updated to use Govor.Domain namespaces and adjusted project references (removed Govor.Data reference from API tests). Also updated API, Hub and mapping code and project files to reflect the new structure and naming. This is primarily a codebase-wide namespace and module reorganization to establish a Domain project and restructure application services.
2026-07-16 19:27:45 +07:00

29 lines
985 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Govor.Domain.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Govor.Domain.Configurations;
public class GroupMembershipConfiguration : IEntityTypeConfiguration<GroupMembership>
{
public void Configure(EntityTypeBuilder<GroupMembership> builder)
{
builder.HasKey(e => e.Id);
builder.Property(e => e.UserId).IsRequired();
builder.Property(e => e.GroupId).IsRequired();
builder.Property(e => e.InvitationId).IsRequired(false);
builder.HasOne(e => e.ChatGroup)
.WithMany()
.HasForeignKey(e => e.GroupId)
.OnDelete(DeleteBehavior.Cascade);
// Optional: настройка связи с GroupInvitation
builder.HasOne<GroupInvitation>()
.WithMany()
.HasForeignKey(e => e.InvitationId)
.OnDelete(DeleteBehavior.SetNull);
}
}