1
This commit is contained in:
parent
e814bfd538
commit
4d8900be21
@ -17,6 +17,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution items", "solution
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InterfaceForward.Domain", "src\InterfaceForward.Domain\InterfaceForward.Domain.csproj", "{AB53F0CC-DE7A-4AE9-B6AA-2A8283B4EB23}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InterfaceForward.Infrastructure", "src\InterfaceForward.Infrastructure\InterfaceForward.Infrastructure.csproj", "{5FF71C79-8BD4-45AE-B999-8481F32BC2C0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -39,11 +41,16 @@ Global
|
||||
{AB53F0CC-DE7A-4AE9-B6AA-2A8283B4EB23}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AB53F0CC-DE7A-4AE9-B6AA-2A8283B4EB23}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AB53F0CC-DE7A-4AE9-B6AA-2A8283B4EB23}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5FF71C79-8BD4-45AE-B999-8481F32BC2C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5FF71C79-8BD4-45AE-B999-8481F32BC2C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5FF71C79-8BD4-45AE-B999-8481F32BC2C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5FF71C79-8BD4-45AE-B999-8481F32BC2C0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{9609CC2D-CC83-4C01-BE36-C0429A06B238} = {EA8DF4A8-7618-4C28-BEDC-21629B8B219B}
|
||||
{6DAA9CF1-155A-4FC7-9EAE-7E8FA22CD23A} = {EA8DF4A8-7618-4C28-BEDC-21629B8B219B}
|
||||
{0E2F3A09-4EC4-4A61-85DC-9F9F770C3B65} = {EA8DF4A8-7618-4C28-BEDC-21629B8B219B}
|
||||
{AB53F0CC-DE7A-4AE9-B6AA-2A8283B4EB23} = {EA8DF4A8-7618-4C28-BEDC-21629B8B219B}
|
||||
{5FF71C79-8BD4-45AE-B999-8481F32BC2C0} = {EA8DF4A8-7618-4C28-BEDC-21629B8B219B}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using Fake.DomainDrivenDesign.Entities.Auditing;
|
||||
|
||||
namespace InterfaceForward.Domain.DictionaryAggregate;
|
||||
|
||||
public class DictionaryEntity:FullAuditedAggregate<Guid>
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public string Code { get; private set; }
|
||||
public string? Description { get; private set; }
|
||||
|
||||
|
||||
public DictionaryEntity(string name, string code, string? description)
|
||||
{
|
||||
Name = name;
|
||||
Code = code;
|
||||
Description = description;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using Fake.DomainDrivenDesign.Entities.Auditing;
|
||||
|
||||
namespace InterfaceForward.Domain.DictionaryAggregate;
|
||||
|
||||
public class DictionaryItemEntity : FullAuditedEntity<Guid>
|
||||
{
|
||||
public DictionaryItemEntity(Guid dictionaryId, string name, int value, int sort, string? description = null)
|
||||
{
|
||||
DictionaryId = dictionaryId;
|
||||
Name = name;
|
||||
Value = value;
|
||||
Sort = sort;
|
||||
Description = description;
|
||||
}
|
||||
|
||||
public Guid DictionaryId { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public int Value { get; private set; }
|
||||
public int Sort { get; private set; }
|
||||
public string? Description { get; private set; }
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using Fake.DomainDrivenDesign.Entities.Auditing;
|
||||
using InterfaceForward.Domain.UpStreamInterfaceAggregate;
|
||||
|
||||
namespace InterfaceForward.Domain.InterfaceAggregate;
|
||||
|
||||
public class InterfaceEntity : FullAuditedAggregate<Guid>
|
||||
{
|
||||
public int? ServiceProviderId { get; private set; }
|
||||
|
||||
public string Name { get; private set; }
|
||||
|
||||
public string Code { get; private set; }
|
||||
|
||||
public string? Description { get; private set; }
|
||||
|
||||
public string? RequestAddress { get; private set; }
|
||||
|
||||
public int? RequestMethod { get; private set; }
|
||||
|
||||
public RequestContentType? RequestContentType { get; private set; }
|
||||
|
||||
public ResponseContentType? ResponseContentType { get; private set; }
|
||||
|
||||
public string? FlowCode { get; private set; }
|
||||
|
||||
public int? Timeout { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 接口单次请求数量上限
|
||||
/// </summary>
|
||||
public int? Limit { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 接口qps限制
|
||||
/// </summary>
|
||||
public int? Qps { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入参根节点类型
|
||||
/// </summary>
|
||||
public ParameterType InParamRootType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 出参根节点类型
|
||||
/// </summary>
|
||||
public ParameterType OutParamRootType { get; private set; }
|
||||
|
||||
public InterfaceEntity(string name, string code, string? description, ParameterType inParamRootType,
|
||||
ParameterType outParamRootType)
|
||||
{
|
||||
Name = name;
|
||||
Code = code;
|
||||
Description = description;
|
||||
InParamRootType = inParamRootType;
|
||||
OutParamRootType = outParamRootType;
|
||||
}
|
||||
|
||||
public InterfaceEntity(int serviceProviderId, string name, string code, string? description, string requestAddress,
|
||||
int requestMethod, RequestContentType requestContentType, ResponseContentType responseContentType,
|
||||
string? flowCode, int timeout, int limit, int qps, ParameterType inParamRootType, ParameterType outParamRootType)
|
||||
{
|
||||
ServiceProviderId = serviceProviderId;
|
||||
Name = name;
|
||||
Code = code;
|
||||
Description = description;
|
||||
RequestAddress = requestAddress;
|
||||
RequestMethod = requestMethod;
|
||||
RequestContentType = requestContentType;
|
||||
ResponseContentType = responseContentType;
|
||||
FlowCode = flowCode;
|
||||
Timeout = timeout;
|
||||
Limit = limit;
|
||||
Qps = qps;
|
||||
InParamRootType = inParamRootType;
|
||||
OutParamRootType = outParamRootType;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using Fake.DomainDrivenDesign.Entities.Auditing;
|
||||
using InterfaceForward.Domain.UpStreamInterfaceAggregate;
|
||||
|
||||
namespace InterfaceForward.Domain.InterfaceAggregate;
|
||||
|
||||
public class InterfaceParamEntity : FullAuditedEntity<Guid>
|
||||
{
|
||||
///<summary>
|
||||
/// 接口ID
|
||||
///</summary>
|
||||
public Guid InterfaceId { get; private set; }
|
||||
|
||||
///<summary>
|
||||
/// 父ID
|
||||
///</summary>
|
||||
public Guid? PId { get; private set; }
|
||||
|
||||
///<summary>
|
||||
/// 参数名
|
||||
///</summary>
|
||||
public string Name { get; private set; }
|
||||
|
||||
///<summary>
|
||||
/// 参数路径
|
||||
///</summary>
|
||||
public string Path { get; private set; }
|
||||
|
||||
///<summary>
|
||||
/// 参数名(中文)
|
||||
///</summary>
|
||||
public string? CnName { get; private set; }
|
||||
|
||||
///<summary>
|
||||
/// 参数类型
|
||||
///</summary>
|
||||
public ParameterType Type { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否必填
|
||||
/// </summary>
|
||||
public bool IsRequired { get; private set; }
|
||||
|
||||
///<summary>
|
||||
/// 是否入参
|
||||
///</summary>
|
||||
public bool IsInParam { get; private set; }
|
||||
|
||||
///<summary>
|
||||
/// 参数描述
|
||||
///</summary>
|
||||
public string? Description { get; private set; }
|
||||
|
||||
///<summary>
|
||||
/// 序列
|
||||
///</summary>
|
||||
public string Sort { get; private set; }
|
||||
|
||||
|
||||
public InterfaceParamEntity(Guid interfaceId, Guid? pId, string name, string path, string? cnName,
|
||||
ParameterType type, bool isRequired, bool isInParam, string? description, string sort)
|
||||
{
|
||||
InterfaceId = interfaceId;
|
||||
PId = pId;
|
||||
Name = name;
|
||||
Path = path;
|
||||
CnName = cnName;
|
||||
Type = type;
|
||||
IsRequired = isRequired;
|
||||
IsInParam = isInParam;
|
||||
Description = description;
|
||||
Sort = sort;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
namespace InterfaceForward.Domain.UpStreamInterfaceAggregate;
|
||||
|
||||
public enum ParameterType
|
||||
{
|
||||
String = 1,
|
||||
Float = 2,
|
||||
Object = 4,
|
||||
Boolean = 8,
|
||||
Array = 16,
|
||||
Integer = 32,
|
||||
Date = 64,
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
namespace InterfaceForward.Domain.InterfaceAggregate;
|
||||
|
||||
public enum RequestContentType
|
||||
{
|
||||
/// <summary>
|
||||
/// "application/json"
|
||||
/// </summary>
|
||||
Json = 1,
|
||||
/// <summary>
|
||||
/// "application/xml"
|
||||
/// </summary>
|
||||
Xml = 2,
|
||||
/// <summary>
|
||||
/// application/x-www-form-urlencoded
|
||||
/// </summary>
|
||||
FormUrlEncoded = 4,
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
namespace InterfaceForward.Domain.InterfaceAggregate;
|
||||
|
||||
public enum ResponseContentType
|
||||
{
|
||||
Json = 1,
|
||||
Xml = 2,
|
||||
Pdf = 4,
|
||||
Base64 = 8,
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
namespace InterfaceForward.Domain.InterfaceAggregate;
|
||||
|
||||
public enum ServiceType
|
||||
{
|
||||
ServiceProvider = 1,
|
||||
Platform = 2
|
||||
}
|
||||
@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Fake.DomainDrivenDesign" Version="8.0.0-preview.1"/>
|
||||
<PackageReference Include="Fake.DomainDrivenDesign" Version="8.0.0-preview.2"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using Fake.DomainDrivenDesign.Entities.Auditing;
|
||||
|
||||
namespace InterfaceForward.Domain.InterfaceMapAggregate;
|
||||
|
||||
public class InterfaceMapDetailsEntity : FullAuditedEntity<Guid>
|
||||
{
|
||||
///<summary>
|
||||
/// 接口映射id
|
||||
///</summary>
|
||||
public Guid InterfaceMapId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// 参数id
|
||||
///</summary>
|
||||
public Guid ParamId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// 映射参数ID
|
||||
///</summary>
|
||||
public Guid? MappedParamId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// 是否入参映射
|
||||
///</summary>
|
||||
public bool IsInParam { get; set; }
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Fake.DomainDrivenDesign.Entities;
|
||||
using Fake.DomainDrivenDesign.Entities.Auditing;
|
||||
|
||||
namespace InterfaceForward.Domain.InterfaceMapAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 上游接口映射服务商接口(1:1:N)
|
||||
/// </summary>
|
||||
public class InterfaceMapEntity : CreateAuditedEntity<Guid>, IAggregateRoot<Guid>, ISoftDelete
|
||||
{
|
||||
public InterfaceMapEntity(string upStreamInterfaceCode, string serviceProviderCode, List<string> serviceProviderInterfaceCodes)
|
||||
{
|
||||
if (serviceProviderInterfaceCodes.Count == 0)
|
||||
{
|
||||
throw new DomainException("至少需要一个映射服务商接口");
|
||||
}
|
||||
|
||||
UpStreamInterfaceCode = upStreamInterfaceCode;
|
||||
ServiceProviderCode = serviceProviderCode;
|
||||
ServiceProviderInterfaceCodes = serviceProviderInterfaceCodes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上游接口代码
|
||||
/// </summary>
|
||||
public string UpStreamInterfaceCode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 映射服务商代码
|
||||
/// </summary>
|
||||
public string ServiceProviderCode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 映射服务商接口代码(多个)
|
||||
/// </summary>
|
||||
public List<string> ServiceProviderInterfaceCodes { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前线上版本
|
||||
/// </summary>
|
||||
public string? OnlineVersion { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// 前置脚本
|
||||
///</summary>
|
||||
public string? PrefixScript { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// 后置脚本
|
||||
///</summary>
|
||||
public string? PostfixScript { get; set; }
|
||||
|
||||
public bool IsDeleted { get; }
|
||||
}
|
||||
@ -3,7 +3,7 @@ using Fake.DomainDrivenDesign.Entities.Auditing;
|
||||
|
||||
namespace InterfaceForward.Domain.ServiceProviderAggregate;
|
||||
|
||||
public class ServiceProviderAggregate(string name, string code, string description, string? flowCode = null)
|
||||
public class ServiceProviderEntity(string name, string code, string description, string? flowCode = null)
|
||||
: FullAuditedAggregate<Guid>
|
||||
{
|
||||
///<summary>
|
||||
@ -1,46 +1,61 @@
|
||||
using System;
|
||||
using Fake.DomainDrivenDesign.Entities.Auditing;
|
||||
using InterfaceForward.Domain.InterfaceAggregate;
|
||||
using InterfaceForward.Domain.UpStreamInterfaceAggregate;
|
||||
|
||||
namespace InterfaceForward.Domain.ServiceProviderAggregate;
|
||||
|
||||
public class ServiceProviderInterfaceEntity : FullAuditedEntity<Guid>
|
||||
public class ServiceProviderInterfaceEntity(
|
||||
int serviceProviderId,
|
||||
string name,
|
||||
string code,
|
||||
string description,
|
||||
string requestAddress,
|
||||
string requestMethod,
|
||||
RequestContentType requestContentType,
|
||||
ResponseContentType responseContentType,
|
||||
string? flowCode,
|
||||
int timeout = 20,
|
||||
int limit = 1,
|
||||
int qps = 0,
|
||||
ParameterType mappedType = ParameterType.Object)
|
||||
: FullAuditedEntity<Guid>
|
||||
{
|
||||
public int ServiceProviderId { get; private set; }
|
||||
public int ServiceProviderId { get; private set; } = serviceProviderId;
|
||||
|
||||
public string Name { get; private set; }
|
||||
public string Name { get; private set; } = name;
|
||||
|
||||
public string Code { get; private set; } = code;
|
||||
|
||||
public string Code { get; private set; }
|
||||
|
||||
///<summary>
|
||||
/// 描述
|
||||
///</summary>
|
||||
public string Description { get; set; }
|
||||
public string Description { get; set; } = description;
|
||||
|
||||
public string RequestAddress { get; private set; }
|
||||
public string RequestAddress { get; private set; } = requestAddress;
|
||||
|
||||
public string RequestMethod { get; private set; }
|
||||
public string RequestMethod { get; private set; } = requestMethod;
|
||||
|
||||
public RequestContentType RequestContentType { get; private set; }
|
||||
public RequestContentType RequestContentType { get; private set; } = requestContentType;
|
||||
|
||||
public ResponseContentType ResponseContentType { get; private set; }
|
||||
public ResponseContentType ResponseContentType { get; private set; } = responseContentType;
|
||||
|
||||
public string FlowCode { get; private set; }
|
||||
public string? FlowCode { get; private set; } = flowCode;
|
||||
|
||||
public int Timeout { get; private set; } = 20;
|
||||
public int Timeout { get; private set; } = timeout;
|
||||
|
||||
/// <summary>
|
||||
/// 接口单次请求数量上限,默认是1,表示不支持批量处理
|
||||
/// </summary>
|
||||
public int Limit { get; private set; } = 1;
|
||||
public int Limit { get; private set; } = limit;
|
||||
|
||||
/// <summary>
|
||||
/// 默认0,无限制
|
||||
/// 接口qps默认0,无限制
|
||||
/// </summary>
|
||||
public int Qps { get; private set; }
|
||||
public int Qps { get; private set; } = qps;
|
||||
|
||||
/// <summary>
|
||||
/// 映射后的数据类型
|
||||
/// </summary>
|
||||
public ParameterType MappedType { get; set; } = ParameterType.Object;
|
||||
public ParameterType MappedType { get; set; } = mappedType;
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
using System;
|
||||
using Fake.DomainDrivenDesign.Entities.Auditing;
|
||||
|
||||
namespace InterfaceForward.Domain.UpStreamInterfaceAggregate;
|
||||
|
||||
/// <summary>
|
||||
/// 上游接口映射服务商接口(1:N)
|
||||
/// </summary>
|
||||
public class InterfaceMapEntity: CreateAuditedEntity<Guid>, ISoftDelete
|
||||
{
|
||||
/// <summary>
|
||||
/// 上游接口代码
|
||||
/// </summary>
|
||||
public string UpStreamInterfaceCode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 映射服务商代码
|
||||
/// </summary>
|
||||
public string ServiceProviderCode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 映射服务商接口代码
|
||||
/// </summary>
|
||||
public string ServiceProviderInterfaceCode { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前线上版本
|
||||
/// </summary>
|
||||
public string PublishedVersion { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// 前置脚本
|
||||
///</summary>
|
||||
public string PrefixScript { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// 后置脚本
|
||||
///</summary>
|
||||
public string PostfixScript { get; set; }
|
||||
|
||||
public bool IsDeleted { get; }
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
namespace InterfaceForward.Domain.UpStreamInterfaceAggregate;
|
||||
|
||||
public class ParameterType(int id, string name) : Enumeration(id, name)
|
||||
{
|
||||
public static ParameterType String = new(1, "String");
|
||||
public static ParameterType Float = new(2, "Float");
|
||||
public static ParameterType Object = new(3, "Object");
|
||||
public static ParameterType Boolean = new(4, "Boolean");
|
||||
public static ParameterType Array = new(5, "Array");
|
||||
public static ParameterType Integer = new(6, "Integer");
|
||||
public static ParameterType Date = new(7, "Date");
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
namespace InterfaceForward.Domain.UpStreamInterfaceAggregate;
|
||||
|
||||
public class RequestContentType(int id, string name) : Enumeration(id, name)
|
||||
{
|
||||
public static RequestContentType Json = new(1, "application/json");
|
||||
public static RequestContentType Xml = new(2, "application/xml");
|
||||
public static RequestContentType FormUrlEncoded = new(3, "application/x-www-form-urlencoded");
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
namespace InterfaceForward.Domain.UpStreamInterfaceAggregate;
|
||||
|
||||
public class ResponseContentType(int id, string name) : Enumeration(id, name)
|
||||
{
|
||||
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
namespace InterfaceForward.Domain.UpStreamInterfaceAggregate;
|
||||
|
||||
public class ServiceType(int id, string name) : Enumeration(id, name)
|
||||
{
|
||||
public static ServiceType ServiceProvider = new(1, "服务商");
|
||||
public static ServiceType Platform = new(2, "平台");
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using Fake.DomainDrivenDesign.Entities.Auditing;
|
||||
|
||||
namespace InterfaceForward.Domain.UpStreamInterfaceAggregate;
|
||||
|
||||
public class UpStreamInterfaceAggregate(string name, string code) : FullAuditedAggregate<Guid>
|
||||
{
|
||||
public string Name { get; private set; } = name;
|
||||
|
||||
public string Code { get; private set; } = code;
|
||||
|
||||
///<summary>
|
||||
/// 描述
|
||||
///</summary>
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
using InterfaceForward.Domain.InterfaceMapAggregate;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace InterfaceForward.Infrastructure.EntityConfigurations;
|
||||
|
||||
public class InterfaceMapDetailsEntityTypeConfiguration : IEntityTypeConfiguration<InterfaceMapDetailsEntity>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<InterfaceMapDetailsEntity> builder)
|
||||
{
|
||||
builder.ToTable("interface_map_details", InterfaceForwardContext.DefaultSchema);
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.InterfaceMapId).IsRequired();
|
||||
builder.Property(x => x.ParamId).IsRequired();
|
||||
builder.Property(x => x.MappedParamId);
|
||||
builder.Property(x => x.IsInParam).IsRequired();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using InterfaceForward.Domain.InterfaceMapAggregate;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace InterfaceForward.Infrastructure.EntityConfigurations;
|
||||
|
||||
public class InterfaceMapEntityTypeConfiguration: IEntityTypeConfiguration<InterfaceMapEntity>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<InterfaceMapEntity> builder)
|
||||
{
|
||||
builder.ToTable("interface_map", InterfaceForwardContext.DefaultSchema);
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.UpStreamInterfaceCode).HasMaxLength(50).IsRequired();
|
||||
builder.Property(x => x.ServiceProviderCode).HasMaxLength(50).IsRequired();
|
||||
builder.Property(x => x.ServiceProviderInterfaceCodes)
|
||||
.IsRequired()
|
||||
.HasConversion(
|
||||
v => string.Join(',', v),
|
||||
v => v.Split(',', StringSplitOptions.RemoveEmptyEntries).ToList()
|
||||
);
|
||||
builder.Property(x => x.OnlineVersion).HasMaxLength(50);
|
||||
builder.Property(x => x.PrefixScript);
|
||||
builder.Property(x => x.PostfixScript);
|
||||
builder.Property(x => x.IsDeleted).HasDefaultValue(false);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
using Fake.EntityFrameworkCore;
|
||||
using InterfaceForward.Domain.InterfaceAggregate;
|
||||
using InterfaceForward.Domain.ServiceProviderAggregate;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace InterfaceForward.Infrastructure;
|
||||
|
||||
public class InterfaceForwardContext : FakeDbContext<InterfaceForwardContext>
|
||||
{
|
||||
public const string DefaultSchema = "forward";
|
||||
|
||||
public DbSet<InterfaceEntity> Interfaces { get; set; }
|
||||
|
||||
public DbSet<ServiceProviderEntity> ServiceProviders { get; set; }
|
||||
|
||||
public InterfaceForwardContext(DbContextOptions<InterfaceForwardContext> options) : base(options)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("InterfaceForwardContext::ctor ->" + base.GetHashCode());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user