Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat are some reasons NHibernate will not execute SQL?
    primarykey
    data
    text
    <p>I am using Fluent NHibernate to map entities and am having a problem getting a repository to give a resultset. In the console, the SQL does not show but other repositories do. I have a feeling that it is because of the Mappings but can't tell why. The table name includes an underscore which is one of the only differences between this repo and others. My question is what could cause the sql not to be executed?</p> <p>Here is my setup.</p> <p>Entity:</p> <pre><code> public class Org { public virtual int ID { get; set; } public virtual string IndividualName { get; set; } public virtual string GroupName { get; set; } public virtual string AddressLine1 { get; set; } public virtual string AddressLine2 { get; set; } } </code></pre> <p>Mapping:</p> <pre><code>public class OrgMap : ClassMap&lt;Org&gt; { public OrgMap() { Table(@"Org_Updates"); // Also tried Table("Org_Updates"); Map(x =&gt; x.ID); Map(x =&gt; x.IndividualName); Map(x =&gt; x.GroupName); Map(x =&gt; x.AddressLine1, "PhysicalLocationAddress"); Map(x =&gt; x.AddressLine2, "PLAddr2"); </code></pre> <p>Repository:</p> <pre><code> public class OrgRepository : RepositoryBase&lt;Org&gt;, IOrgRepository { public IList&lt;Org&gt;GetTop50() { var query = All().AsList(); return query; } } </code></pre> <p>RepositoryBase:</p> <pre><code> public class OrgRepositoryBase&lt;T&gt; : RepositoryBase&lt;T&gt; where T : class { public OrgRepositoryBase() { var registry = ServiceLocator.Current.GetInstance&lt;EventListenerRegistry&gt;(); registry.RegisterListenerForType&lt;T&gt;(GetType(), EventType.Save); registry.RegisterListenerForType&lt;T&gt;(GetType(), EventType.Delete); } protected override ISession GetSession() { return UnitOfWork.Current.GetSessionFromContext&lt;ISession&gt;(typeof (OrgModel)); } protected override Type ModelType { get { return typeof (OrgModel); } } } } </code></pre> <p>As I said before, the other repositories that use other entites/mapping work. I can use this repository, exchanging the entity/mapping that it implements and it will work. I'm pretty sure it's because of hte mapping but can't tell which part. I have checked the table name and the column names. </p> <p>Thanks for the help</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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