Note that there are some explanatory texts on larger screens.

plurals
  1. POInvalid Proxy Type Exception with methods that don't exist - Fluent NHibernate
    text
    copied!<p><strong>One Update below</strong></p> <p>I have the following class that derives from <code>EqualityComparer&lt;T&gt;</code> that I am (attempting) to persist using Fluent/NHibernate.</p> <pre><code>public class WeeklyGSFEntity : EqualityComparer&lt;WeeklyGSFEntity&gt; { 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 { ... } </code></pre> <p>Now, this worked last week. Now when I go to save any entity, I get this message:</p> <pre><code> 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' </code></pre> <p>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!</p> <p>Any ideas?</p> <p><strong>Update The First</strong></p> <p>So I dug into the IL and there is no sign of a method <code>IndexOf</code> or <code>LastIndexOf</code>. Now, before all this happened I <em>did</em> create a new class about conflicts which had a Collection of my WeeklyGSFEntities. Now this collection would have <code>IndexOf</code> and <code>LastIndexOf</code> methods however, I excluded both the mapping and the class from the project...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload