-
-
Save Suchiman/30a88e4130698d0d1990501b800b2f56 to your computer and use it in GitHub Desktop.
ef error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel.DataAnnotations; | |
using System.ComponentModel.DataAnnotations.Schema; | |
using System.Data.Entity.ModelConfiguration; | |
using System.Linq; | |
using System.Web; | |
namespace NashGaming.Models | |
{ | |
public class MainTeam : IComparable | |
{ | |
public int MainTeamID { get; set; } | |
public string TeamName { get; set; } | |
public DateTime DateFounded { get; set; } | |
[Required] | |
public virtual Gamer Founder { get; set; } | |
public string Website { get; set; } | |
public bool Active { get; set; } | |
public virtual List<SubTeam> SubTeams { get; set; } | |
public string LogoLink { get; set; } | |
public int CompareTo(object obj) | |
{ | |
MainTeam team = obj as MainTeam; | |
return this.TeamName.CompareTo(team.TeamName); | |
} | |
public override bool Equals(object obj) | |
{ | |
MainTeam a = obj as MainTeam; | |
if (obj == null) | |
{ | |
return false; | |
} | |
return a.MainTeamID == this.MainTeamID; | |
} | |
} | |
public class MainTeamConfiguration : EntityTypeConfiguration<MainTeam> | |
{ | |
public MainTeamConfiguration() | |
{ | |
HasMany(o => o.SubTeams) | |
.WithRequired(o => o.MainTeam) | |
.HasForeignKey(o => o.SubTeamID); | |
HasRequired(o => o.Founder) | |
.WithOptional(o => o.MainTeam); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel.DataAnnotations; | |
using System.ComponentModel.DataAnnotations.Schema; | |
using System.Data.Entity.ModelConfiguration; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace NashGaming.Models | |
{ | |
public class SubTeam : IComparable | |
{ | |
public int SubTeamID { get; set; } | |
public string SubTeamName { get; set; } | |
[Required] | |
public virtual MainTeam MainTeam { get; set; } | |
[Required] | |
public virtual Gamer Captain { get; set; } | |
public virtual League League { get; set; } | |
public virtual Ladder Ladder { get; set; } | |
public int Rank { get; set; } | |
public int Points { get; set; } | |
public int Wins { get; set; } | |
public int Losses { get; set; } | |
public virtual List<Gamer> Roster { get; set; } | |
public virtual List<Challenge> Challenges { get; set; } | |
public bool Active { get; set; } | |
public int CompareTo(object obj) | |
{ | |
SubTeam subteam = obj as SubTeam; | |
return this.Points.CompareTo(subteam.Points); | |
} | |
public override bool Equals(object obj) | |
{ | |
SubTeam a = obj as SubTeam; | |
if (obj == null) | |
{ | |
return false; | |
} | |
return a.SubTeamID == this.SubTeamID; | |
} | |
} | |
public class SubTeamConfiguration : EntityTypeConfiguration<SubTeam> | |
{ | |
public SubTeamConfiguration() | |
{ | |
HasRequired(o => o.MainTeam) | |
.WithMany(o => o.SubTeams) | |
.HasForeignKey(o => o.MainTeam); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment