Error: System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Guid'. at Microsoft.Data.SqlClient.SqlBuffer.get_Guid() at Microsoft.Data.SqlClient.SqlDataReader.GetGuid(Int32 i) at lambda_method88(Closure, QueryContext, DbDataReader, ResultContext, SingleQueryResultCoordinator ) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable
1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable
1 source, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable1 source, CancellationToken cancellationToken) at AutoMapper.AspNet.OData.QueryableExtensions.GetAsync[TModel,TData](IQueryable
1 query, IMapper mapper, Expression1 filter, Expression
1 queryFunc, ICollection1 includeProperties, AsyncSettings asyncSettings) at AutoMapper.AspNet.OData.QueryableExtensions.GetAsync[TModel,TData](IQueryable
1 query, IMapper mapper, ODataQueryOptions1 options, QuerySettings querySettings) at AutoMapper.AspNet.OData.QueryableExtensions.GetAsync[TModel,TData](IQueryable
1 options, QuerySettings querySettings) at AutoMapper.AspNet.OData.QueryableExtensions.GetAsync[TModel,TData](IQueryable
1 query, IMapper mapper, ODataQueryOptions1 options, HandleNullPropagationOption handleNullPropagation) at TRKAPI.Controllers.RecordsController.GetTaskRecord(ODataQueryOptions
1 options) in
Line 80 is cited as cause
_context.TaskRecord.GetAsync(_mapper, options, HandleNullPropagationOption.Default);
This started happening after changing a column in the table from string to uniqueidentifier.
SELECT DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'TaskRecord'
AND COLUMN_NAME = 'TransactionId'
Returns:
DATA_TYPE uniqueidentifier
I'm not really sure where to look next, ideas?
Well I feel stupid. I had three environments, made the update in one db, but the appsettings was set to another.
Disregard. Sorry.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.