[성현모] [HubX] DB Scaffold 추가

This commit is contained in:
SHM
2025-03-13 09:36:55 +09:00
parent e97b5a3524
commit 25be83359b
7 changed files with 129 additions and 2 deletions

View File

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
namespace DB.HubXDB;
public partial class HubXContext : DbContext
{
public HubXContext()
{
}
public HubXContext(DbContextOptions<HubXContext> options)
: base(options)
{
}
public virtual DbSet<TStorage> TStorages { 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("server=127.0.0.1; user id=VPKI; password=Kefico!@34; database=HubX; TrustServerCertificate=true;");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<TStorage>(entity =>
{
entity.HasKey(e => e.CHuid).HasName("PK__tStorage__346C9EFC86D3DC51");
entity.ToTable("tStorage");
entity.Property(e => e.CHuid).HasColumnName("cHuid");
entity.Property(e => e.CData1)
.HasMaxLength(4000)
.HasColumnName("cData1");
entity.Property(e => e.CData2)
.HasMaxLength(4000)
.HasColumnName("cData2");
entity.Property(e => e.CData3)
.HasMaxLength(4000)
.HasColumnName("cData3");
entity.Property(e => e.CData4)
.HasMaxLength(4000)
.HasColumnName("cData4");
entity.Property(e => e.CData5)
.HasMaxLength(4000)
.HasColumnName("cData5");
entity.Property(e => e.CDateTime).HasColumnName("cDateTime");
entity.Property(e => e.CIdentity)
.HasMaxLength(200)
.HasColumnName("cIdentity");
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
namespace DB.HubXDB;
public partial class TStorage
{
public long CHuid { get; set; }
public string CIdentity { get; set; } = null!;
public DateTime CDateTime { get; set; }
public string? CData1 { get; set; }
public string? CData2 { get; set; }
public string? CData3 { get; set; }
public string? CData4 { get; set; }
public string? CData5 { get; set; }
}

View File

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.14">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.14">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>