模型类
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Yi.Framework.Model
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ namespace Yi.Framework.Model
|
||||
optionsBuilder.UseSqlite(_connStr);
|
||||
}
|
||||
}
|
||||
public virtual DbSet<user> user { get; set; }
|
||||
public DbSet<user> user { get; set; }
|
||||
public DbSet<role> role { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
78
Yi.Framework/Yi.Framework.Model/Migrations/20211011082334_yi-2.Designer.cs
generated
Normal file
78
Yi.Framework/Yi.Framework.Model/Migrations/20211011082334_yi-2.Designer.cs
generated
Normal file
@@ -0,0 +1,78 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Yi.Framework.Model;
|
||||
|
||||
namespace Yi.Framework.Model.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20211011082334_yi-2")]
|
||||
partial class yi2
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "5.0.10");
|
||||
|
||||
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
|
||||
{
|
||||
b.Property<int>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("introduce")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("is_delete")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("role_name")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("role");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
|
||||
{
|
||||
b.Property<int>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("age")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("email")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("icon")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ip")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("is_delete")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("nick")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("password")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("username")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("user");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Yi.Framework.Model.Migrations
|
||||
{
|
||||
public partial class yi2 : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "name",
|
||||
table: "user",
|
||||
newName: "username");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "age",
|
||||
table: "user",
|
||||
type: "INTEGER",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "INTEGER");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "email",
|
||||
table: "user",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "icon",
|
||||
table: "user",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ip",
|
||||
table: "user",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "is_delete",
|
||||
table: "user",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "nick",
|
||||
table: "user",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "password",
|
||||
table: "user",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "role",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
role_name = table.Column<string>(type: "TEXT", nullable: true),
|
||||
introduce = table.Column<string>(type: "TEXT", nullable: true),
|
||||
is_delete = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_role", x => x.id);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "role");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "email",
|
||||
table: "user");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "icon",
|
||||
table: "user");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ip",
|
||||
table: "user");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "is_delete",
|
||||
table: "user");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "nick",
|
||||
table: "user");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "password",
|
||||
table: "user");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "username",
|
||||
table: "user",
|
||||
newName: "name");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "age",
|
||||
table: "user",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "INTEGER",
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
@@ -15,16 +16,54 @@ namespace Yi.Framework.Model.Migrations
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "5.0.10");
|
||||
|
||||
modelBuilder.Entity("Yi.Framework.Model.Models.role", b =>
|
||||
{
|
||||
b.Property<int>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("introduce")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("is_delete")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("role_name")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
b.ToTable("role");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Yi.Framework.Model.Models.user", b =>
|
||||
{
|
||||
b.Property<int>("id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("age")
|
||||
b.Property<int?>("age")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("name")
|
||||
b.Property<string>("email")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("icon")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ip")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("is_delete")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("nick")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("password")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("username")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("id");
|
||||
|
||||
18
Yi.Framework/Yi.Framework.Model/Models/baseModel.cs
Normal file
18
Yi.Framework/Yi.Framework.Model/Models/baseModel.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Model.Models
|
||||
{
|
||||
public class baseModel<T>
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
|
||||
public T id { get; set; }
|
||||
public int is_delete { get; set; }
|
||||
}
|
||||
}
|
||||
14
Yi.Framework/Yi.Framework.Model/Models/loopModel.cs
Normal file
14
Yi.Framework/Yi.Framework.Model/Models/loopModel.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Model.Models
|
||||
{
|
||||
public class loopModel:baseModel<int>
|
||||
{
|
||||
public int? is_top { get; set; }
|
||||
public int? sort { get; set; }
|
||||
}
|
||||
}
|
||||
20
Yi.Framework/Yi.Framework.Model/Models/menu.cs
Normal file
20
Yi.Framework/Yi.Framework.Model/Models/menu.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Model.Models
|
||||
{
|
||||
public class menu :loopModel
|
||||
{
|
||||
public string icon { get; set; }
|
||||
public string router { get; set; }
|
||||
public string menu_name { get; set; }
|
||||
|
||||
|
||||
|
||||
public menu children { get; set; }
|
||||
public mould mould { get; set; }
|
||||
}
|
||||
}
|
||||
14
Yi.Framework/Yi.Framework.Model/Models/mould.cs
Normal file
14
Yi.Framework/Yi.Framework.Model/Models/mould.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Model.Models
|
||||
{
|
||||
public class mould:baseModel<int>
|
||||
{
|
||||
public string mould_name { get; set; }
|
||||
public string url { get; set; }
|
||||
}
|
||||
}
|
||||
17
Yi.Framework/Yi.Framework.Model/Models/role.cs
Normal file
17
Yi.Framework/Yi.Framework.Model/Models/role.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Model.Models
|
||||
{
|
||||
public class role:baseModel
|
||||
{
|
||||
public string role_name { get; set; }
|
||||
public string introduce { get; set; }
|
||||
|
||||
|
||||
public ICollection<menu> menus { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,18 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Model.Models
|
||||
{
|
||||
public class user
|
||||
public class user:baseModel<int>
|
||||
{
|
||||
[Key]
|
||||
public int id { get; set; }
|
||||
public string name { get; set; }
|
||||
public int age { get; set; }
|
||||
public string username { get; set; }
|
||||
public string password { get; set; }
|
||||
public string icon { get; set; }
|
||||
public string nick { get; set; }
|
||||
public string email { get; set; }
|
||||
public string ip { get; set; }
|
||||
public int? age { get; set; }
|
||||
public string introduction { get; set; }
|
||||
|
||||
public ICollection<role> roles { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user