Skip to content

Instantly share code, notes, and snippets.

@gsedubun
Last active January 31, 2018 10:45
Show Gist options
  • Save gsedubun/f08a80c4728f8c38356d92811a390a03 to your computer and use it in GitHub Desktop.
Save gsedubun/f08a80c4728f8c38356d92811a390a03 to your computer and use it in GitHub Desktop.
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace belajarnetcoremvc.Models
{
public class belajarDbContext :DbContext
{
public belajarDbContext(DbContextOptions options) : base(options)
{
}
public DbSet<TblRole> TblRole { get; set; }
public DbSet<TblUser> TblUser { get; set; }
public DbSet<TblUserRole> TblUserRole { get; set; }
}
public class TblUser
{
[Key]
public int UserID { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public string EmailAddress { get; set; }
}
public class TblRole{
[Key]
public int RoleID { get; set; }
public string RoleName { get; set; }
}
public class TblUserRole
{
[Key]
public int ID { get; set; }
public TblUser TblUser { get; set; }
public TblRole TblRole { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment