CS2-53: Model changes to Well/Operation/SectionType

This commit is contained in:
KharchenkoVV 2021-08-16 10:21:46 +05:00
parent 57afb6b7d2
commit e668b8c2ff
4 changed files with 22 additions and 9 deletions

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
#nullable disable #nullable disable
@ -78,5 +79,9 @@ namespace AsbCloudDb.Model
[ForeignKey(nameof(IdTelemetry))] [ForeignKey(nameof(IdTelemetry))]
[InverseProperty(nameof(Model.Telemetry.Well))] [InverseProperty(nameof(Model.Telemetry.Well))]
public virtual Telemetry Telemetry { get; set; } public virtual Telemetry Telemetry { get; set; }
[JsonIgnore]
[InverseProperty(nameof(WellOperation.Well))]
public virtual ICollection<WellOperation> WellOperations { get; set; }
} }
} }

View File

@ -16,8 +16,8 @@ namespace AsbCloudDb.Model
[Column("id_well"), Comment("Id скважины")] [Column("id_well"), Comment("Id скважины")]
public int IdWell { get; set; } public int IdWell { get; set; }
[Column("id_section"), Comment("Id секции скважины")] [Column("id_well_section_type"), Comment("Id тип секции скважины")]
public int IdSection { get; set; } public int IdWellSectionType { get; set; }
[Column("id_category"), Comment("Id категории операции")] [Column("id_category"), Comment("Id категории операции")]
public int IdCategory { get; set; } public int IdCategory { get; set; }
@ -32,17 +32,21 @@ namespace AsbCloudDb.Model
public DateTime StartDate { get; set; } public DateTime StartDate { get; set; }
[Column("duration_hours"), Comment("Продолжительность в часах")] [Column("duration_hours"), Comment("Продолжительность в часах")]
public double Duration { get; set; } public double DurationHours { get; set; }
[Column("data"), Comment("Данные по операции")] [Column("data"), Comment("Доп. информация к выбраной категории")]
public string Data { get; set; } public string Info { get; set; }
[Column("comment"), Comment("Комментарий")] [Column("comment"), Comment("Комментарий")]
public string Comment { get; set; } public string Comment { get; set; }
[JsonIgnore] [JsonIgnore]
[ForeignKey(nameof(IdSection))] [ForeignKey(nameof(IdWell))]
public virtual WellSection WellSection { get; set; } public virtual Well Well { get; set; }
[JsonIgnore]
[ForeignKey(nameof(IdWellSectionType))]
public virtual WellSectionType WellSectionType { get; set; }
[JsonIgnore] [JsonIgnore]
[ForeignKey(nameof(IdCategory))] [ForeignKey(nameof(IdCategory))]

View File

@ -21,5 +21,9 @@ namespace AsbCloudDb.Model
[JsonIgnore] [JsonIgnore]
[InverseProperty(nameof(WellSection.WellSectionType))] [InverseProperty(nameof(WellSection.WellSectionType))]
public virtual ICollection<WellSection> WellSections { get; set; } public virtual ICollection<WellSection> WellSections { get; set; }
[JsonIgnore]
[InverseProperty(nameof(WellOperation.WellSectionType))]
public virtual ICollection<WellOperation> WellOperations { get; set; }
} }
} }

View File

@ -27,8 +27,8 @@ namespace AsbCloudInfrastructure.Services
int skip = 0, int take = 32, CancellationToken token = default) int skip = 0, int take = 32, CancellationToken token = default)
{ {
var query = dbSet var query = dbSet
.Include(s => s.WellSection) .Include(s => s.WellSectionType)
.Where(s => s.WellSection.IdWell == idWell) .Where(s => s.IdWell == idWell)
.AsNoTracking(); .AsNoTracking();
var result = new PaginationContainer<WellOperationDto> var result = new PaginationContainer<WellOperationDto>