One Update below
I have the following class that derives from EqualityComparer<T> that I am (attempting) to persist using Fluent/NHibernate.
public class WeeklyGSFEntity : EqualityComparer<WeeklyGSFEntity>
{
public virtual int IssueNumber { get; set; }
public virtual int Severity { get; set; }
public virtual char PainIndex { get; set; }
public virtual Status Status { get; set; }
public virtual int Month { get; set; }
public virtual int Year { get; set; }
public virtual DateTime DateCreated { get; set; }
public virtual Region Region { get; set; }
public virtual DateTime IncidentStart { get; set; }
public virtual DateTime IncidentEnd { get; set; }
public virtual int SRCount { get; set; }
public virtual string AggravatingFactors { get; set; }
public virtual string AggravatingFactorDescription { get; set; }
public virtual TimeSpan MTTR
{
get
{
return (IncidentEnd - IncidentStart);
}
}
public WeeklyGSFEntity()
{
Status = Status.New;
}
public override int GetHashCode() { ... }
internal static bool StaticEqual(WeeklyGSFEntity x, WeeklyGSFEntity y) { ... }
public static bool operator ==(WeeklyGSFEntity x, WeeklyGSFEntity y) { ... }
public static bool operator !=(WeeklyGSFEntity x, WeeklyGSFEntity y) { ... }
public override bool Equals(WeeklyGSFEntity x, WeeklyGSFEntity y) { ... }
public override bool Equals(object obj) { ... }
public override int GetHashCode(WeeklyGSFEntity obj) { ... }
}
public enum Status { ... }
public enum Region { ... }
Now, this worked last week. Now when I go to save any entity, I get this message:
The following types may not be used as proxies:
Core.Models.WeeklyGSFEntity: method IndexOf should be 'public/protected virtual' or 'protected internal virtual'
Core.Models.WeeklyGSFEntity: method LastIndexOf should be 'public/protected virtual' or 'protected internal virtual'
As you can see, there are no IndexOf or LastIndexOf methods… 🙂 I’ve tried to override them but they don’t exist to override in the first place!
Any ideas?
Update The First
So I dug into the IL and there is no sign of a method IndexOf or LastIndexOf. Now, before all this happened I did create a new class about conflicts which had a Collection of my WeeklyGSFEntities. Now this collection would have IndexOf and LastIndexOf methods however, I excluded both the mapping and the class from the project…
Okay so instead of deriving from
EqualityComparer<WeeklyGSFEntity>I implementedIEqualityComparer<WeeklyGSFEntity>.The issue disappeared…