From 22b7f503bcc9542844a38aebca7f650a465b9622 Mon Sep 17 00:00:00 2001 From: Vincent He Date: Tue, 16 Aug 2016 11:11:41 +0800 Subject: [PATCH] Make namespace and class name change for new package --- .nuget/NuGet.Config | 2 +- .../Microsoft.Restier.Core.nuspec | 2 +- .../Model/EdmHelpers.cs | 1 - .../Query/QueryExpressionContext.cs | 1 - .../EntityFrameworkApi.cs | 2 +- .../Submit/ChangeSetInitializer.cs | 2 +- .../Extensions.cs | 11 ++++----- .../RestierExceptionFilterAttribute.cs | 2 +- .../RestierEnumDeserializer.cs | 2 +- .../RestierCollectionSerializer.cs | 2 +- .../Serialization/RestierEnumSerializer.cs | 10 +++++++- .../Serialization/RestierRawSerializer.cs | 2 +- ...zer.cs => RestierResourceSetSerializer.cs} | 12 +++++----- .../Microsoft.Restier.Publishers.OData.nuspec | 6 ++--- .../Model/EdmHelpers.cs | 1 - .../Model/ModelMapper.cs | 1 - .../Model/RestierModelBuilder.cs | 1 - .../Model/RestierModelExtender.cs | 1 - .../RestierPayloadValueConverter.cs | 3 +-- .../ServiceCollectionExtensions.cs | 5 ++-- .../Microsoft.Restier.Core.Tests/Api.Tests.cs | 3 +-- .../ApiBase.Tests.cs | 2 +- .../ApiConfiguration.Tests.cs | 4 ++-- .../InvocationContext.Tests.cs | 2 +- .../Model/DefaultModelHandler.Tests.cs | 7 +++--- .../PropertyBag.Tests.cs | 2 +- .../ServiceConfiguration.Tests.cs | 18 +++++++------- .../Models/Library/LibraryApi.cs | 2 +- .../Models/Library/LibraryContext.cs | 2 +- .../Models/Library/Universe.cs | 2 +- .../ExceptionHandlerTests.cs | 2 +- .../FallbackTests.cs | 4 ++-- .../Model/LibraryApi.cs | 2 +- .../Model/LibraryContext.cs | 2 +- .../Model/RestierModelExtender.Tests.cs | 9 ++++--- .../Model/Universe.cs | 2 +- .../StoreApi.cs | 3 +-- .../SaveTests.cs | 2 +- .../Models/NorthwindApi.cs | 3 +-- .../Api/TrippinApi.cs | 24 ++++++++----------- .../Controllers/PeopleController.cs | 2 +- .../PathAndSlashEscapeODataPathHandler.cs | 7 +++--- .../Api/TrippinApi.cs | 2 +- 43 files changed, 84 insertions(+), 93 deletions(-) rename src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/{RestierFeedSerializer.cs => RestierResourceSetSerializer.cs} (89%) diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config index e94e0e4a..16fa1f44 100644 --- a/.nuget/NuGet.Config +++ b/.nuget/NuGet.Config @@ -6,6 +6,6 @@ - + \ No newline at end of file diff --git a/src/Microsoft.Restier.Core/Microsoft.Restier.Core.nuspec b/src/Microsoft.Restier.Core/Microsoft.Restier.Core.nuspec index 60f6e49a..0d099154 100644 --- a/src/Microsoft.Restier.Core/Microsoft.Restier.Core.nuspec +++ b/src/Microsoft.Restier.Core/Microsoft.Restier.Core.nuspec @@ -15,7 +15,7 @@ - + diff --git a/src/Microsoft.Restier.Core/Model/EdmHelpers.cs b/src/Microsoft.Restier.Core/Model/EdmHelpers.cs index c1dbf443..621a8fb3 100644 --- a/src/Microsoft.Restier.Core/Model/EdmHelpers.cs +++ b/src/Microsoft.Restier.Core/Model/EdmHelpers.cs @@ -4,7 +4,6 @@ using System; using System.Globalization; using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Library; namespace Microsoft.Restier.Core.Model { diff --git a/src/Microsoft.Restier.Core/Query/QueryExpressionContext.cs b/src/Microsoft.Restier.Core/Query/QueryExpressionContext.cs index c469d324..ebac562f 100644 --- a/src/Microsoft.Restier.Core/Query/QueryExpressionContext.cs +++ b/src/Microsoft.Restier.Core/Query/QueryExpressionContext.cs @@ -8,7 +8,6 @@ using System.Reflection; using System.Runtime.CompilerServices; using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Library; using Microsoft.Restier.Core.Model; namespace Microsoft.Restier.Core.Query diff --git a/src/Microsoft.Restier.Providers.EntityFramework/EntityFrameworkApi.cs b/src/Microsoft.Restier.Providers.EntityFramework/EntityFrameworkApi.cs index a7cd99f8..b8a3ff2e 100644 --- a/src/Microsoft.Restier.Providers.EntityFramework/EntityFrameworkApi.cs +++ b/src/Microsoft.Restier.Providers.EntityFramework/EntityFrameworkApi.cs @@ -52,7 +52,7 @@ protected T DbContext /// The . /// [CLSCompliant(false)] - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { Type apiType = this.GetType(); diff --git a/src/Microsoft.Restier.Providers.EntityFramework/Submit/ChangeSetInitializer.cs b/src/Microsoft.Restier.Providers.EntityFramework/Submit/ChangeSetInitializer.cs index 61585a40..2ea54022 100644 --- a/src/Microsoft.Restier.Providers.EntityFramework/Submit/ChangeSetInitializer.cs +++ b/src/Microsoft.Restier.Providers.EntityFramework/Submit/ChangeSetInitializer.cs @@ -12,7 +12,7 @@ using System.Reflection; using System.Threading; using System.Threading.Tasks; -using Microsoft.OData.Edm.Library; +using Microsoft.OData.Edm; using Microsoft.Restier.Core; using Microsoft.Restier.Core.Query; using Microsoft.Restier.Core.Submit; diff --git a/src/Microsoft.Restier.Publishers.OData/Extensions.cs b/src/Microsoft.Restier.Publishers.OData/Extensions.cs index 39fc409e..c1b3a8c4 100644 --- a/src/Microsoft.Restier.Publishers.OData/Extensions.cs +++ b/src/Microsoft.Restier.Publishers.OData/Extensions.cs @@ -11,10 +11,7 @@ using System.Web.OData; using System.Web.OData.Formatter; using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Annotations; -using Microsoft.OData.Edm.Library; -using Microsoft.OData.Edm.Library.Annotations; -using Microsoft.OData.Edm.Library.Values; +using Microsoft.OData.Edm.Vocabularies; using Microsoft.OData.Edm.Vocabularies.V1; using Microsoft.Restier.Core; using Microsoft.Restier.Publishers.OData.Model; @@ -59,9 +56,9 @@ public static bool IsConcurrencyCheckEnabled(this IEdmModel model, IEdmEntitySet } needCurrencyCheck = false; - var annotations = model.FindVocabularyAnnotations( + var annotations = model.FindVocabularyAnnotations( entitySet, CoreVocabularyModel.ConcurrencyTerm); - IEdmValueAnnotation annotation = annotations.FirstOrDefault(); + var annotation = annotations.FirstOrDefault(); if (annotation != null) { needCurrencyCheck = true; @@ -122,7 +119,7 @@ public static IDictionary RetrievePropertiesAttribut var attributes = PropertyAttributes.None; foreach (var annotation in annotations) { - var valueAnnotation = annotation as EdmAnnotation; + var valueAnnotation = annotation as EdmVocabularyAnnotation; if (valueAnnotation == null) { continue; diff --git a/src/Microsoft.Restier.Publishers.OData/Filters/RestierExceptionFilterAttribute.cs b/src/Microsoft.Restier.Publishers.OData/Filters/RestierExceptionFilterAttribute.cs index ec0321bd..28daf2d3 100644 --- a/src/Microsoft.Restier.Publishers.OData/Filters/RestierExceptionFilterAttribute.cs +++ b/src/Microsoft.Restier.Publishers.OData/Filters/RestierExceptionFilterAttribute.cs @@ -14,7 +14,7 @@ using System.Web.Http; using System.Web.Http.Filters; using System.Web.Http.Results; -using Microsoft.OData.Core; +using Microsoft.OData; using Microsoft.Restier.Core; using Microsoft.Restier.Core.Submit; using Net::System.Net.Http.Formatting; diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/RestierEnumDeserializer.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/RestierEnumDeserializer.cs index 552a747f..b5786406 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/RestierEnumDeserializer.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Deserialization/RestierEnumDeserializer.cs @@ -4,7 +4,7 @@ using System; using System.Web.OData; using System.Web.OData.Formatter.Deserialization; -using Microsoft.OData.Core; +using Microsoft.OData; using Microsoft.OData.Edm; namespace Microsoft.Restier.Publishers.OData.Formatter diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierCollectionSerializer.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierCollectionSerializer.cs index 8dc745bf..97d6fa5c 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierCollectionSerializer.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierCollectionSerializer.cs @@ -3,7 +3,7 @@ using System; using System.Web.OData.Formatter.Serialization; -using Microsoft.OData.Core; +using Microsoft.OData; namespace Microsoft.Restier.Publishers.OData.Formatter { diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierEnumSerializer.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierEnumSerializer.cs index 9b28db98..b43f996e 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierEnumSerializer.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierEnumSerializer.cs @@ -3,7 +3,7 @@ using System; using System.Web.OData.Formatter.Serialization; -using Microsoft.OData.Core; +using Microsoft.OData; namespace Microsoft.Restier.Publishers.OData.Formatter { @@ -12,6 +12,14 @@ namespace Microsoft.Restier.Publishers.OData.Formatter /// public class RestierEnumSerializer : ODataEnumSerializer { + /// + /// Initializes a new instance of the class. + /// + /// The serializer provider. + public RestierEnumSerializer(ODataSerializerProvider provider) : base(provider) + { + } + /// /// Writes the enum result to the response message. /// diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierRawSerializer.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierRawSerializer.cs index 63a0a325..ccdb0ebc 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierRawSerializer.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierRawSerializer.cs @@ -3,7 +3,7 @@ using System; using System.Web.OData.Formatter.Serialization; -using Microsoft.OData.Core; +using Microsoft.OData; namespace Microsoft.Restier.Publishers.OData.Formatter { diff --git a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierFeedSerializer.cs b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierResourceSetSerializer.cs similarity index 89% rename from src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierFeedSerializer.cs rename to src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierResourceSetSerializer.cs index 4bf01f4e..37ac1376 100644 --- a/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierFeedSerializer.cs +++ b/src/Microsoft.Restier.Publishers.OData/Formatter/Serialization/RestierResourceSetSerializer.cs @@ -5,21 +5,21 @@ using System.Collections.Generic; using System.Web.OData.Formatter.Serialization; using System.Web.OData.Query.Expressions; -using Microsoft.OData.Core; +using Microsoft.OData; using Microsoft.OData.Edm; namespace Microsoft.Restier.Publishers.OData.Formatter { /// - /// The serializer for entity collection result. + /// The serializer for resource set result. /// - public class RestierFeedSerializer : ODataFeedSerializer + public class RestierResourceSetSerializer : ODataResourceSetSerializer { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The serializer provider. - public RestierFeedSerializer(ODataSerializerProvider provider) + public RestierResourceSetSerializer(ODataSerializerProvider provider) : base(provider) { } @@ -65,7 +65,7 @@ private bool TryWriteAggregationResult( { IEdmEntitySetBase entitySet = writeContext.NavigationSource as IEdmEntitySetBase; IEdmEntityTypeReference entityType = elementType.AsEntity(); - ODataWriter writer = messageWriter.CreateODataFeedWriter(entitySet, entityType.EntityDefinition()); + ODataWriter writer = messageWriter.CreateODataResourceSetWriter(entitySet, entityType.EntityDefinition()); WriteObjectInline(graph, feedType, writer, writeContext); return true; } diff --git a/src/Microsoft.Restier.Publishers.OData/Microsoft.Restier.Publishers.OData.nuspec b/src/Microsoft.Restier.Publishers.OData/Microsoft.Restier.Publishers.OData.nuspec index 5a81a225..6edfc733 100644 --- a/src/Microsoft.Restier.Publishers.OData/Microsoft.Restier.Publishers.OData.nuspec +++ b/src/Microsoft.Restier.Publishers.OData/Microsoft.Restier.Publishers.OData.nuspec @@ -14,9 +14,9 @@ - - - + + + diff --git a/src/Microsoft.Restier.Publishers.OData/Model/EdmHelpers.cs b/src/Microsoft.Restier.Publishers.OData/Model/EdmHelpers.cs index 45d82483..6810a33c 100644 --- a/src/Microsoft.Restier.Publishers.OData/Model/EdmHelpers.cs +++ b/src/Microsoft.Restier.Publishers.OData/Model/EdmHelpers.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.Linq; using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Library; namespace Microsoft.Restier.Publishers.OData.Model { diff --git a/src/Microsoft.Restier.Publishers.OData/Model/ModelMapper.cs b/src/Microsoft.Restier.Publishers.OData/Model/ModelMapper.cs index d46753f2..e141b2f5 100644 --- a/src/Microsoft.Restier.Publishers.OData/Model/ModelMapper.cs +++ b/src/Microsoft.Restier.Publishers.OData/Model/ModelMapper.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Web.OData; using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Library; using Microsoft.Restier.Core; using Microsoft.Restier.Core.Model; diff --git a/src/Microsoft.Restier.Publishers.OData/Model/RestierModelBuilder.cs b/src/Microsoft.Restier.Publishers.OData/Model/RestierModelBuilder.cs index df18bdba..15fbdb2e 100644 --- a/src/Microsoft.Restier.Publishers.OData/Model/RestierModelBuilder.cs +++ b/src/Microsoft.Restier.Publishers.OData/Model/RestierModelBuilder.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using System.Web.OData.Builder; using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Library; using Microsoft.Restier.Core.Model; namespace Microsoft.Restier.Publishers.OData.Model diff --git a/src/Microsoft.Restier.Publishers.OData/Model/RestierModelExtender.cs b/src/Microsoft.Restier.Publishers.OData/Model/RestierModelExtender.cs index b8d9737c..58ea66c1 100644 --- a/src/Microsoft.Restier.Publishers.OData/Model/RestierModelExtender.cs +++ b/src/Microsoft.Restier.Publishers.OData/Model/RestierModelExtender.cs @@ -10,7 +10,6 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Library; using Microsoft.Restier.Core; using Microsoft.Restier.Core.Model; using Microsoft.Restier.Core.Query; diff --git a/src/Microsoft.Restier.Publishers.OData/RestierPayloadValueConverter.cs b/src/Microsoft.Restier.Publishers.OData/RestierPayloadValueConverter.cs index 2fac72a1..31e3377a 100644 --- a/src/Microsoft.Restier.Publishers.OData/RestierPayloadValueConverter.cs +++ b/src/Microsoft.Restier.Publishers.OData/RestierPayloadValueConverter.cs @@ -2,9 +2,8 @@ // Licensed under the MIT License. See License.txt in the project root for license information. using System; -using Microsoft.OData.Core; +using Microsoft.OData; using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Library; namespace Microsoft.Restier.Publishers.OData { diff --git a/src/Microsoft.Restier.Publishers.OData/ServiceCollectionExtensions.cs b/src/Microsoft.Restier.Publishers.OData/ServiceCollectionExtensions.cs index 733d2670..802694a1 100644 --- a/src/Microsoft.Restier.Publishers.OData/ServiceCollectionExtensions.cs +++ b/src/Microsoft.Restier.Publishers.OData/ServiceCollectionExtensions.cs @@ -54,8 +54,9 @@ public static IServiceCollection AddODataServices(this IServiceCollection ser services.TryAddSingleton(); // Make serializer and deserializer provider as DI services - services.TryAddSingleton(); - services.TryAddSingleton(); + // WebApi OData service provider will be added first, need to overwrite. + services.AddSingleton(); + services.AddSingleton(); services.TryAddSingleton(); diff --git a/test/Microsoft.Restier.Core.Tests/Api.Tests.cs b/test/Microsoft.Restier.Core.Tests/Api.Tests.cs index 262a79d5..162509d6 100644 --- a/test/Microsoft.Restier.Core.Tests/Api.Tests.cs +++ b/test/Microsoft.Restier.Core.Tests/Api.Tests.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Library; using Microsoft.Restier.Core.Model; using Microsoft.Restier.Core.Query; using Microsoft.Restier.Core.Submit; @@ -80,7 +79,7 @@ public Task ExecuteSubmitAsync(SubmitContext context, Cancellation private class TestApi : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { var modelBuilder = new TestModelBuilder(); var modelMapper = new TestModelMapper(); diff --git a/test/Microsoft.Restier.Core.Tests/ApiBase.Tests.cs b/test/Microsoft.Restier.Core.Tests/ApiBase.Tests.cs index 71d449ed..e8ec554d 100644 --- a/test/Microsoft.Restier.Core.Tests/ApiBase.Tests.cs +++ b/test/Microsoft.Restier.Core.Tests/ApiBase.Tests.cs @@ -11,7 +11,7 @@ public class ApiBaseTests { private class TestApi : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { return base.ConfigureApi(services) .MakeScoped() diff --git a/test/Microsoft.Restier.Core.Tests/ApiConfiguration.Tests.cs b/test/Microsoft.Restier.Core.Tests/ApiConfiguration.Tests.cs index c6b58fdd..04a91f72 100644 --- a/test/Microsoft.Restier.Core.Tests/ApiConfiguration.Tests.cs +++ b/test/Microsoft.Restier.Core.Tests/ApiConfiguration.Tests.cs @@ -91,7 +91,7 @@ public ServiceB serviceB } } - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.AddService((sp, next) => serviceA); services.AddService((sp, next) => serviceB); @@ -103,7 +103,7 @@ protected override IServiceCollection ConfigureApi(IServiceCollection services) } private class TestApiC : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { var q1 = new ServiceB("q1Pre", "q1Post"); var q2 = new ServiceB("q2Pre", "q2Post"); diff --git a/test/Microsoft.Restier.Core.Tests/InvocationContext.Tests.cs b/test/Microsoft.Restier.Core.Tests/InvocationContext.Tests.cs index 7a7733b7..7bab064e 100644 --- a/test/Microsoft.Restier.Core.Tests/InvocationContext.Tests.cs +++ b/test/Microsoft.Restier.Core.Tests/InvocationContext.Tests.cs @@ -23,7 +23,7 @@ public ApiServiceA ApiService return _service; } } - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.AddService((sp, next) => ApiService); diff --git a/test/Microsoft.Restier.Core.Tests/Model/DefaultModelHandler.Tests.cs b/test/Microsoft.Restier.Core.Tests/Model/DefaultModelHandler.Tests.cs index 11d6cf99..7c0a75a9 100644 --- a/test/Microsoft.Restier.Core.Tests/Model/DefaultModelHandler.Tests.cs +++ b/test/Microsoft.Restier.Core.Tests/Model/DefaultModelHandler.Tests.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Library; using Microsoft.Restier.Core.Model; using Xunit; @@ -17,7 +16,7 @@ public class DefaultModelHandlerTests { private class TestApiA : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.AddService((sp, next) => new TestModelProducer()); services.AddService((sp, next) => new TestModelExtender(2) @@ -34,7 +33,7 @@ protected override IServiceCollection ConfigureApi(IServiceCollection services) private class TestApiB : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { var service = new TestSingleCallModelBuilder(); services.AddService((sp, next) => service); @@ -44,7 +43,7 @@ protected override IServiceCollection ConfigureApi(IServiceCollection services) private class TestApiC : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { var service = new TestRetryModelBuilder(); services.AddService((sp, next) => service); diff --git a/test/Microsoft.Restier.Core.Tests/PropertyBag.Tests.cs b/test/Microsoft.Restier.Core.Tests/PropertyBag.Tests.cs index 857702a2..2475b7cd 100644 --- a/test/Microsoft.Restier.Core.Tests/PropertyBag.Tests.cs +++ b/test/Microsoft.Restier.Core.Tests/PropertyBag.Tests.cs @@ -88,7 +88,7 @@ public void Dispose() private class TestApi : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { return base.ConfigureApi(services).AddScoped(); } diff --git a/test/Microsoft.Restier.Core.Tests/ServiceConfiguration.Tests.cs b/test/Microsoft.Restier.Core.Tests/ServiceConfiguration.Tests.cs index 051142c1..f9926801 100644 --- a/test/Microsoft.Restier.Core.Tests/ServiceConfiguration.Tests.cs +++ b/test/Microsoft.Restier.Core.Tests/ServiceConfiguration.Tests.cs @@ -11,7 +11,7 @@ public class ServiceConfigurationTests { private class TestApiA : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { var i = 0; services.AddService((sp, next) => new SomeService @@ -42,7 +42,7 @@ protected override IServiceCollection ConfigureApi(IServiceCollection services) private class TestApiB : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.AddService((sp, next) => new SomeService { @@ -58,7 +58,7 @@ protected override IServiceCollection ConfigureApi(IServiceCollection services) private class TestApiC : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.MakeScoped() .AddService((sp, next) => new SomeService()); @@ -68,7 +68,7 @@ protected override IServiceCollection ConfigureApi(IServiceCollection services) private class TestApiD : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.AddService((sp, next) => new SomeService { @@ -83,7 +83,7 @@ protected override IServiceCollection ConfigureApi(IServiceCollection services) private class TestApiE : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { var first = new SomeService { @@ -100,7 +100,7 @@ protected override IServiceCollection ConfigureApi(IServiceCollection services) private class TestApiF : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.AddService((sp, next) => new SomeService { @@ -115,7 +115,7 @@ protected override IServiceCollection ConfigureApi(IServiceCollection services) private class TestApiG : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.AddService((sp, next) => new SomeService { @@ -136,7 +136,7 @@ protected override IServiceCollection ConfigureApi(IServiceCollection services) private class TestApiH : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.AddService((sp, next) => new SomeService { @@ -153,7 +153,7 @@ protected override IServiceCollection ConfigureApi(IServiceCollection services) private class TestApiI : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.MakeTransient() .AddService((sp, next) => new SomeService diff --git a/test/Microsoft.Restier.Providers.EntityFramework.Tests/Models/Library/LibraryApi.cs b/test/Microsoft.Restier.Providers.EntityFramework.Tests/Models/Library/LibraryApi.cs index 329c780a..5dc766b9 100644 --- a/test/Microsoft.Restier.Providers.EntityFramework.Tests/Models/Library/LibraryApi.cs +++ b/test/Microsoft.Restier.Providers.EntityFramework.Tests/Models/Library/LibraryApi.cs @@ -14,7 +14,7 @@ namespace Microsoft.Restier.Providers.EntityFramework.Tests.Models.Library class LibraryApi : EntityFrameworkApi { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { base.ConfigureApi(services); services.AddService(); diff --git a/test/Microsoft.Restier.Providers.EntityFramework.Tests/Models/Library/LibraryContext.cs b/test/Microsoft.Restier.Providers.EntityFramework.Tests/Models/Library/LibraryContext.cs index 608c0a79..0afb5fff 100644 --- a/test/Microsoft.Restier.Providers.EntityFramework.Tests/Models/Library/LibraryContext.cs +++ b/test/Microsoft.Restier.Providers.EntityFramework.Tests/Models/Library/LibraryContext.cs @@ -3,7 +3,7 @@ using System; using System.Data.Entity; -using Microsoft.OData.Edm.Library; +using Microsoft.OData.Edm; namespace Microsoft.Restier.Providers.EntityFramework.Tests.Models.Library { diff --git a/test/Microsoft.Restier.Providers.EntityFramework.Tests/Models/Library/Universe.cs b/test/Microsoft.Restier.Providers.EntityFramework.Tests/Models/Library/Universe.cs index 639397da..8ad31e55 100644 --- a/test/Microsoft.Restier.Providers.EntityFramework.Tests/Models/Library/Universe.cs +++ b/test/Microsoft.Restier.Providers.EntityFramework.Tests/Models/Library/Universe.cs @@ -3,7 +3,7 @@ using System; using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.OData.Edm.Library; +using Microsoft.OData.Edm; namespace Microsoft.Restier.Providers.EntityFramework.Tests.Models.Library { diff --git a/test/Microsoft.Restier.Publishers.OData.Test/ExceptionHandlerTests.cs b/test/Microsoft.Restier.Publishers.OData.Test/ExceptionHandlerTests.cs index e874314a..380ba1dd 100644 --- a/test/Microsoft.Restier.Publishers.OData.Test/ExceptionHandlerTests.cs +++ b/test/Microsoft.Restier.Publishers.OData.Test/ExceptionHandlerTests.cs @@ -32,7 +32,7 @@ public async Task ShouldReturn403HandlerThrowsSecurityException() private class ExcApi : StoreApi { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { return base.ConfigureApi(services) .AddService((sp, next) => new FakeSourcer()); diff --git a/test/Microsoft.Restier.Publishers.OData.Test/FallbackTests.cs b/test/Microsoft.Restier.Publishers.OData.Test/FallbackTests.cs index e5453a55..af0b224f 100644 --- a/test/Microsoft.Restier.Publishers.OData.Test/FallbackTests.cs +++ b/test/Microsoft.Restier.Publishers.OData.Test/FallbackTests.cs @@ -13,7 +13,7 @@ using System.Web.OData; using System.Web.OData.Builder; using Microsoft.Extensions.DependencyInjection; -using Microsoft.OData.Edm.Library; +using Microsoft.OData.Edm; using Microsoft.Restier.Core; using Microsoft.Restier.Core.Model; using Microsoft.Restier.Core.Query; @@ -95,7 +95,7 @@ static FallbackModel() internal class FallbackApi : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.AddService((sp, next) => new TestModelProducer(FallbackModel.Model)); services.AddService((sp, next) => new FallbackModelMapper()); diff --git a/test/Microsoft.Restier.Publishers.OData.Test/Model/LibraryApi.cs b/test/Microsoft.Restier.Publishers.OData.Test/Model/LibraryApi.cs index 53ac66e9..45f0c64b 100644 --- a/test/Microsoft.Restier.Publishers.OData.Test/Model/LibraryApi.cs +++ b/test/Microsoft.Restier.Publishers.OData.Test/Model/LibraryApi.cs @@ -9,7 +9,7 @@ namespace Microsoft.Restier.Publishers.OData.Test.Model class LibraryApi : EntityFrameworkApi { // Need to register publisher services as MapRestierRoute is not called - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { base.ConfigureApi(services); services.AddODataServices(); diff --git a/test/Microsoft.Restier.Publishers.OData.Test/Model/LibraryContext.cs b/test/Microsoft.Restier.Publishers.OData.Test/Model/LibraryContext.cs index 6b6c0e93..48d71c6d 100644 --- a/test/Microsoft.Restier.Publishers.OData.Test/Model/LibraryContext.cs +++ b/test/Microsoft.Restier.Publishers.OData.Test/Model/LibraryContext.cs @@ -3,7 +3,7 @@ using System; using System.Data.Entity; -using Microsoft.OData.Edm.Library; +using Microsoft.OData.Edm; namespace Microsoft.Restier.Publishers.OData.Test.Model { diff --git a/test/Microsoft.Restier.Publishers.OData.Test/Model/RestierModelExtender.Tests.cs b/test/Microsoft.Restier.Publishers.OData.Test/Model/RestierModelExtender.Tests.cs index 96519522..703f56c9 100644 --- a/test/Microsoft.Restier.Publishers.OData.Test/Model/RestierModelExtender.Tests.cs +++ b/test/Microsoft.Restier.Publishers.OData.Test/Model/RestierModelExtender.Tests.cs @@ -6,7 +6,6 @@ using System.Web.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Library; using Microsoft.Restier.Core; using Microsoft.Restier.Core.Model; using Microsoft.Restier.Publishers.OData.Model; @@ -210,7 +209,7 @@ protected override ApiConfiguration CreateApiConfiguration(IServiceCollection se .IgnoreProperty("Invisible"); } - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.AddService((sp, next) => new TestModelBuilder()); return base.ConfigureApi(services); @@ -257,7 +256,7 @@ public class ApiE : BaseApi public IQueryable People { get; set; } public IQueryable Orders { get; set; } - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.AddService((sp, next) => new TestModelBuilder()); return base.ConfigureApi(services); @@ -268,7 +267,7 @@ public class ApiF : BaseApi { public IQueryable VipCustomers { get; set; } - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.AddService((sp, next) => new TestModelBuilder()); return base.ConfigureApi(services); @@ -286,7 +285,7 @@ public class ApiH : BaseApi public IQueryable Customers { get; set; } public Customer Me2 { get; set; } - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services.AddService((sp, next) => new TestModelBuilder()); return base.ConfigureApi(services); diff --git a/test/Microsoft.Restier.Publishers.OData.Test/Model/Universe.cs b/test/Microsoft.Restier.Publishers.OData.Test/Model/Universe.cs index 703299fe..92ce12e1 100644 --- a/test/Microsoft.Restier.Publishers.OData.Test/Model/Universe.cs +++ b/test/Microsoft.Restier.Publishers.OData.Test/Model/Universe.cs @@ -3,7 +3,7 @@ using System; using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.OData.Edm.Library; +using Microsoft.OData.Edm; namespace Microsoft.Restier.Publishers.OData.Test.Model { diff --git a/test/Microsoft.Restier.Publishers.OData.Test/StoreApi.cs b/test/Microsoft.Restier.Publishers.OData.Test/StoreApi.cs index a3644dab..5c521efe 100644 --- a/test/Microsoft.Restier.Publishers.OData.Test/StoreApi.cs +++ b/test/Microsoft.Restier.Publishers.OData.Test/StoreApi.cs @@ -7,7 +7,6 @@ using System.Web.OData.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Library; using Microsoft.Restier.Core; using Microsoft.Restier.Core.Model; using Microsoft.Restier.Core.Query; @@ -37,7 +36,7 @@ static StoreModel() internal class StoreApi : ApiBase { - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { services = base.ConfigureApi(services); services.AddService((sp, next) => new TestModelProducer(StoreModel.Model)); diff --git a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Northwind.Tests/SaveTests.cs b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Northwind.Tests/SaveTests.cs index fb0e6b5a..1165d656 100644 --- a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Northwind.Tests/SaveTests.cs +++ b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Northwind.Tests/SaveTests.cs @@ -27,7 +27,7 @@ private class TestEntityFilterReturnsTaskApi : NorthwindApi /// /// /// - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { Type apiType = this.GetType(); // Add core and convention's services diff --git a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Northwind/Models/NorthwindApi.cs b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Northwind/Models/NorthwindApi.cs index 990f17bf..16af6c00 100644 --- a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Northwind/Models/NorthwindApi.cs +++ b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Northwind/Models/NorthwindApi.cs @@ -10,7 +10,6 @@ using System.Web.OData; using Microsoft.Extensions.DependencyInjection; using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Library; using Microsoft.Restier.Core; using Microsoft.Restier.Core.Model; using Microsoft.Restier.Providers.EntityFramework; @@ -57,7 +56,7 @@ public double MostExpensive(IEnumerable bindingParameter) return 0.0; } - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { return base.ConfigureApi(services) .AddService(); diff --git a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Api/TrippinApi.cs b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Api/TrippinApi.cs index ef10a4b4..a4bc7fb7 100644 --- a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Api/TrippinApi.cs +++ b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Api/TrippinApi.cs @@ -9,11 +9,7 @@ using System.Web.OData.Query; using System.Web.OData.Routing; using Microsoft.Extensions.DependencyInjection; -using Microsoft.OData.Core; using Microsoft.OData.Edm; -using Microsoft.OData.Edm.Library; -using Microsoft.OData.Edm.Library.Annotations; -using Microsoft.OData.Edm.Library.Values; using Microsoft.OData.Service.Sample.Trippin.Extension; using Microsoft.OData.Service.Sample.Trippin.Models; using Microsoft.Restier.Core; @@ -23,6 +19,7 @@ using Microsoft.Restier.Publishers.OData.Model; using System.Reflection; using System.Web.OData.Builder; +using Microsoft.OData.Edm.Vocabularies; namespace Microsoft.OData.Service.Sample.Trippin.Api { @@ -564,7 +561,7 @@ protected bool CanDeleteTrips() return false; } - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { // Add customized OData validation settings Func validationSettingFactory = sp => new ODataValidationSettings @@ -609,12 +606,11 @@ public async Task GetModelAsync(ModelContext context, CancellationTok var trackGuidProperty = tripType.DeclaredProperties.Single(prop => prop.Name == "TrackGuid"); var timeStampValueProp = model.EntityContainer.FindEntitySet("Airlines").EntityType().FindProperty("TimeStampValue"); var computedTerm = new EdmTerm("Org.OData.Core.V1", "Computed", EdmPrimitiveTypeKind.Boolean); - var anno1 = new EdmAnnotation(trackGuidProperty, computedTerm, trueConstant); - var anno2 = new EdmAnnotation(timeStampValueProp, computedTerm, trueConstant); + var anno1 = new EdmVocabularyAnnotation(trackGuidProperty, computedTerm, trueConstant); + var anno2 = new EdmVocabularyAnnotation(timeStampValueProp, computedTerm, trueConstant); ((EdmModel)model).SetVocabularyAnnotation(anno1); ((EdmModel)model).SetVocabularyAnnotation(anno2); - var immutableTerm = new EdmTerm("Org.OData.Core.V1", "Immutable", EdmPrimitiveTypeKind.Boolean); var orderType = (EdmEntityType)model.SchemaElements.Single(e => e.Name == "Order"); @@ -623,16 +619,16 @@ public async Task GetModelAsync(ModelContext context, CancellationTok var orderProp3 = orderType.DeclaredProperties.Single(prop => prop.Name == "ComputedOrderDetail"); var orderProp4 = orderType.DeclaredProperties.Single(prop => prop.Name == "ImmutableOrderDetail"); - ((EdmModel)model).SetVocabularyAnnotation(new EdmAnnotation(orderProp1, computedTerm, trueConstant)); - ((EdmModel)model).SetVocabularyAnnotation(new EdmAnnotation(orderProp2, immutableTerm, trueConstant)); - ((EdmModel)model).SetVocabularyAnnotation(new EdmAnnotation(orderProp3, computedTerm, trueConstant)); - ((EdmModel)model).SetVocabularyAnnotation(new EdmAnnotation(orderProp4, immutableTerm, trueConstant)); + ((EdmModel)model).SetVocabularyAnnotation(new EdmVocabularyAnnotation(orderProp1, computedTerm, trueConstant)); + ((EdmModel)model).SetVocabularyAnnotation(new EdmVocabularyAnnotation(orderProp2, immutableTerm, trueConstant)); + ((EdmModel)model).SetVocabularyAnnotation(new EdmVocabularyAnnotation(orderProp3, computedTerm, trueConstant)); + ((EdmModel)model).SetVocabularyAnnotation(new EdmVocabularyAnnotation(orderProp4, immutableTerm, trueConstant)); var orderDetailType = (EdmComplexType)model.SchemaElements.Single(e => e.Name == "OrderDetail"); var detailProp1 = orderDetailType.DeclaredProperties.Single(prop => prop.Name == "ComputedProperty"); var detailProp2 = orderDetailType.DeclaredProperties.Single(prop => prop.Name == "ImmutableProperty"); - ((EdmModel)model).SetVocabularyAnnotation(new EdmAnnotation(detailProp1, computedTerm, trueConstant)); - ((EdmModel)model).SetVocabularyAnnotation(new EdmAnnotation(detailProp2, immutableTerm, trueConstant)); + ((EdmModel)model).SetVocabularyAnnotation(new EdmVocabularyAnnotation(detailProp1, computedTerm, trueConstant)); + ((EdmModel)model).SetVocabularyAnnotation(new EdmVocabularyAnnotation(detailProp2, immutableTerm, trueConstant)); var personType = (EdmEntityType)model.SchemaElements.Single(e => e.Name == "Person"); var type = personType.FindProperty("PersonId").Type; diff --git a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Controllers/PeopleController.cs b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Controllers/PeopleController.cs index 4782d75f..7c4d914a 100644 --- a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Controllers/PeopleController.cs +++ b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Controllers/PeopleController.cs @@ -9,7 +9,7 @@ using System.Web.OData; using System.Web.OData.Extensions; using System.Web.OData.Routing; -using Microsoft.OData.Edm.Library; +using Microsoft.OData.Edm; using Microsoft.OData.Service.Sample.Trippin.Api; using Microsoft.OData.Service.Sample.Trippin.Models; diff --git a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Extension/PathAndSlashEscapeODataPathHandler.cs b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Extension/PathAndSlashEscapeODataPathHandler.cs index 7c9e9edd..619df52e 100644 --- a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Extension/PathAndSlashEscapeODataPathHandler.cs +++ b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.Trippin/Extension/PathAndSlashEscapeODataPathHandler.cs @@ -21,11 +21,12 @@ public class PathAndSlashEscapeODataPathHandler : DefaultODataPathHandler private const string EscapedQuote = "'"; - public override ODataPath Parse(IEdmModel model, string serviceRoot, string odataPath) + public override ODataPath Parse(string serviceRoot, string odataPath, + IServiceProvider requestContainer) { if (!odataPath.Contains(EscapedQuote)) { - return base.Parse(model, serviceRoot, odataPath); + return base.Parse(serviceRoot, odataPath, requestContainer); } var pathBuilder = new StringBuilder(); @@ -44,7 +45,7 @@ public override ODataPath Parse(IEdmModel model, string serviceRoot, string odat EscapeSlashBackslash(path, pathBuilder); pathBuilder.Append(odataPath.Substring(queryStringIndex)); } - return base.Parse(model, serviceRoot, pathBuilder.ToString()); + return base.Parse(serviceRoot, pathBuilder.ToString(), requestContainer); } private void EscapeSlashBackslash(string uri, StringBuilder pathBuilder) 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 72ebad29..78b2fc0f 100644 --- a/test/ODataEndToEnd/Microsoft.OData.Service.Sample.TrippinInMemory/Api/TrippinApi.cs +++ b/test/ODataEndToEnd/Microsoft.OData.Service.Sample.TrippinInMemory/Api/TrippinApi.cs @@ -332,7 +332,7 @@ private static double CalculateDistance(GeographyPoint p1, GeographyPoint p2) #endregion - protected override IServiceCollection ConfigureApi(IServiceCollection services) + public override IServiceCollection ConfigureApi(IServiceCollection services) { Func> defaultDataStoreManager = sp => new DefaultDataStoreManager()