Skip to content

Commit

Permalink
renamed the properties to follow entity framework conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
mikestock-nimble committed Dec 18, 2023
1 parent c844689 commit 36a66a2
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 61 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("nvarchar(max)")
.HasColumnName("Email");

b.Property<long?>("EstablishmentGroupTypeId")
.HasColumnType("bigint")
.HasColumnName("FK_EstablishmentGroupType");

b.Property<string>("EstablishmentName")
.HasColumnType("nvarchar(max)")
.HasColumnName("EstablishmentName");
Expand All @@ -119,26 +123,14 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("int")
.HasColumnName("EstablishmentNumber");

b.Property<long?>("FK_EstablishmentGroupType")
.HasColumnType("bigint")
.HasColumnName("FK_EstablishmentGroupType");

b.Property<long?>("FK_EstablishmentStatus")
b.Property<long?>("EstablishmentStatusId")
.HasColumnType("bigint")
.HasColumnName("FK_EstablishmentStatus");

b.Property<long?>("FK_EstablishmentType")
b.Property<long?>("EstablishmentTypeId")
.HasColumnType("bigint")
.HasColumnName("FK_EstablishmentType");

b.Property<long?>("FK_LocalAuthority")
.HasColumnType("bigint")
.HasColumnName("FK_LocalAuthority");

b.Property<long?>("FK_Region")
.HasColumnType("bigint")
.HasColumnName("FK_Region");

b.Property<string>("GORregion")
.HasColumnType("nvarchar(max)")
.HasColumnName("GORregion");
Expand Down Expand Up @@ -189,6 +181,10 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("float")
.HasColumnName("Latitude");

b.Property<long?>("LocalAuthorityId")
.HasColumnType("bigint")
.HasColumnName("FK_LocalAuthority");

b.Property<double?>("Longitude")
.HasColumnType("float")
.HasColumnName("Longitude");
Expand Down Expand Up @@ -319,6 +315,10 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("nvarchar(max)")
.HasColumnName("ReasonEstablishmentClosed");

b.Property<long?>("RegionId")
.HasColumnType("bigint")
.HasColumnName("FK_Region");

b.Property<string>("ReligiousCharacter")
.HasColumnType("nvarchar(max)")
.HasColumnName("ReligiousCharacter");
Expand Down Expand Up @@ -403,12 +403,12 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.HasKey("SK");

b.HasIndex("FK_EstablishmentType");

b.HasIndex("FK_LocalAuthority");
b.HasIndex("EstablishmentTypeId");

b.HasIndex("IfdPipelineSK");

b.HasIndex("LocalAuthorityId");

b.ToTable("EducationEstablishment", "mstr");
});

Expand Down Expand Up @@ -735,16 +735,16 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
b.HasOne("Dfe.Academies.Domain.Establishment.EstablishmentType", "EstablishmentType")
.WithMany()
.HasForeignKey("FK_EstablishmentType");

b.HasOne("Dfe.Academies.Domain.Establishment.LocalAuthority", "LocalAuthority")
.WithMany()
.HasForeignKey("FK_LocalAuthority");
.HasForeignKey("EstablishmentTypeId");

b.HasOne("Dfe.Academies.Domain.Establishment.IfdPipeline", "IfdPipeline")
.WithMany()
.HasForeignKey("IfdPipelineSK");

b.HasOne("Dfe.Academies.Domain.Establishment.LocalAuthority", "LocalAuthority")
.WithMany()
.HasForeignKey("LocalAuthorityId");

b.Navigation("EstablishmentType");

b.Navigation("IfdPipeline");
Expand Down
14 changes: 7 additions & 7 deletions Dfe.Academies.Api.Infrastructure/MstrContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ private void ConfigureEstablishment(EntityTypeBuilder<Establishment> establishme
establishmentConfiguration.Property(e => e.Email).HasColumnName("Email");
establishmentConfiguration.Property(e => e.EstablishmentName).HasColumnName("EstablishmentName");
establishmentConfiguration.Property(e => e.EstablishmentNumber).HasColumnName("EstablishmentNumber");
establishmentConfiguration.Property(e => e.FK_EstablishmentGroupType).HasColumnName("FK_EstablishmentGroupType");
establishmentConfiguration.Property(e => e.FK_EstablishmentStatus).HasColumnName("FK_EstablishmentStatus");
establishmentConfiguration.Property(e => e.FK_EstablishmentType).HasColumnName("FK_EstablishmentType");
establishmentConfiguration.Property(e => e.FK_LocalAuthority).HasColumnName("FK_LocalAuthority");
establishmentConfiguration.Property(e => e.FK_Region).HasColumnName("FK_Region");
establishmentConfiguration.Property(e => e.EstablishmentGroupTypeId).HasColumnName("FK_EstablishmentGroupType");
establishmentConfiguration.Property(e => e.EstablishmentStatusId).HasColumnName("FK_EstablishmentStatus");
establishmentConfiguration.Property(e => e.EstablishmentTypeId).HasColumnName("FK_EstablishmentType");
establishmentConfiguration.Property(e => e.LocalAuthorityId).HasColumnName("FK_LocalAuthority");
establishmentConfiguration.Property(e => e.RegionId).HasColumnName("FK_Region");
establishmentConfiguration.Property(e => e.GORregion).HasColumnName("GORregion");
establishmentConfiguration.Property(e => e.HeadFirstName).HasColumnName("HeadFirstName");
establishmentConfiguration.Property(e => e.HeadLastName).HasColumnName("HeadLastName");
Expand Down Expand Up @@ -149,13 +149,13 @@ private void ConfigureEstablishment(EntityTypeBuilder<Establishment> establishme
establishmentConfiguration
.HasOne(x => x.EstablishmentType)
.WithMany()
.HasForeignKey(x => x.FK_EstablishmentType)
.HasForeignKey(x => x.EstablishmentTypeId)
.IsRequired(false);

establishmentConfiguration
.HasOne(x => x.LocalAuthority)
.WithMany()
.HasForeignKey(x => x.FK_LocalAuthority)
.HasForeignKey(x => x.LocalAuthorityId)
.IsRequired(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ private IQueryable<EstablishmentQueryResult> BaseQuery()
var result =
from establishment in _context.Establishments
from ifdPipeline in _context.IfdPipelines.Where(i => i.GeneralDetailsUrn == establishment.PK_GIAS_URN).DefaultIfEmpty()
from establishmentType in _context.EstablishmentTypes.Where(e => e.SK == establishment.FK_EstablishmentType).DefaultIfEmpty()
from localAuthority in _context.LocalAuthorities.Where(l => l.SK == establishment.FK_LocalAuthority).DefaultIfEmpty()
from establishmentType in _context.EstablishmentTypes.Where(e => e.SK == establishment.EstablishmentTypeId).DefaultIfEmpty()
from localAuthority in _context.LocalAuthorities.Where(l => l.SK == establishment.LocalAuthorityId).DefaultIfEmpty()
select new EstablishmentQueryResult { Establishment = establishment, IfdPipeline = ifdPipeline, LocalAuthority = localAuthority, EstablishmentType = establishmentType };

return result;
Expand Down
10 changes: 5 additions & 5 deletions Dfe.Academies.Domain/Establishment/Establishment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ public class Establishment
public string? PK_GIAS_URN { get; set; }
public long? PK_CDM_ID { get; set; }
public int? URN { get; set; }
public long? FK_LocalAuthority { get; set; }
public long? FK_EstablishmentType { get; set; }
public long? FK_EstablishmentGroupType { get; set; }
public long? FK_EstablishmentStatus { get; set; }
public long? FK_Region { get; set; }
public long? LocalAuthorityId { get; set; }
public long? EstablishmentTypeId { get; set; }
public long? EstablishmentGroupTypeId { get; set; }
public long? EstablishmentStatusId { get; set; }
public long? RegionId { get; set; }
public int? EstablishmentNumber { get; set; }
public string? EstablishmentName { get; set; }
public double? Latitude { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions TramsDataApi.Test/Helpers/DatabaseModelBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public static Establishment BuildEstablishment()
result.LocalAuthority = null;
result.EstablishmentType = null;
result.PK_GIAS_URN = _fixture.Create<int>().ToString();
result.FK_EstablishmentType = 228;
result.FK_LocalAuthority = 1;
result.EstablishmentTypeId = 228;
result.LocalAuthorityId = 1;

return result;
}
Expand Down

0 comments on commit 36a66a2

Please sign in to comment.