-
Notifications
You must be signed in to change notification settings - Fork 934
version 5.3 failed to cast enum as nvarchar #2446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Version: 5.3.0 I agree. I have the same issues. I am using
The actual error:
((NHibernate.Linq.NhLinqExpression)queryExpression).Key:
(((NHibernate.Linq.NhLinqExpression)queryExpression)._expression).DebugView:
WorkflowState is a type of The actual query:
|
@Nazgaul can you share how your linq query looks like and what enum type (e.g. EnumStringType) are you using for mapping the |
this is my linq query NHibernate.Exceptions.GenericADOException : Failed to execute query batch[SQL: select distinct document0_.CourseName as col_0_0_ from sb.[Document] document0_ where document0_.UserId=? and document0_.[State]=?] the mapping is the EnumStringType inherit from EnumStringType support ignore case public override object? GetInstance(object code) |
@maca88 |
Thank you guys. Tested the branch |
All my enum are mapped as nvarchar and the string value is persist to the database.
All my linq queries now is failing
Conversion failed when converting the nvarchar value 'Flagged' to data type int.
The enum values are
public enum ItemState
{
Ok,
Deleted,
Pending,
Flagged
}
I revert back to 5.2.7 - and hopefully a fix will be soon.
Thanks
The full exception is:
NHibernate.Exceptions.GenericADOException : Failed to execute query batch[SQL: select document0_.Id as col_0_0_, document0_.Name as col_1_0_, document0_.CourseName as col_2_0_, cast(document0_.DocumentType as nvarchar(50)) as col_3_0_, document0_.VoteCount as col_4_0_, document0_.Price as col_5_0_, document0_.CreationTime as col_6_0_, document0_.Views as col_7_0_, document0_.Downloads as col_8_0_, document0_.Purchased as col_9_0_ from sb.[Document] document0_ where document0_.UserId=? and document0_.[State]=?]
---- System.Data.SqlClient.SqlException : Conversion failed when converting the nvarchar value 'Flagged' to data type int.
at NHibernate.Multi.QueryBatch.ExecuteBatchedAsync(CancellationToken cancellationToken)
at NHibernate.Multi.QueryBatch.ExecuteAsync(CancellationToken cancellationToken)
at NHibernate.Multi.QueryBatchExtensions.FutureList
1.GetValueAsync(CancellationToken cancellationToken) at NHibernate.Multi.QueryBatchExtensions.FutureEnumerable
1.GetEnumerableAsync(CancellationToken cancellationToken)at
The text was updated successfully, but these errors were encountered: