Skip to content

Instantly share code, notes, and snippets.

@ajtowf
Created March 2, 2014 20:37
Show Gist options
  • Save ajtowf/9313442 to your computer and use it in GitHub Desktop.
Save ajtowf/9313442 to your computer and use it in GitHub Desktop.
EF 5 -> 6 bug
public class Tee
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
...
[InverseProperty("TeeAsMale")]
public virtual ICollection<TeeHcp> CustomHcpAsMale { get; set; }
[InverseProperty("TeeAsFemale")]
public virtual ICollection<TeeHcp> CustomHcpAsFemale { get; set; }
}
public class Tee
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
...
[InverseProperty("TeeAsMale")]
public virtual ICollection<TeeHcp> CustomHcpAsMale { get; set; }
[InverseProperty("TeeAsFemale")]
public virtual ICollection<TeeHcp> CustomHcpAsFemale { get; set; }
}
public class TeeHcp
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore, IgnoreDataMember]
public int Id { get; set; }
public double From { get; set; }
public double To { get; set; }
public int Strokes { get; set; }
}
public class TeeHcp
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore, IgnoreDataMember]
public int Id { get; set; }
public double From { get; set; }
public double To { get; set; }
public int Strokes { get; set; }
[JsonIgnore, IgnoreDataMember]
public Tee TeeAsMale { get; set; }
[JsonIgnore, IgnoreDataMember]
public Tee TeeAsFemale { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment