From 36da89f1a3226576a9507d2f6a80b521320ccf52 Mon Sep 17 00:00:00 2001 From: Vincent He Date: Tue, 9 Aug 2016 13:12:44 +0800 Subject: [PATCH] Remove one more VS2015 feature usage --- .../Api/TrippinApi.cs | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.TrippinInMemory/Api/TrippinApi.cs b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.TrippinInMemory/Api/TrippinApi.cs index be25efeb..96610c11 100644 --- a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.TrippinInMemory/Api/TrippinApi.cs +++ b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.TrippinInMemory/Api/TrippinApi.cs @@ -48,7 +48,12 @@ public IQueryable People get { var datasource = _dataStoreManager.GetDataStoreInstance(Key); - return datasource?.People.AsQueryable(); + if (datasource != null) + { + return datasource.People.AsQueryable(); + } + + return null; } } @@ -57,7 +62,12 @@ public IQueryable NewComePeople get { var datasource = _dataStoreManager.GetDataStoreInstance(Key); - return datasource?.People.AsQueryable(); + if (datasource != null) + { + return datasource.People.AsQueryable(); + } + + return null; } } @@ -66,7 +76,12 @@ public Person Me get { var datasource = _dataStoreManager.GetDataStoreInstance(Key); - return datasource?.Me; + if (datasource != null) + { + return datasource.Me; + } + + return null; } } @@ -75,7 +90,12 @@ public IQueryable Airlines get { var datasource = _dataStoreManager.GetDataStoreInstance(Key); - return datasource?.Airlines.AsQueryable(); + if (datasource != null) + { + return datasource.Airlines.AsQueryable(); + } + + return null; } } @@ -84,7 +104,12 @@ public IQueryable Airports get { var datasource = _dataStoreManager.GetDataStoreInstance(Key); - return datasource?.Airports.AsQueryable(); + if (datasource != null) + { + return datasource.Airports.AsQueryable(); + } + + return null; } } @@ -349,7 +374,7 @@ public Task ExecuteSubmitAsync(SubmitContext context, Cancellation /// private class CustomerizedChangeSetInitializer : IChangeSetInitializer { - public async Task InitializeAsync(SubmitContext context, CancellationToken cancellationToken) + public Task InitializeAsync(SubmitContext context, CancellationToken cancellationToken) { var key = LibraryUtils.GetSessionId(); var dataSource = _dataStoreManager.GetDataStoreInstance(key); @@ -417,6 +442,8 @@ public async Task InitializeAsync(SubmitContext context, CancellationToken cance } } } + + return Task.WhenAll(); } private static void SetValues(object instance, Type type, IReadOnlyDictionary values)