using log4net at the debug level? in some version of hibernate and log4net there is an incompatibility when turn on logging at the debug level. all you get is this error about 'unable to execute sql cannot cast boolean to string'. try turning up your logging level to info and the problem should go away.
ok, found the solution. nothing wrong with mapping etc., just with how the linq query is translated to sql. in particular, how this line is translated:
&& item.isactive == true
somehow, this gets translated into the complex case-statement which ultimately results in the exception message. however, the
== true-part isn't really necessary. by removing it, the translator no longer gets confused and provides the proper sql:
no more case-statement and no more exception.
- nHibernate unable to cast Boolean to String
- NHibernate List - Unable to cast object of type System.Collections.Hashtable
- List or Array of String Contain specific word in Html Source Code
- Unable to cast string type to number type in Linq expression
- C# - code to order by a property using the property name as a string
- Unable to cast object of type 'System.Linq.Expressions.UnaryExpression' to type 'System.Linq.Expressions.MemberExpression'
- How to do a case-insensitive string where in NHibernate Linq query?
- Cast string as Guid using LinqPad
- Unable to cast object of type WhereSelectListIterator 2 System.Collections.Generic.List
- Unable to cast object of type 'System.Data.Linq.DataQuery`1[System.Int32]' to type 'System.IConvertible'
- Why is a collection of <enum> unable to cast to an <int?>?
- Unable to cast object of type 'WhereEnumerableIterator`1' to type 'System.Collections.Generic.ICollection`1
- Unable to cast the type 'System.Nullable`1' to type 'System.Object' - ASP.NET MVC
- Unable to cast object of type 'System.Collections.Generic.List`1[System.Decimal]' to type 'System.IConvertible'
- Why can't I cast nullable DateTime as string in a LinQ query?
- Cast Dictionary KeyCollection to String array
- Unable to cast object of type 'System.Int32' to type 'System.String'
- Unable to cast a object of type 'SZArrayEnumerator' to type 'System.Collections.Generic.IEnumerator' 1[System.String]'
- .NET String parsing performance improvement - Possible Code Smell
- Unable to cast object of type WhereSelectListIterator
- Query a byte property with nhibernate cause invalid cast error
- Unable to cast object of type 'System.Linq.EnumerableQuery to type 'Microsoft.Azure.Documents.Linq.IDocumentQuery
- LINQ Source Code Available
- Dynamic LINQ - Unable to convert between GUID and string
- Efficient way to unindent lines of code stored in a string
- Linq Unable To Cast Issue
- NHibernate querying on a string collection using Linq results in either error or empty collection
- Unable to cast object of type System.Func`2 with Int64
- .NET 4 Code Contracts: "requires unproven: source != null"
- Unable to cast object of type 'System.Data.Entity.Infrastructure.DbQuery`1' using linq lambda expression
More Query from same tag
- 'int' does not contain a definition for 'Contains'
- Select rows on list of paired column values in NHibernate LINQ
- Adding results to a dictionary using xelement
- Recode Datatable Column with Linq
- LINQ passthrough provider?
- How to remove nested(child) items in List<> using Linq?
- select list of related grandchild entities
- Manually select related table data (SELECT N + 1 problem) LINQ to SQL
- LINQ methods executing sequence
- List.Contains doesn't work properly
- Creating a LINQ select from multiple tables
- Can I query a DocumentDB document with a bounding polygon, by a nearby polygon?
- Filtering in a Dictionary with arabic letters is not working
- Entity Framework 4.1 Modifying Object and Child Collection
- Dynamic Linq on Dapper dynamic collections - possible?
- Binding a flattern EF entity over GridView and allow sync with repositories
- Getting Keys and Values from IEnumerable<Dictionary<string, object>>
- Getting all children of a list as a collection (IList<T> collection passed)
- linq group by two columns and get only rows with same group by values
- Username/Password Database Checking
- EF Core: The LINQ expression could not be translated
- SubmitChanges not updating, but inserts new record. LINQ to SQL
- C# and displaying a row randomly for a sight word game
- Retrieve ID from database in mvc
- C# Dynamic LINQ: Select with Sum on dictionary indexer
- Can't use LINQ on CookieCollection despite the enumerator being accessible
- Handling Next Record nullable reference Controller Code to pass to viewbag
- Return a value or null using LINQ in one line?
- IQueryable<???> for linq-to-sql product type
- Ternary Operator Troubles with LINQ