I am using Entity Framework 5 and I tried to override .Equals and .GetHashCode
public class Students    {
    public int PersonId { get; set; }
    public string Name { get; set; }
    public int Age {get; set;} 
    public override bool Equals(object obj)
    {
        return this.Equals(obj as Students);
    }
    public bool Equals(Students other)
    {
        if (other == null)
            return false;
        return this.Age.Equals(other.Age) &&
            (
                this.Name == other.Name ||
                this.Name != null &&
                this.Name.Equals(other.Name)
            );
    }
    public override int GetHashCode()
    {
        return PersonId.GetHashCode();
    }
}
However my very simple method does not seem to work and I get errors from EF saying: Conflicting changes to the role
I am thinking this is due to the way EF does comparisons.
Is there a way that I can provide my own method and call this in the same way as .Equals ? I was thinking maybe I could code a method called .Same and use that. Is that something that is reasonable to do. If I did that and I wanted to compare two objects then how could I code it and call it ?
 
    