ralmsdeveloper / EntityFrameworkCore.FirebirdSQL

FirebirdSQL database provider for Entity Framework Core.
Other
44 stars 26 forks source link

Incorrect SQL generated when 2 or more columns are returned on update #41

Closed gpanayotov closed 6 years ago

gpanayotov commented 6 years ago

If I have 2 or more DB generated fields (for example mapped with .ValueGeneratedOnAddOrUpdate() ) then the the SQL is generated wrongly - It is ... RETURNING COLUMN1 INTO :COLUMN1, COLUMN2 INTO :COLUMN2 ...

but should be: RETURNING COLUMN1, COLUMN2 INTO :COLUMN1, :COLUMN2

I've tried to fix it - it is in the commit https://github.com/gpanayotov/EntityFrameworkCore.FirebirdSQL/commit/913c9fdbe841a3a62bf6e18bb1f2631a50fb7741

ralmsdeveloper commented 6 years ago

@gpanayotov Thanks for helping to identify the problem, corrected with: https://github.com/ralmsdeveloper/EntityFrameworkCore.FirebirdSQL/commit/bab6f69605f2d0f34d43cf47cb6474334ad67560

Updated Nuget Package: 2.1.2.1

mrjohnr commented 6 years ago

hi.after upgrade from 2.1.1 to 2.1.2.1 my app doesn't start,got in console: internal server error,if I start app with in debug mode it works.reverting to 2.1.1 all works fine is a bung in my app,or in that new version? thanks

ralmsdeveloper commented 6 years ago

Can you show the exception you receive? I could not simulate, it could be some Nuget cache problem.

ralmsdeveloper commented 6 years ago

Maybe it's the lack of dependency System.Interactive.Async, I removed it, and sent a new package. If the problem persists please put here the exception you receive. @mrjohnr Thanks!

mrjohnr commented 6 years ago

hi. I've tested with the new version,the same problem,error is:

fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
      An unhandled exception has occurred while executing the request.
System.NullReferenceException: Object reference not set to an instance of an object.
   at EntityFrameworkCore.FirebirdSql.Query.Sql.Internal.FbQuerySqlGenerator..ctor(QuerySqlGeneratorDependencies dependencies, SelectExpression selectExpression, IFbOptions fBOptions)
   at EntityFrameworkCore.FirebirdSql.Query.Sql.Internal.FbQuerySqlGeneratorFactory.CreateDefault(SelectExpression selectExpression)
   at Microsoft.EntityFrameworkCore.Query.Expressions.SelectExpression.CreateDefaultQuerySqlGenerator()
   at Microsoft.EntityFrameworkCore.Query.Internal.ShaperCommandContext.<NotifyReaderCreated>b__14_0(FactoryAndReader s)
   at Microsoft.EntityFrameworkCore.Internal.NonCapturingLazyInitializer.EnsureInitialized[TParam,TValue](TValue& target, TParam param, Func`2 valueFactory)
   at Microsoft.EntityFrameworkCore.Query.Internal.ShaperCommandContext.NotifyReaderCreated(DbDataReader dataReader)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.BufferlessMoveNext(DbContext _, Boolean buffer, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncQueryingEnumerable`1.AsyncEnumerator.MoveNext(CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext(CancellationToken cancellationToken)
   at System.Linq.AsyncEnumerable.Aggregate_[TSource,TAccumulate,TResult](IAsyncEnumerable`1 source, TAccumulate seed, Func`3 accumulator, Func`2 resultSelector, CancellationToken cancellationToken)
   at Rez.Controllers.api.ParamController.GetParametri() in d:\data_serv\rez\Controllers\ParamController.cs:line 40
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   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.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

I use FB 2.5 thanks

ralmsdeveloper commented 6 years ago

@mrjohnr

You could upload a small repro here, so I can try to reproduce the problem better and identify the root of the problem.

ralmsdeveloper commented 6 years ago

Closing here, tracking for #42