Rename some entities

This commit is contained in:
Фролов 2021-08-10 15:53:11 +05:00
parent 26f291806f
commit ae5954e345
5 changed files with 19 additions and 19 deletions

View File

@ -16,8 +16,6 @@ namespace AsbCloudDb.Model
public virtual DbSet<Company> Companies { get; set; } public virtual DbSet<Company> Companies { get; set; }
public virtual DbSet<DataSaubBase> DataSaubBases { get; set; } public virtual DbSet<DataSaubBase> DataSaubBases { get; set; }
public virtual DbSet<Deposit> Deposits { get; set; } public virtual DbSet<Deposit> Deposits { get; set; }
public virtual DbSet<Event> Events { get; set; }
public virtual DbSet<Message> Messages { get; set; }
public virtual DbSet<User> Users { get; set; } public virtual DbSet<User> Users { get; set; }
public virtual DbSet<UserRole> UserRoles { get; set; } public virtual DbSet<UserRole> UserRoles { get; set; }
public virtual DbSet<Well> Wells { get; set; } public virtual DbSet<Well> Wells { get; set; }
@ -25,8 +23,10 @@ namespace AsbCloudDb.Model
public virtual DbSet<File> Files { get; set; } public virtual DbSet<File> Files { get; set; }
public virtual DbSet<FileCategory> FileCategories { get; set; } public virtual DbSet<FileCategory> FileCategories { get; set; }
public virtual DbSet<Telemetry> Telemetries { get; set; } public virtual DbSet<Telemetry> Telemetries { get; set; }
public virtual DbSet<TelemetryEvent> TelemetryEvents { get; set; }
public virtual DbSet<TelemetryMessage> TelemetryMessages { get; set; }
public virtual DbSet<TelemetryUser> TelemetryUsers { get; set; } public virtual DbSet<TelemetryUser> TelemetryUsers { get; set; }
public virtual DbSet<TelemetryOperation> Operations { get; set; } public virtual DbSet<TelemetryOperation> TelemetryOperations { get; set; }
public virtual DbSet<TelemetryAnalysis> TelemetryAnalysis { get; set; } public virtual DbSet<TelemetryAnalysis> TelemetryAnalysis { get; set; }
public virtual DbSet<WellSection> WellSections { get; set; } public virtual DbSet<WellSection> WellSections { get; set; }
public virtual DbSet<WellOperation> WellOperations { get; set; } public virtual DbSet<WellOperation> WellOperations { get; set; }
@ -74,7 +74,7 @@ namespace AsbCloudDb.Model
.HasConstraintName("t_data_saub_base_t_telemetry_id_fk"); .HasConstraintName("t_data_saub_base_t_telemetry_id_fk");
}); });
modelBuilder.Entity<Message>(entity => modelBuilder.Entity<TelemetryMessage>(entity =>
{ {
entity.HasOne(d => d.Telemetry) entity.HasOne(d => d.Telemetry)
.WithMany(p => p.Messages) .WithMany(p => p.Messages)
@ -106,9 +106,9 @@ namespace AsbCloudDb.Model
.HasConstraintName("t_analysis_t_operation_id_fk"); .HasConstraintName("t_analysis_t_operation_id_fk");
}); });
modelBuilder.Entity<Event>(entity => modelBuilder.Entity<TelemetryEvent>(entity =>
{ {
entity.HasKey(nameof(Event.IdTelemetry), nameof(Event.IdEvent)); entity.HasKey(nameof(TelemetryEvent.IdTelemetry), nameof(TelemetryEvent.IdEvent));
entity.HasOne(d => d.Telemetry) entity.HasOne(d => d.Telemetry)
.WithMany(p => p.Events) .WithMany(p => p.Events)
.HasForeignKey(d => d.IdTelemetry) .HasForeignKey(d => d.IdTelemetry)

View File

@ -13,8 +13,8 @@ namespace AsbCloudDb.Model
DbSet<Company> Companies { get; set; } DbSet<Company> Companies { get; set; }
DbSet<DataSaubBase> DataSaubBases { get; set; } DbSet<DataSaubBase> DataSaubBases { get; set; }
DbSet<Deposit> Deposits { get; set; } DbSet<Deposit> Deposits { get; set; }
DbSet<Event> Events { get; set; } DbSet<TelemetryEvent> TelemetryEvents { get; set; }
DbSet<Message> Messages { get; set; } DbSet<TelemetryMessage> TelemetryMessages { get; set; }
DbSet<User> Users { get; set; } DbSet<User> Users { get; set; }
DbSet<UserRole> UserRoles { get; set; } DbSet<UserRole> UserRoles { get; set; }
DbSet<ReportProperties> ReportProperties { get; set; } DbSet<ReportProperties> ReportProperties { get; set; }
@ -22,7 +22,7 @@ namespace AsbCloudDb.Model
DbSet<FileCategory> FileCategories { get; set; } DbSet<FileCategory> FileCategories { get; set; }
DbSet<Telemetry> Telemetries { get; set; } DbSet<Telemetry> Telemetries { get; set; }
DbSet<TelemetryUser> TelemetryUsers { get; set; } DbSet<TelemetryUser> TelemetryUsers { get; set; }
DbSet<TelemetryOperation> Operations { get; set; } DbSet<TelemetryOperation> TelemetryOperations { get; set; }
DbSet<TelemetryAnalysis> TelemetryAnalysis { get; set; } DbSet<TelemetryAnalysis> TelemetryAnalysis { get; set; }
DbSet<Well> Wells { get; set; } DbSet<Well> Wells { get; set; }
DbSet<WellSection> WellSections { get; set; } DbSet<WellSection> WellSections { get; set; }

View File

@ -15,7 +15,7 @@ namespace AsbCloudDb.Model
public Telemetry() public Telemetry()
{ {
DataSaubBases = new HashSet<DataSaubBase>(); DataSaubBases = new HashSet<DataSaubBase>();
Messages = new HashSet<Message>(); Messages = new HashSet<TelemetryMessage>();
} }
[Key] [Key]
@ -34,14 +34,14 @@ namespace AsbCloudDb.Model
[InverseProperty(nameof(DataSaubBase.Telemetry))] [InverseProperty(nameof(DataSaubBase.Telemetry))]
public virtual ICollection<DataSaubBase> DataSaubBases { get; set; } public virtual ICollection<DataSaubBase> DataSaubBases { get; set; }
[InverseProperty(nameof(Message.Telemetry))] [InverseProperty(nameof(TelemetryMessage.Telemetry))]
public virtual ICollection<Message> Messages { get; set; } public virtual ICollection<TelemetryMessage> Messages { get; set; }
[InverseProperty(nameof(TelemetryUser.Telemetry))] [InverseProperty(nameof(TelemetryUser.Telemetry))]
public virtual ICollection<TelemetryUser> Users { get; set; } public virtual ICollection<TelemetryUser> Users { get; set; }
[InverseProperty(nameof(Event.Telemetry))] [InverseProperty(nameof(TelemetryEvent.Telemetry))]
public virtual ICollection<Event> Events { get; set; } public virtual ICollection<TelemetryEvent> Events { get; set; }
[InverseProperty(nameof(TelemetryAnalysis.Telemetry))] [InverseProperty(nameof(TelemetryAnalysis.Telemetry))]
public virtual ICollection<TelemetryAnalysis> Analysis { get; set; } public virtual ICollection<TelemetryAnalysis> Analysis { get; set; }

View File

@ -6,8 +6,8 @@ using System.Text.Json.Serialization;
namespace AsbCloudDb.Model namespace AsbCloudDb.Model
{ {
[Table("t_event"), Comment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии.")] [Table("t_telemetry_event"), Comment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии.")]
public partial class Event public partial class TelemetryEvent
{ {
[Column("id_event")] [Column("id_event")]
public int IdEvent { get; set; } public int IdEvent { get; set; }
@ -26,7 +26,7 @@ namespace AsbCloudDb.Model
[Column("message_template")] [Column("message_template")]
public string MessageTemplate { get; set; } public string MessageTemplate { get; set; }
public string MakeMessageText(Message message) public string MakeMessageText(TelemetryMessage message)
{ {
var args = new string[] { message.Arg0, message.Arg1, message.Arg2, message.Arg3 }; var args = new string[] { message.Arg0, message.Arg1, message.Arg2, message.Arg3 };
return string.Format(MessageTemplate, args); return string.Format(MessageTemplate, args);

View File

@ -7,8 +7,8 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model namespace AsbCloudDb.Model
{ {
[Table("t_message"), Comment("Сообщения на буровых")] [Table("t_telemetry_message"), Comment("Сообщения на буровых")]
public partial class Message : IId, IIdTelemetryDate public partial class TelemetryMessage : IId, IIdTelemetryDate
{ {
[Key] [Key]
[Column("id")] [Column("id")]