ql_apimanager_backend/Apimanager_backend/Data/ApiRequestExampleConfig.cs

20 lines
581 B
C#

using Apimanager_backend.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Apimanager_backend.Data
{
public class ApiRequestExampleConfig : IEntityTypeConfiguration<ApiRequestExample>
{
public void Configure(EntityTypeBuilder<ApiRequestExample> builder)
{
//主键
builder.HasKey(x => x.Id);
//外键
builder.HasOne(x => x.Api)
.WithMany(u => u.ApiRequestExamples)
.HasForeignKey(x => x.ApiId);
}
}
}