Обновил бд
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.17" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.16" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -10,10 +10,6 @@ namespace ApplicationSystem.Database.Applications.Database.Context;
|
||||
|
||||
public partial class ApplicationContext : DbContext
|
||||
{
|
||||
public ApplicationContext()
|
||||
{
|
||||
}
|
||||
|
||||
public ApplicationContext(DbContextOptions<ApplicationContext> options)
|
||||
: base(options)
|
||||
{
|
||||
@@ -23,14 +19,13 @@ public partial class ApplicationContext : DbContext
|
||||
|
||||
public virtual DbSet<ApplicationType> ApplicationTypes { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
|
||||
=> optionsBuilder.UseSqlServer("Data Source=localhost,6001;Initial Catalog=application_system_application;Persist Security Info=True;User ID=sa;Password=Jf5R0Ob4v!");
|
||||
public virtual DbSet<Image> Images { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.ApplyConfiguration(new Configurations.ApplicationConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new Configurations.ApplicationTypeConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new Configurations.ImageConfiguration());
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,10 @@ namespace ApplicationSystem.Database.Applications.Database.Context.Configuration
|
||||
{
|
||||
entity.Property(e => e.Deleted).HasDefaultValueSql("(NULL)");
|
||||
|
||||
entity.HasOne(d => d.Image).WithMany(p => p.Applications)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK_application_ImageId");
|
||||
|
||||
entity.HasOne(d => d.Type).WithMany(p => p.Applications).HasConstraintName("FK_application_type_id");
|
||||
|
||||
OnConfigurePartial(entity);
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
|
||||
using ApplicationSystem.Database.Applications.Database.Context;
|
||||
using ApplicationSystem.Database.Applications.Database.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ApplicationSystem.Database.Applications.Database.Context.Configurations
|
||||
{
|
||||
public partial class ImageConfiguration : IEntityTypeConfiguration<Image>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Image> entity)
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PK_image_id");
|
||||
|
||||
entity.Property(e => e.Id).ValueGeneratedNever();
|
||||
entity.Property(e => e.Image1).IsFixedLength();
|
||||
|
||||
OnConfigurePartial(entity);
|
||||
}
|
||||
|
||||
partial void OnConfigurePartial(EntityTypeBuilder<Image> entity);
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,14 @@ public partial class Application
|
||||
[Column("type_id")]
|
||||
public Guid TypeId { get; set; }
|
||||
|
||||
public Guid CreatorId { get; set; }
|
||||
|
||||
public Guid? ImageId { get; set; }
|
||||
|
||||
[ForeignKey("ImageId")]
|
||||
[InverseProperty("Applications")]
|
||||
public virtual Image Image { get; set; }
|
||||
|
||||
[ForeignKey("TypeId")]
|
||||
[InverseProperty("Applications")]
|
||||
public virtual ApplicationType Type { get; set; }
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// <auto-generated> This file has been auto generated by EF Core Power Tools. </auto-generated>
|
||||
#nullable disable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ApplicationSystem.Database.Applications.Database.Models;
|
||||
|
||||
[Table("image")]
|
||||
public partial class Image
|
||||
{
|
||||
[Key]
|
||||
[Column("id")]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("image")]
|
||||
[MaxLength(1)]
|
||||
public byte[] Image1 { get; set; }
|
||||
|
||||
[InverseProperty("Image")]
|
||||
public virtual ICollection<Application> Applications { get; set; } = new List<Application>();
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
"ContextClassName": "ApplicationContext",
|
||||
"ContextNamespace": null,
|
||||
"FilterSchemas": false,
|
||||
"IncludeConnectionString": true,
|
||||
"IncludeConnectionString": false,
|
||||
"ModelNamespace": null,
|
||||
"OutputContextPath": "Database\/Context",
|
||||
"OutputPath": "Database\/Models",
|
||||
@@ -21,6 +21,10 @@
|
||||
{
|
||||
"Name": "[dbo].[application_type]",
|
||||
"ObjectType": 0
|
||||
},
|
||||
{
|
||||
"Name": "[dbo].[image]",
|
||||
"ObjectType": 0
|
||||
}
|
||||
],
|
||||
"UiHint": null,
|
||||
@@ -28,6 +32,7 @@
|
||||
"UseAsyncStoredProcedureCalls": true,
|
||||
"UseBoolPropertiesWithoutDefaultSql": false,
|
||||
"UseDatabaseNames": false,
|
||||
"UseDatabaseNamesForRoutines": true,
|
||||
"UseDateOnlyTimeOnly": true,
|
||||
"UseDbContextSplitting": true,
|
||||
"UseDecimalDataAnnotationForSprocResult": true,
|
||||
@@ -35,6 +40,7 @@
|
||||
"UseHandleBars": false,
|
||||
"UseHierarchyId": false,
|
||||
"UseInflector": true,
|
||||
"UseInternalAccessModifiersForSprocsAndFunctions": false,
|
||||
"UseLegacyPluralizer": false,
|
||||
"UseManyToManyEntity": false,
|
||||
"UseNoDefaultConstructor": false,
|
||||
@@ -46,5 +52,6 @@
|
||||
"UseSchemaFolders": false,
|
||||
"UseSchemaNamespaces": false,
|
||||
"UseSpatial": false,
|
||||
"UseT4": false
|
||||
"UseT4": false,
|
||||
"UseT4Split": false
|
||||
}
|
||||
Reference in New Issue
Block a user