Skip to content

Instantly share code, notes, and snippets.

@pofider
Created March 22, 2015 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pofider/6af82ca9a91634293115 to your computer and use it in GitHub Desktop.
Save pofider/6af82ca9a91634293115 to your computer and use it in GitHub Desktop.
Flushing with enabled filter causes sometimes exceptions in NHibernate when updating collections.
public class UnfilteredFlushListener : DefaultFlushEventListener
{
protected override void PerformExecutions(IEventSource session)
{
var filter = session.GetEnabledFilter("multitenancy");
session.DisableFilter("multitenancy");
base.PerformExecutions(session);
if (filter != null)
session.EnabledFilters.Add("multitenancy", filter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment