81 lines
3.2 KiB
C#
81 lines
3.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace HuanMeng.StableDiffusion.TextGeneration.Models;
|
|
|
|
public partial class TextGenerationTestContext : DbContext
|
|
{
|
|
public TextGenerationTestContext()
|
|
{
|
|
}
|
|
|
|
public TextGenerationTestContext(DbContextOptions<TextGenerationTestContext> options)
|
|
: base(options)
|
|
{
|
|
}
|
|
|
|
public virtual DbSet<TextGenerationSession> TextGenerationSessions { get; set; }
|
|
|
|
public virtual DbSet<TextGenerationSessionDetail> TextGenerationSessionDetails { 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=172.27.27.12;Database=TextGenerationTest;User Id=zpc;Password=zpc;TrustServerCertificate=true;");
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<TextGenerationSession>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Id).HasName("PK_TextGenerationSession'");
|
|
|
|
entity.ToTable("TextGenerationSession");
|
|
|
|
entity.Property(e => e.Id).HasComment("主键");
|
|
entity.Property(e => e.CreateDateTime)
|
|
.HasComment("创建时间")
|
|
.HasColumnType("datetime");
|
|
entity.Property(e => e.LastDateTime)
|
|
.HasComment("最后一次请求时间")
|
|
.HasColumnType("datetime");
|
|
entity.Property(e => e.SessionId)
|
|
.HasMaxLength(32)
|
|
.IsUnicode(false)
|
|
.HasComment("绘画Id");
|
|
entity.Property(e => e.SessionName)
|
|
.HasMaxLength(100)
|
|
.HasComment("绘画名称");
|
|
entity.Property(e => e.UserId)
|
|
.HasMaxLength(32)
|
|
.IsUnicode(false)
|
|
.HasComment("用户Id");
|
|
});
|
|
|
|
modelBuilder.Entity<TextGenerationSessionDetail>(entity =>
|
|
{
|
|
entity.Property(e => e.CreateDateTime)
|
|
.HasComment("创建时间")
|
|
.HasColumnType("datetime");
|
|
entity.Property(e => e.Message)
|
|
.HasMaxLength(1000)
|
|
.HasComment("消息内容");
|
|
entity.Property(e => e.Model)
|
|
.HasMaxLength(100)
|
|
.HasComment("模型");
|
|
entity.Property(e => e.Role)
|
|
.HasMaxLength(50)
|
|
.HasComment("角色");
|
|
entity.Property(e => e.SessionId)
|
|
.HasMaxLength(32)
|
|
.IsUnicode(false)
|
|
.HasComment("会话Id");
|
|
entity.Property(e => e.TextGenerationSessionId).HasComment("会话id");
|
|
entity.Property(e => e.TimeStamp).HasComment("时间戳");
|
|
});
|
|
|
|
OnModelCreatingPartial(modelBuilder);
|
|
}
|
|
|
|
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
|
}
|