添加项目文件。
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using ContactService.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace ContactService.Infrastructure.Configs
|
||||
{
|
||||
public class FriendConfig : IEntityTypeConfiguration<Friend>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Friend> builder)
|
||||
{
|
||||
builder.ToTable("friends");
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.OwnsOne(x => x.Owner, owner =>
|
||||
{
|
||||
owner.WithOwner(); // 🔥 关键:明确归属
|
||||
|
||||
owner.Property(p => p.Id).HasColumnName("OwnerId").IsRequired();
|
||||
owner.Property(p => p.NickName).HasColumnName("OwnerNickName");
|
||||
owner.Property(p => p.Avatar).HasColumnName("OwnerAvatarUrl");
|
||||
});
|
||||
|
||||
builder.OwnsOne(x => x.Target, target =>
|
||||
{
|
||||
target.WithOwner(); // 🔥 关键
|
||||
|
||||
target.Property(p => p.Id).HasColumnName("TargetId").IsRequired();
|
||||
target.Property(p => p.NickName).HasColumnName("TargetNickName");
|
||||
target.Property(p => p.Avatar).HasColumnName("TargetAvatarUrl");
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using ContactService.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace ContactService.Infrastructure.Configs
|
||||
{
|
||||
public class FriendRequestConfig : IEntityTypeConfiguration<FriendRequest>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<FriendRequest> builder)
|
||||
{
|
||||
builder.ToTable("friend_requests");
|
||||
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.HasIndex(x => new { x.OwnerId, x.TargetId });
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using ContactService.Domain.Entities;
|
||||
using IM.Infrastructure.Efcore;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ContactService.Infrastructure
|
||||
{
|
||||
public class ContactDbContext : BaseDbContext
|
||||
{
|
||||
public DbSet<Friend> Friends { get; private set; }
|
||||
public DbSet<FriendRequest> FriendRequests { get; private set; }
|
||||
public ContactDbContext(DbContextOptions options, IMediator mediator) : base(options, mediator)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly);
|
||||
|
||||
modelBuilder.EnableSoftDeletionGlobalFilter();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="9.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\IM.Commons\IM.Commons.csproj" />
|
||||
<ProjectReference Include="..\ContactService.Domain\ContactService.Domain.csproj" />
|
||||
<ProjectReference Include="..\Infrastructure\IM.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,46 @@
|
||||
using ContactService.Domain;
|
||||
using ContactService.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ContactService.Infrastructure
|
||||
{
|
||||
public class FriendReposity : IFriendReposity
|
||||
{
|
||||
private readonly ContactDbContext db;
|
||||
|
||||
public FriendReposity(ContactDbContext db)
|
||||
{
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
public async Task<bool> CheckOwnerIdAndTargetIdAsync(Guid ownerId, Guid targetId)
|
||||
{
|
||||
var exist = await db.Friends.AnyAsync(x => x.Owner.Id == ownerId && x.Target.Id == targetId);
|
||||
return exist;
|
||||
}
|
||||
|
||||
public async Task<Friend> CreateAsync(Friend friend)
|
||||
{
|
||||
db.Add(friend);
|
||||
return friend;
|
||||
}
|
||||
|
||||
public Task<Friend?> FindByIdAsync(Guid id)
|
||||
{
|
||||
return db.Friends.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
public Task<Friend?> FindByOwnerAndTargetAsync(Guid ownerId, Guid targetId)
|
||||
{
|
||||
return db.Friends.FirstOrDefaultAsync(x => x.Owner.Id == ownerId && x.Target.Id == targetId);
|
||||
}
|
||||
public async Task<IEnumerable<Friend>> FindByTargetAsync(Guid targetId)
|
||||
{
|
||||
return await db.Friends.Where(x => x.Target.Id == targetId).ToListAsync();
|
||||
}
|
||||
public async Task<IEnumerable<Friend>> FindByOwnerAsync(Guid ownerId)
|
||||
{
|
||||
return await db.Friends.Where(x => x.Owner.Id == ownerId).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using ContactService.Domain;
|
||||
using ContactService.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ContactService.Infrastructure
|
||||
{
|
||||
public class FriendRequestReposity : IFriendRequestReposity
|
||||
{
|
||||
private readonly ContactDbContext db;
|
||||
|
||||
public FriendRequestReposity(ContactDbContext db)
|
||||
{
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
public async Task<bool> CreateAsync(FriendRequest friendRequest)
|
||||
{
|
||||
db.Add(friendRequest);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Task<FriendRequest?> FindByIdAsync(Guid id)
|
||||
{
|
||||
return db.FriendRequests.FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<FriendRequest>> FindByOwnerIdAsync(Guid ownerId)
|
||||
{
|
||||
return await db.FriendRequests.Where(x => x.OwnerId == ownerId).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<FriendRequest>> FindByTargetIdAsync(Guid targetId)
|
||||
{
|
||||
return await db.FriendRequests.Where(x => x.TargetId == targetId).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ContactService.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ContactService.Infrastructure.Migrations
|
||||
{
|
||||
[DbContext(typeof(ContactDbContext))]
|
||||
[Migration("20260413114340_InitDb")]
|
||||
partial class InitDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ContactService.Domain.Entities.Friend", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTimeOffset?>("Deletion")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTimeOffset?>("ModificationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("RemarkName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("friends", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ContactService.Domain.Entities.FriendRequest", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTimeOffset?>("Deletion")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTimeOffset?>("ModificationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<Guid>("OwnerId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("RemarkName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("State")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("TargetId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId", "TargetId");
|
||||
|
||||
b.ToTable("friend_requests", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ContactService.Domain.Entities.Friend", b =>
|
||||
{
|
||||
b.OwnsOne("ContactService.Domain.ValueObjects.UserProfile", "Owner", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("FriendId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b1.Property<string>("Avatar")
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("OwnerAvatarUrl");
|
||||
|
||||
b1.Property<Guid>("Id")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("OwnerId");
|
||||
|
||||
b1.Property<string>("NickName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("OwnerNickName");
|
||||
|
||||
b1.HasKey("FriendId");
|
||||
|
||||
b1.ToTable("friends");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("FriendId");
|
||||
});
|
||||
|
||||
b.OwnsOne("ContactService.Domain.ValueObjects.UserProfile", "Target", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("FriendId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b1.Property<string>("Avatar")
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("TargetAvatarUrl");
|
||||
|
||||
b1.Property<Guid>("Id")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("TargetId");
|
||||
|
||||
b1.Property<string>("NickName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("TargetNickName");
|
||||
|
||||
b1.HasKey("FriendId");
|
||||
|
||||
b1.ToTable("friends");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("FriendId");
|
||||
});
|
||||
|
||||
b.Navigation("Owner")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Target")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ContactService.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitDb : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterDatabase()
|
||||
.Annotation("MySql:Charset", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "friend_requests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
OwnerId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
TargetId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
Description = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
State = table.Column<int>(type: "int", nullable: false),
|
||||
RemarkName = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
CreationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: false),
|
||||
Deletion = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true),
|
||||
ModificationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_friend_requests", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:Charset", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "friends",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
OwnerId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
OwnerNickName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
OwnerAvatarUrl = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
TargetId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
TargetNickName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
TargetAvatarUrl = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
RemarkName = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:Charset", "utf8mb4"),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
CreationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: false),
|
||||
Deletion = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true),
|
||||
ModificationTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_friends", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:Charset", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_friend_requests_OwnerId_TargetId",
|
||||
table: "friend_requests",
|
||||
columns: new[] { "OwnerId", "TargetId" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "friend_requests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "friends");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using ContactService.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ContactService.Infrastructure.Migrations
|
||||
{
|
||||
[DbContext(typeof(ContactDbContext))]
|
||||
partial class ContactDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("ContactService.Domain.Entities.Friend", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTimeOffset?>("Deletion")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTimeOffset?>("ModificationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("RemarkName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("friends", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ContactService.Domain.Entities.FriendRequest", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTimeOffset?>("Deletion")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTimeOffset?>("ModificationTime")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<Guid>("OwnerId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("RemarkName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("State")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid>("TargetId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerId", "TargetId");
|
||||
|
||||
b.ToTable("friend_requests", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ContactService.Domain.Entities.Friend", b =>
|
||||
{
|
||||
b.OwnsOne("ContactService.Domain.ValueObjects.UserProfile", "Owner", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("FriendId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b1.Property<string>("Avatar")
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("OwnerAvatarUrl");
|
||||
|
||||
b1.Property<Guid>("Id")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("OwnerId");
|
||||
|
||||
b1.Property<string>("NickName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("OwnerNickName");
|
||||
|
||||
b1.HasKey("FriendId");
|
||||
|
||||
b1.ToTable("friends");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("FriendId");
|
||||
});
|
||||
|
||||
b.OwnsOne("ContactService.Domain.ValueObjects.UserProfile", "Target", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("FriendId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b1.Property<string>("Avatar")
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("TargetAvatarUrl");
|
||||
|
||||
b1.Property<Guid>("Id")
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnName("TargetId");
|
||||
|
||||
b1.Property<string>("NickName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasColumnName("TargetNickName");
|
||||
|
||||
b1.HasKey("FriendId");
|
||||
|
||||
b1.ToTable("friends");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("FriendId");
|
||||
});
|
||||
|
||||
b.Navigation("Owner")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Target")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using ContactService.Domain;
|
||||
using IM.Commons;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace ContactService.Infrastructure
|
||||
{
|
||||
public class ModuleInit : IModuleInitializer
|
||||
{
|
||||
public void Initialize(IServiceCollection services)
|
||||
{
|
||||
services.AddScoped<FriendDomainService>();
|
||||
services.AddScoped<FriendRequestDomainService>();
|
||||
services.AddScoped<IFriendReposity, FriendReposity>();
|
||||
services.AddScoped<IFriendRequestReposity, FriendRequestReposity>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user