Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Data.Entity;
- using System.Security.Claims;
- using System.Threading.Tasks;
- using Microsoft.AspNet.Identity;
- using Microsoft.AspNet.Identity.EntityFramework;
- using Dota2MK_Final.Models;
- namespace Dota2MK_FinalPage.Models
- {
- // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
- public class ApplicationUser : IdentityUser
- {
- public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
- {
- // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
- var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
- // Add custom user claims here
- return userIdentity;
- }
- }
- public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
- {
- public ApplicationDbContext()
- : base("DefaultConnection", throwIfV1Schema: false)
- {
- }
- public DbSet<Country> Countries { get; set; }
- public DbSet<PrizeType> PrizeTypes { get; set; }
- public DbSet<Prize> Prizes { get; set; }
- public DbSet<Player> Players { get; set; }
- public DbSet<Team> Teams { get; set; }
- public DbSet<Match> Matches { get; set; }
- public DbSet<Tournament> Tournaments { get; set; }
- public static ApplicationDbContext Create()
- {
- return new ApplicationDbContext();
- }
- protected override void OnModelCreating(DbModelBuilder modelBuilder)
- {
- modelBuilder.Entity<Match>()
- .HasRequired(m => m.Radiant)
- .WithMany(t => t.Matches)
- .HasForeignKey(m => m.RadiantId)
- .WillCascadeOnDelete(false);
- modelBuilder.Entity<Match>()
- .HasRequired(m => m.Dire)
- .WithMany(t => t.Matches)
- .HasForeignKey(m => m.DireId)
- .WillCascadeOnDelete(false);
- base.OnModelCreating(modelBuilder);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement