File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed
shared/Z.EF.Plus.QueryFuture.Shared
test/Z.Test.EntityFramework.Plus.EF6 Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,11 @@ internal void GetResultDirectly(IQueryable<TResult> query)
146146 /// <returns>The result of forcing this lazy value.</returns>
147147 public static implicit operator TResult ( QueryFutureValue < TResult > futureValue )
148148 {
149+ if ( futureValue == null )
150+ {
151+ return default ( TResult ) ;
152+ }
153+
149154 return futureValue . Value ;
150155 }
151156 }
Original file line number Diff line number Diff line change 1+ using Microsoft . VisualStudio . TestTools . UnitTesting ;
2+ using Z . EntityFramework . Plus ;
3+
4+ namespace Z . Test . EntityFramework . Plus
5+ {
6+ public partial class QueryFuture_FutureValue
7+ {
8+ [ TestMethod ]
9+ public void Try_Cast_Null_FutureValue_To_Certain_Type_Should_Return_Null ( )
10+ {
11+ QueryFutureValue < string > futureValue = null ;
12+ string tmp = futureValue ;
13+
14+ Assert . IsNull ( tmp ) ;
15+ }
16+ }
17+ }
Original file line number Diff line number Diff line change 327327 <Compile Include =" QueryFilter\DbContext_Filter\WithParameter\SingleFilter_SingleParameter.cs" />
328328 <Compile Include =" QueryFilter\DbContext_Filter\WithParameter\SingleFilter_ManyParameter.cs" />
329329 <Compile Include =" QueryFilter\DbContext_Filter\WithParameter\SingleFilter_NoParameter.cs" />
330+ <Compile Include =" QueryFuture\FutureValue\ImplicitCastTest.cs" />
330331 <Compile Include =" QueryIncludeOptimized\ByPath\Many_Many_Many_Many.cs" />
331332 <Compile Include =" QueryIncludeOptimized\ByPath\Many_Many_Many_Single.cs" />
332333 <Compile Include =" QueryIncludeOptimized\ByPath\Many_Many_Single_Many.cs" />
You can’t perform that action at this time.
0 commit comments