EntityFix 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package EntityFix --version 1.0.2                
NuGet\Install-Package EntityFix -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EntityFix" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EntityFix --version 1.0.2                
#r "nuget: EntityFix, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EntityFix as a Cake Addin
#addin nuget:?package=EntityFix&version=1.0.2

// Install EntityFix as a Cake Tool
#tool nuget:?package=EntityFix&version=1.0.2                

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.

Example:
Consider you have this sql procedure:

CREATE PROCEDURE [dbo].[Foo]
   @Condition int = NULL,
   @ResultCode Int = NULL OUTPUT
AS
BEGIN
   IF @Condition IS NULL BEGIN
       SET @ResultCode = 1;       -- return 1 if condition = null
       RETURN;
   END
   SELECT 1 as 'One', 2 as 'Two'; -- select otherwise
   SET @ResultCode = 0;
END

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.

Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 5,973 4/19/2016
1.0.2 2,193 4/18/2016

First release