You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
939 B

using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
namespace QuickCHAT.Models
{
public class DatabaseContext : DbContext
{
public DbSet<User> Users { get; set; }
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options)
{ }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>()
.HasAlternateKey(u => u.Username)
.HasName("AK_Username");
}
}
public class User
{
public int UserID { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string First { get; set; }
public string Last { get; set; }
public string Description { get; set; }
}
}