DeepCloner
DeepCloner copied to clipboard
NHibernate Invalid cast exception
Hi there, first of all, thanks for the great library :)
We have our own implementation of deep cloning and wanted to test out this library to compare performance, but most of our tests fail when nhibernate tries to save object with error:
System.InvalidCastException : Unable to cast object of type 'NHibernate.Engine.Query.QueryExpressionPlan' to type 'System.Transactions.SafeIUnknown'. at System.Transactions.Transaction.JitSafeGetContextTransaction(ContextData contextData) at System.Transactions.Transaction.FastGetTransaction(TransactionScope currentScope, ContextData contextData, Transaction& contextTransaction) at System.Transactions.Transaction.get_Current() at NHibernate.Transaction.AdoNetWithSystemTransactionFactory.EnlistInSystemTransactionIfNeeded(ISessionImplementor session) at NHibernate.Impl.AbstractSessionImpl.CheckAndUpdateSessionStatus() at NHibernate.Impl.SessionImpl..ctor(SessionFactoryImpl factory, ISessionCreationOptions options) at NHibernate.Impl.SessionFactoryImpl.SessionBuilderImpl`1.OpenSession()
Our assumption is that DeepCloner tries to clone nhibernate proxy that is created on runtime, and that issues happen there. So I wanted to ask is this maybe a known issue, and is there a way to handle it?