Hi,
I'm trying to filter a result set based on a datetime
We use TIME_STAMP eq 2019-05-29T19:15:34.51Z as example. Error is present when controller method try to serialize the response:
dotnet: info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:5000/odata/KPIs/KpiProyHs?$filter=TIME_STAMP%20eq%202019-05-29T19%3A15%3A34.51Z
dotnet: info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Route matched with {action = "GetKpiProyHs", controller = "KpiProyHs"}. Executing action KpIs.Controllers.KpIs.KpiProyHsController.GetKpiProyHs (server)
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
Executing action method KpIs.Controllers.KpIs.KpiProyHsController.GetKpiProyHs (server) - Validation state: Valid
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
Executed action method KpIs.Controllers.KpIs.KpiProyHsController.GetKpiProyHs (server), returned result Microsoft.AspNetCore.Mvc.ObjectResult in 0.009ms.
dotnet: info: Microsoft.EntityFrameworkCore.Infrastructure[10403]
Entity Framework Core 2.2.3-servicing-35854 initialized 'KpIsContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
info: Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor[1]
Executing ObjectResult, writing value of type 'Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1[[KpIs.Models.KpIs.KpiProyH, server, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]'.
dotnet: info: Microsoft.EntityFrameworkCore.Database.Command[20101]
Executed DbCommand (5ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
SELECT [$it].[EQUIP_NO], [$it].[COMP_CODE], [$it].[COMP_MOD], [$it].[MAINT_SCH_TASK], [$it].[TIME_STAMP], [$it].[TIME_STAMP_UPDATE], [$it].[KPI_NFD], [$it].[KPI_NSD]
FROM [dbo].[KPI_Proy_H] AS [$it]
WHERE [$it].[TIME_STAMP] = '2019-05-29T19:15:34.5100000'
fail: Microsoft.EntityFrameworkCore.Query[10100]
An exception occurred while iterating over the results of a query for context type 'KpIs.Data.KpIsContext'.
System.Data.SqlClient.SqlException (0x80131904): Error al convertir una cadena de caracteres en fecha y/u hora.
What is wrong?
Thanks