Skip to content

version 5.3 failed to cast enum as nvarchar #2446

@Nazgaul

Description

@Nazgaul

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.FutureList1.GetValueAsync(CancellationToken cancellationToken) at NHibernate.Multi.QueryBatchExtensions.FutureEnumerable1.GetEnumerableAsync(CancellationToken cancellationToken)
at

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions