EntityFix 1.0.3

When you call stored procedure with select and output parameters and you don't select on some conditions (for example, you're just returning an error code) — you get a mapping EntityCommandExecutionException. This package fixes this annoying behavior of EF by returning empty data set and letting you read output parameters.

Consider you have this sql procedure:

   @Condition int = NULL,
   @ResultCode Int = NULL OUTPUT
   IF @Condition IS NULL BEGIN
       SET @ResultCode = 1;       -- return 1 if condition = null
   SELECT 1 as 'One', 2 as 'Two'; -- select otherwise
   SET @ResultCode = 0;

Calling this procedure in EF:

var resultCodeParameter = new ObjectParameter("ResultCode", typeof(int));
var result = db.Foo(null, resultCodeParameter).FirstOrDefault();
var resultCode = resultCodeParameter.Value;

will throw an exception:
System.Data.Entity.Core.EntityCommandExecutionException: The data reader is incompatible with the specified 'xxx.Foo_Result'. A member of the type, 'One', does not have a corresponding column in the data reader with the same name.

Calling EntityFix.Load() once on your application start will fix this bug.

Install-Package EntityFix -Version 1.0.3
dotnet add package EntityFix --version 1.0.3
<PackageReference Include="EntityFix" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EntityFix --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

No more reflection

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.3 3,699 4/19/2016
1.0.2 603 4/18/2016