Is there a way to set an SQL comment from an IQueryable?

382 Views Asked by At

ICriteria has SetComment(), but I see nothing comparable for IQueryable.

1

There are 1 best solutions below

1
hazzik On BEST ANSWER

In NHibernate 5+ there is WithOptions extension method that allows to set some query specific options like timeouts, cache options, and comments.

var query = (
    from e in session.Query<YourEntity>()
    select e
).WithOptions(o => o.SetComment("Your comment"));

You might need to import NHibernate.Linq namespace.