Skip to content

Commit

Permalink
Fixed issue with null equality incorrectly being set. Closes #30
Browse files Browse the repository at this point in the history
  • Loading branch information
robconery committed Jul 9, 2009
1 parent 08ee5c3 commit e670ec5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions SubSonic.Core/Linq/Structure/TSqlFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,22 @@ protected override Expression VisitBinary(BinaryExpression b)
}
break;
case ExpressionType.Equal:
if (right.NodeType == ExpressionType.Constant) {
ConstantExpression ce = (ConstantExpression)right;
if (ce.Value == null) {
this.Visit(left);
sb.Append(" IS NULL");
break;
}
} else if (left.NodeType == ExpressionType.Constant) {
ConstantExpression ce = (ConstantExpression)left;
if (ce.Value == null) {
this.Visit(right);
sb.Append(" IS NULL");
break;
}
}
goto case ExpressionType.LessThan;
case ExpressionType.NotEqual:
if (right.NodeType == ExpressionType.Constant)
{
Expand Down
2 changes: 1 addition & 1 deletion SubSonic.Tests/SubSonic.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="BugReports\LinqGeneratorBugs.cs" />
<Compile Include="DataProviders\ProviderFactoryTests.cs" />
<Compile Include="LINQ\BugReports.cs" />
<Compile Include="SimpleQuery\BatchTests.cs" />
Expand Down Expand Up @@ -111,7 +112,6 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="BugReports\" />
<Folder Include="Transactions\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Expand Down

0 comments on commit e670ec5

Please sign in to comment.