You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are seeing an exception, include the full exceptions details (message and stack trace).
Microsoft.Data.SqlClient.SqlException
HResult=0x80131904
Message=Conversion failed when converting the nvarchar value 'Value1' to data type int.
Source=Core Microsoft SqlClient Data Provider
StackTrace:
at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)
at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at Microsoft.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
at Microsoft.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
at Microsoft.Data.SqlClient.SqlDataReader.Read()
at Z.EntityFramework.Plus.CreateEntityDataReader.Read()
at Microsoft.EntityFrameworkCore.Storage.RelationalDataReader.Read()
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.Enumerator.MoveNext() at Z.EntityFramework.Plus.QueryFutureValue1.SetResult(DbDataReader reader)
at Z.EntityFramework.Plus.QueryFutureBatch.ExecuteQueries()
at Z.EntityFramework.Plus.QueryFutureEnumerable1.GetEnumerator() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at EFPlusConversion.Program.Main(String[] args) in C:\Users\t11om\source\repos\EFPlusConversion\EFPlusConversion\Program.cs:line 55
This exception was originally thrown at this call stack:
[External Code]
EFPlusConversion.Program.Main(string[]) in Program.cs
Description
When using an enum which has the enum as string conversion turned on and making use of that in a future query then it fails with a conversion error.
//This works ok
builder.Property(e => e.ExampleEnumValue).HasConversion(new EnumToStringConverter());
dbContext.Examples.Where(x => x.ExampleEnumValue == ExampleEnum.Value1);
//This doesn't work
Exception
If you are seeing an exception, include the full exceptions details (message and stack trace).
Microsoft.Data.SqlClient.SqlException
HResult=0x80131904
Message=Conversion failed when converting the nvarchar value 'Value1' to data type int.
Source=Core Microsoft SqlClient Data Provider
StackTrace:
at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction) at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction)at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at Microsoft.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
at Microsoft.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
at Microsoft.Data.SqlClient.SqlDataReader.Read()
at Z.EntityFramework.Plus.CreateEntityDataReader.Read()
at Microsoft.EntityFrameworkCore.Storage.RelationalDataReader.Read()
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable
1.Enumerator.MoveNext() at Z.EntityFramework.Plus.QueryFutureValue
1.SetResult(DbDataReader reader)at Z.EntityFramework.Plus.QueryFutureBatch.ExecuteQueries()
at Z.EntityFramework.Plus.QueryFutureEnumerable
1.GetEnumerator() at System.Collections.Generic.List
1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)at EFPlusConversion.Program.Main(String[] args) in C:\Users\t11om\source\repos\EFPlusConversion\EFPlusConversion\Program.cs:line 55
This exception was originally thrown at this call stack:
[External Code]
EFPlusConversion.Program.Main(string[]) in Program.cs
Fiddle or Project
EFPlusConversion.zip
Note: If you are not able to provide code we can run and that reproduce the issue, we will not be able to fix it either.
Further technical details
The text was updated successfully, but these errors were encountered: