| | |
| | | using System; |
| | | using Furion.DatabaseAccessor; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using Microsoft.EntityFrameworkCore.Metadata.Builders; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System.Linq; |
| | |
| | | /// <summary> |
| | | /// 企业 |
| | | /// </summary> |
| | | public class Enterprise : CommonEntity |
| | | public class Enterprise : CommonEntity, IEntityTypeBuilder<Enterprise> |
| | | { |
| | | public Enterprise() |
| | | { |
| | |
| | | public EnterpriseAuth EnterpriseAuth { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 所在省份Id |
| | | /// 所在省份编号 |
| | | /// </summary> |
| | | public Guid? ProvinceId { get; set; } |
| | | public string ProvinceCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 所在省份 |
| | |
| | | public DictionaryData Province { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 所在城市Id |
| | | /// 所在城市编号 |
| | | /// </summary> |
| | | public Guid? CityId { get; set; } |
| | | public string CityCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 所在城市 |
| | |
| | | public DictionaryData City { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 所属行业Id |
| | | /// 所属行业编号 |
| | | /// </summary> |
| | | public Guid? IndustryTypeId { get; set; } |
| | | public string IndustryTypeCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 所属行业 |
| | |
| | | /// 用户信息 |
| | | /// </summary> |
| | | public List<UserInfo> UserInfos { get; set; } |
| | | |
| | | public void Configure(EntityTypeBuilder<Enterprise> entityBuilder, DbContext dbContext, Type dbContextLocator) |
| | | { |
| | | entityBuilder |
| | | .HasOne(it => it.Province) |
| | | .WithMany() |
| | | .HasForeignKey(it => it.ProvinceCode) |
| | | .HasPrincipalKey(it => it.Code) |
| | | .OnDelete(DeleteBehavior.Restrict); |
| | | entityBuilder |
| | | .HasOne(it => it.City) |
| | | .WithMany() |
| | | .HasForeignKey(it => it.CityCode) |
| | | .HasPrincipalKey(it => it.Code) |
| | | .OnDelete(DeleteBehavior.Restrict); |
| | | entityBuilder |
| | | .HasOne(it => it.IndustryType) |
| | | .WithMany() |
| | | .HasForeignKey(it => it.IndustryTypeCode) |
| | | .HasPrincipalKey(it => it.Code) |
| | | .OnDelete(DeleteBehavior.Restrict); |
| | | } |
| | | } |
| | | } |