成功写入Uesrs数据库表
This commit is contained in:
9
WorkStation.Server/Context/Entity/BaseEntity.cs
Normal file
9
WorkStation.Server/Context/Entity/BaseEntity.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace WorkStation.Server.Context.Entity
|
||||
{
|
||||
public class BaseEntity
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public DateTime CreateTime { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
}
|
||||
}
|
8
WorkStation.Server/Context/Entity/User.cs
Normal file
8
WorkStation.Server/Context/Entity/User.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace WorkStation.Server.Context.Entity
|
||||
{
|
||||
public class User : BaseEntity
|
||||
{
|
||||
public string? Account { get; set; }
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
}
|
10
WorkStation.Server/Context/MyDbContext.cs
Normal file
10
WorkStation.Server/Context/MyDbContext.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WorkStation.Server.Context.Entity;
|
||||
|
||||
namespace WorkStation.Server.Context
|
||||
{
|
||||
public class MyDbContext(DbContextOptions<MyDbContext> options) : DbContext(options)
|
||||
{
|
||||
public DbSet<User> Users { get; set; }
|
||||
}
|
||||
}
|
9
WorkStation.Server/Context/Repository/UserRepository.cs
Normal file
9
WorkStation.Server/Context/Repository/UserRepository.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using Arch.EntityFrameworkCore.UnitOfWork;
|
||||
using WorkStation.Server.Context.Entity;
|
||||
|
||||
namespace WorkStation.Server.Context.Repository
|
||||
{
|
||||
public class UserRepository(MyDbContext context) : Repository<User>(context), IRepository<User>
|
||||
{
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user