npgsql / EntityFramework6.Npgsql

Entity Framework 6 provider for PostgreSQL
PostgreSQL License
66 stars 54 forks source link

Support for PostgreSQL functions when using Database First #150

Closed Duy-KMS closed 4 years ago

Duy-KMS commented 4 years ago

I have an error while calling a function that added to EDMX by using Database First, I also make a pull request for fixing this issue

Value does not fall within the expected range.


   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree, DbInterceptionContext interceptionContext, IDbDependencyResolver resolver, BridgeDataReaderFactory bridgeDataReaderFactory, ColumnMapFactory columnMapFactory)
   at System.Data.Entity.Core.EntityClient.EntityCommand.CreateCommandDefinition()
   at System.Data.Entity.Core.EntityClient.EntityCommand.TryGetEntityCommandDefinitionFromQueryCache(EntityCommandDefinition& entityCommandDefinition)
   at System.Data.Entity.Core.EntityClient.EntityCommand.GetCommandDefinition()
   at System.Data.Entity.Core.Objects.ObjectContext.CreateFunctionObjectResult[TElement](EntityCommand entityCommand, ReadOnlyCollection`1 entitySets, EdmType[] edmTypes, ExecutionOptions executionOptions)
   at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass161_0`1.<ExecuteFunction>b__1()
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
   at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass161_0`1.<ExecuteFunction>b__0()
   at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteFunction[TElement](String functionName, ExecutionOptions executionOptions, ObjectParameter[] parameters)
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteFunction[TElement](String functionName, MergeOption mergeOption, ObjectParameter[] parameters)
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteFunction[TElement](String functionName, ObjectParameter[] parameters)```
Duy-KMS commented 4 years ago

The Pull Request for this issue: https://github.com/npgsql/EntityFramework6.Npgsql/pull/151

trietphamnm commented 4 years ago

@roji This is a road blocking issue of using pg functions via EDMX mapping. The provided PR seems to be pretty simple. It would be great if you could spend a few minutes looking at it. Thanks for your great contribution. Really appreciate that!

roji commented 4 years ago

The PR looks OK to me, if @Emill can approve it I can merge and release.

Emill commented 4 years ago

Looks fine!

trietphamnm commented 4 years ago

Thanks for this awesome tool, @roji @Emill