我正在将MARTEN ORM用于我的ASP.NET Core应用程序。我想运行原始查询,其中包括LEFT OUTER JOIN。下面是我要执行的查询。
string query = @"SELECT * FROM table1 AS t1
LEFT OUTER JOIN table2 AS t2
ON t1.data->>'AId' = (t2.id::text)
WHERE t1.id = '429ee811-028e-44f6-bbdc-38f11654bc3d'";
return session.Query<TABLE>(query).FirstOrDefault();
我遇到了错误。
System.InvalidCastException: GetTextReader() not supported for type uuid
at Npgsql.NpgsqlDataReader.GetTextReader(Int32 ordinal)
at Marten.Linq.DeserializeSelector
1.Resolve(DbDataReader阅读器,IIdentityMap映射,QueryStatistics统计信息)
在Marten.Linq.SelectorExtensions.Read [T](ISelector 1 selector, DbDataReader reader, IIdentityMap map, QueryStatistics stats)
at Marten.Services.CommandRunnerExtensions.<>c__DisplayClass2_0
1.b__0(NpgsqlCommand c)
在Marten.Services.ManagedConnection.Execute [T](NpgsqlCommand cmd,Func 2 func)
at MondoUbiSiteConfiguration.Api.Controllers.OrganizationController.Get(Guid id) in /home/lavanya/Documents/latest/MU#.cs:line 49
at lambda_method(Closure , Object , Object[] )
at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)