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
publicenumLevel{High,Medium,Low}publicclassModel{publicLevel[]AllowedModel{get;set;}}// in DB Context OnModelCreatingprotectedoverridevoidOnModelCreating(ModelBuildermodelBuilder){modelBuilder.HasPostgresEnum<Level>();
...}
Output:
Exception message: System.InvalidCastException Object cannot be stored in an array of this type.
Full Stack trace:
System.InvalidCastException: Object cannot be stored in an array of this type.
at System.Array.InternalSetValue(object value, IntPtr flattenedIndex)
at EFCoreSecondLevelCacheInterceptor.EFTableRowsDataReader.ProcessPostgresArrayOrList<T>(Type expectedValueType, IEnumerable enumerable) in D:\a\EFCoreSecondLevelCacheInterceptor\EFCoreSecondLevelCacheInterceptor\src\EFCoreSecondLevelCacheInterceptor\EFTableRowsDataReader.cs:line 613
at EFCoreSecondLevelCacheInterceptor.EFTableRowsDataReader.GetFieldValue<T>(int ordinal) in D:\a\EFCoreSecondLevelCacheInterceptor\EFCoreSecondLevelCacheInterceptor\src\EFCoreSecondLevelCacheInterceptor\EFTableRowsDataReader.cs:line 512
at lambda_method1676(Closure , QueryContext , DbDataReader , ResultContext , SingleQueryResultCoordinator )
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable<T>+AsyncEnumerator+<MoveNextAsync>d__20.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task, ConfigureAwaitOptions options)
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions+<ToListAsync>d__67<TSource>.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions+<ToListAsync>d__67<TSource>.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task, ConfigureAwaitOptions options)
The text was updated successfully, but these errors were encountered:
Summary of the issue
I recently added an enum model to a Postgres database as follows:
Environment
Example code/Steps to reproduce:
Output:
The text was updated successfully, but these errors were encountered: