From 37bbd5e6635d74c42421c3ab4e122bc37fac7cf3 Mon Sep 17 00:00:00 2001 From: mikepizzo Date: Mon, 14 Nov 2022 22:33:02 -0800 Subject: [PATCH 1/2] Update to latest RESTier RC9 --- .../Api/TrippinApi.cs | 20 +++--- .../App_Start/WebApiConfig.cs | 30 ++++---- ...Data.Service.Sample.TrippinInMemory.csproj | 65 +++++++++-------- .../Web.config | 32 +++++---- .../packages.config | 38 +++++----- ...icrosoft.Restier.Providers.InMemory.csproj | 70 ++++++++++--------- .../app.config | 28 +++++--- .../packages.config | 41 ++++++----- 8 files changed, 180 insertions(+), 144 deletions(-) diff --git a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Api/TrippinApi.cs b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Api/TrippinApi.cs index a9641fdf..522320f4 100644 --- a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Api/TrippinApi.cs +++ b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Api/TrippinApi.cs @@ -125,7 +125,7 @@ public IQueryable Airports /// /// /// - [Operation(EntitySet = "People")] + [UnboundOperation(EntitySet ="People")] public Person GetPersonWithMostFriends() { Person result = null; @@ -158,7 +158,7 @@ public Person GetPersonWithMostFriends() /// /// /// - [Operation(EntitySet = "Airports")] + [UnboundOperation(EntitySet = "Airports")] public Airport GetNearestAirport(double lat, double lon) { var startPoint = GeographyPoint.Create(lat, lon); @@ -178,7 +178,7 @@ public Airport GetNearestAirport(double lat, double lon) return nearestAirport; } - [Operation(IsBound = true)] + [BoundOperation()] public Airline GetFavoriteAirline(Person person) { var countDict = new Dictionary(); @@ -216,7 +216,7 @@ public Airline GetFavoriteAirline(Person person) /// /// Bound Function, get the trips of one friend with userName /// - [Operation(IsBound = true)] + [BoundOperation()] public ICollection GetFriendsTrips(Person person, string userName) { var friends = person.Friends.Where(p => p.UserName.Equals(userName)).ToArray(); @@ -231,7 +231,7 @@ public ICollection GetFriendsTrips(Person person, string userName) } } - [Operation(IsBound = true)] + [BoundOperation()] public ICollection GetInvolvedPeople(Trip trip) { var shareID = trip.ShareId; @@ -258,7 +258,7 @@ public ICollection GetInvolvedPeople(Trip trip) /// /// Unbound action, reset datasource. /// - [Operation(OperationType = OperationType.Action)] + [UnboundOperation(OperationType = OperationType.Action)] public void ResetDataSource() { DataStoreManager.ResetDataStoreInstance(Key); @@ -270,7 +270,7 @@ public void ResetDataSource() /// The person to be updated. /// The value of last name to be updated. /// True if update successfully. - [Operation(IsBound = true, OperationType = OperationType.Action)] + [BoundOperation(OperationType = OperationType.Action)] public bool UpdateLastName(Person person, string lastName) { if (person != null) @@ -284,7 +284,7 @@ public bool UpdateLastName(Person person, string lastName) } } - [Operation(IsBound = true, OperationType = OperationType.Action)] + [BoundOperation(OperationType = OperationType.Action)] public void ShareTrip(Person personInstance, string userName, int tripId) { if (personInstance == null) @@ -343,7 +343,7 @@ private static double CalculateDistance(GeographyPoint p1, GeographyPoint p2) internal class ModelBuilder : IModelBuilder { - public Task GetModelAsync(ModelContext context, CancellationToken cancellationToken) + public IEdmModel GetModel(ModelContext context) { var modelBuilder = new ODataConventionModelBuilder(); modelBuilder.Namespace = "Trippin"; @@ -351,7 +351,7 @@ public Task GetModelAsync(ModelContext context, CancellationToken can modelBuilder.EntitySet("Airlines"); modelBuilder.EntitySet("Airports"); modelBuilder.Singleton("Me"); - return Task.FromResult(modelBuilder.GetEdmModel()); + return modelBuilder.GetEdmModel(); } } } diff --git a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/App_Start/WebApiConfig.cs b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/App_Start/WebApiConfig.cs index 990f1eb9..bb9eef1a 100644 --- a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/App_Start/WebApiConfig.cs +++ b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/App_Start/WebApiConfig.cs @@ -34,7 +34,7 @@ public static void Register(HttpConfiguration config) config.SetUrlKeyDelimiter(ODataUrlKeyDelimiter.Slash); config.EnableCors(new EnableCorsAttribute("*", "*", "*")); config.Routes.MapHttpRoute("Options", "{*OPTIONS}", new { controller = "CORS", action = "Options" }, new { Options = new myHttpRouteConstraint()}); - config.UseRestier((services) => + config.UseRestier((builder) => { Func> defaultDataStoreManager = sp => new DefaultDataStoreManager() @@ -49,16 +49,20 @@ public static void Register(HttpConfiguration config) MaxExpansionDepth = 4 }; - services.AddSingleton(validationSettingFactory); - services.AddChainedService((sp, next) => new TrippinApi.ModelBuilder()); - services.AddChainedService((sp, next) => new ChangeSetInitializer()); - services.AddChainedService((sp, next) => new SubmitExecutor()); - services.AddSingleton(defaultDataStoreManager); + builder.AddRestierApi((services) => + { + services.AddSingleton(validationSettingFactory); + services.AddChainedService((sp, next) => new TrippinApi.ModelBuilder()); + services.AddChainedService((sp, next) => new ChangeSetInitializer()); + services.AddChainedService((sp, next) => new SubmitExecutor()); + services.AddSingleton(defaultDataStoreManager); - // Add custom TrippinBatchHandler - ODataBatchHandler trippinBatchHandler = new TrippinBatchHandler(GlobalConfiguration.DefaultServer); - trippinBatchHandler.ODataRouteName = routeName; - services.AddSingleton(trippinBatchHandler); + // Add custom TrippinBatchHandler + ODataBatchHandler trippinBatchHandler = new TrippinBatchHandler(GlobalConfiguration.DefaultServer); + trippinBatchHandler.ODataRouteName = routeName; + services.AddSingleton(trippinBatchHandler); + } + ); }); RegisterTrippin(config, GlobalConfiguration.DefaultServer); @@ -71,10 +75,12 @@ public static void RegisterTrippin( // enable query options for all properties config.Filter().Expand().Select().OrderBy().MaxTop(null).Count(); config.SetTimeZoneInfo(TimeZoneInfo.Utc); - config.MapRestier( + config.MapRestier((builder) => + builder.MapApiRoute( routeName, "", - false); // Custom TrippinBatchHandler registered in UseRestier + false) // Custom TrippinBatchHandler registered in UseRestier + ); } } public class myHttpRouteConstraint : IHttpRouteConstraint diff --git a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory.csproj b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory.csproj index 3cf12c51..8dac3091 100644 --- a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory.csproj +++ b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory.csproj @@ -43,8 +43,11 @@ 4 - - ..\packages\Ben.Demystifier.0.1.6\lib\net45\Ben.Demystifier.dll + + ..\packages\Ben.Demystifier.0.4.1\lib\net45\Ben.Demystifier.dll + + + ..\packages\Ben.TypeDictionary.0.1.4\lib\netstandard2.0\Ben.TypeDictionary.dll ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll @@ -52,36 +55,36 @@ ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll - - ..\packages\Microsoft.AspNet.OData.7.5.0\lib\net45\Microsoft.AspNet.OData.dll + + ..\packages\Microsoft.AspNet.OData.7.6.1\lib\net45\Microsoft.AspNet.OData.dll - - ..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.1\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll + + ..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll - - ..\packages\Microsoft.Extensions.DependencyInjection.3.1.31\lib\net461\Microsoft.Extensions.DependencyInjection.dll + + ..\packages\Microsoft.Extensions.DependencyInjection.6.0.1\lib\net461\Microsoft.Extensions.DependencyInjection.dll - - ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.3.1.31\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll + + ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.6.0.0\lib\net461\Microsoft.Extensions.DependencyInjection.Abstractions.dll - - ..\packages\Microsoft.OData.Core.7.7.2\lib\net45\Microsoft.OData.Core.dll + + ..\packages\Microsoft.OData.Core.7.12.5\lib\net45\Microsoft.OData.Core.dll - - ..\packages\Microsoft.OData.Edm.7.7.2\lib\net45\Microsoft.OData.Edm.dll + + ..\packages\Microsoft.OData.Edm.7.12.5\lib\net45\Microsoft.OData.Edm.dll - ..\packages\Microsoft.Restier.AspNet.1.0.0-rc5.20201113.1\lib\net472\Microsoft.Restier.AspNet.dll + ..\packages\Microsoft.Restier.AspNet.1.0.0-rc9.20221114.1\lib\net472\Microsoft.Restier.AspNet.dll - ..\packages\Microsoft.Restier.Core.1.0.0-rc5.20201113.1\lib\net472\Microsoft.Restier.Core.dll + ..\packages\Microsoft.Restier.Core.1.0.0-rc9.20221114.1\lib\net472\Microsoft.Restier.Core.dll ..\packages\Microsoft.Restier.EntityFramework.1.0.0-rc5.20201113.1\lib\net472\Microsoft.Restier.EntityFramework.dll - - ..\packages\Microsoft.Spatial.7.7.2\lib\net45\Microsoft.Spatial.dll + + ..\packages\Microsoft.Spatial.7.12.5\lib\net45\Microsoft.Spatial.dll ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll @@ -89,11 +92,11 @@ ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll - - ..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll + + ..\packages\System.Collections.Immutable.5.0.0\lib\net461\System.Collections.Immutable.dll - ..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll + ..\packages\System.ComponentModel.Annotations.5.0.0\lib\net461\System.ComponentModel.Annotations.dll @@ -104,18 +107,18 @@ - - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.9\lib\net45\System.Net.Http.Formatting.dll ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll - - ..\packages\System.Reflection.Metadata.1.6.0\lib\netstandard2.0\System.Reflection.Metadata.dll + + ..\packages\System.Reflection.Metadata.5.0.0\lib\net461\System.Reflection.Metadata.dll - - ..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll ..\packages\System.Text.Encodings.Web.4.7.2\lib\net461\System.Text.Encodings.Web.dll @@ -138,14 +141,14 @@ - - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.9\lib\net45\System.Web.Http.dll ..\packages\Microsoft.AspNet.WebApi.Cors.5.2.7\lib\net45\System.Web.Http.Cors.dll - - ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll + + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.9\lib\net45\System.Web.Http.WebHost.dll diff --git a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Web.config b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Web.config index 2680dca6..09b2dc7a 100644 --- a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Web.config +++ b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Web.config @@ -24,11 +24,11 @@ - - - - - + + + + + @@ -53,39 +53,39 @@ - + - + - + - + - + - + - + - + - + @@ -119,6 +119,10 @@ + + + + \ No newline at end of file diff --git a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/packages.config b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/packages.config index 72bd4957..7692a443 100644 --- a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/packages.config +++ b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/packages.config @@ -1,30 +1,32 @@  - + + - - - - + + + + - - - - - - - - + + + + + + + + + - + - + - + @@ -32,9 +34,9 @@ - + - + diff --git a/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/Microsoft.Restier.Providers.InMemory.csproj b/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/Microsoft.Restier.Providers.InMemory.csproj index d341416f..92e0cb52 100644 --- a/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/Microsoft.Restier.Providers.InMemory.csproj +++ b/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/Microsoft.Restier.Providers.InMemory.csproj @@ -31,8 +31,11 @@ 4 - - ..\packages\Ben.Demystifier.0.1.6\lib\net45\Ben.Demystifier.dll + + ..\packages\Ben.Demystifier.0.4.1\lib\net45\Ben.Demystifier.dll + + + ..\packages\Ben.TypeDictionary.0.1.4\lib\netstandard2.0\Ben.TypeDictionary.dll ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll @@ -40,63 +43,66 @@ ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll - - ..\packages\Microsoft.AspNet.OData.7.5.0\lib\net45\Microsoft.AspNet.OData.dll + + ..\packages\Microsoft.AspNet.OData.7.6.1\lib\net45\Microsoft.AspNet.OData.dll - - ..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll + + ..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll - - ..\packages\Microsoft.Extensions.DependencyInjection.2.2.0\lib\net461\Microsoft.Extensions.DependencyInjection.dll + + ..\packages\Microsoft.Extensions.DependencyInjection.6.0.1\lib\net461\Microsoft.Extensions.DependencyInjection.dll - - ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll + + ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.6.0.0\lib\net461\Microsoft.Extensions.DependencyInjection.Abstractions.dll - - ..\packages\Microsoft.OData.Core.7.7.2\lib\net45\Microsoft.OData.Core.dll + + ..\packages\Microsoft.OData.Core.7.12.5\lib\net45\Microsoft.OData.Core.dll - - ..\packages\Microsoft.OData.Edm.7.7.2\lib\net45\Microsoft.OData.Edm.dll + + ..\packages\Microsoft.OData.Edm.7.12.5\lib\net45\Microsoft.OData.Edm.dll - ..\packages\Microsoft.Restier.AspNet.1.0.0-rc5.20201113.1\lib\net472\Microsoft.Restier.AspNet.dll + ..\packages\Microsoft.Restier.AspNet.1.0.0-rc9.20221114.1\lib\net472\Microsoft.Restier.AspNet.dll - ..\packages\Microsoft.Restier.Core.1.0.0-rc5.20201113.1\lib\net472\Microsoft.Restier.Core.dll + ..\packages\Microsoft.Restier.Core.1.0.0-rc9.20221114.1\lib\net472\Microsoft.Restier.Core.dll ..\packages\Microsoft.Restier.EntityFramework.1.0.0-rc5.20201113.1\lib\net472\Microsoft.Restier.EntityFramework.dll - - ..\packages\Microsoft.Spatial.7.7.2\lib\net45\Microsoft.Spatial.dll + + ..\packages\Microsoft.Spatial.7.12.5\lib\net45\Microsoft.Spatial.dll + + + ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll - - ..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll + + ..\packages\System.Collections.Immutable.5.0.0\lib\net461\System.Collections.Immutable.dll - ..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll + ..\packages\System.ComponentModel.Annotations.5.0.0\lib\net461\System.ComponentModel.Annotations.dll ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll - - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.9\lib\net45\System.Net.Http.Formatting.dll ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll - - ..\packages\System.Reflection.Metadata.1.6.0\lib\netstandard2.0\System.Reflection.Metadata.dll + + ..\packages\System.Reflection.Metadata.5.0.0\lib\net461\System.Reflection.Metadata.dll - - ..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll + + ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll ..\packages\System.Text.Encodings.Web.4.7.2\lib\net461\System.Text.Encodings.Web.dll @@ -105,17 +111,17 @@ ..\packages\System.Text.Json.4.6.0\lib\net461\System.Text.Json.dll - ..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll - - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.9\lib\net45\System.Web.Http.dll - - ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll + + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.9\lib\net45\System.Web.Http.WebHost.dll diff --git a/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/app.config b/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/app.config index 4bb267f8..8395b109 100644 --- a/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/app.config +++ b/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/app.config @@ -4,31 +4,31 @@ - + - + - + - + - + - + - + @@ -48,7 +48,19 @@ - + + + + + + + + + + + + + diff --git a/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/packages.config b/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/packages.config index a5a62e02..efd6952a 100644 --- a/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/packages.config +++ b/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/packages.config @@ -1,27 +1,30 @@  - + + - - - - - - - - - - - - + + + + + + + + + + + + + - + + - + - + @@ -29,14 +32,14 @@ - + - + - + \ No newline at end of file From e00881aa1abdf3f509812fbae1f9af1a9b6c0b66 Mon Sep 17 00:00:00 2001 From: mikepizzo Date: Mon, 21 Nov 2022 14:43:16 -0800 Subject: [PATCH 2/2] Update RESTier to 1.0 for Trippin and TrippinInMemory. --- ...Data.Service.Sample.TrippinInMemory.csproj | 19 +++- .../Web.config | 21 ++-- .../packages.config | 8 +- ...icrosoft.Restier.Providers.InMemory.csproj | 21 +++- .../app.config | 9 ++ .../packages.config | 8 +- RESTier/Trippin/Trippin/Api/TrippinApi.cs | 16 +-- .../Trippin/Trippin/App_Start/WebApiConfig.cs | 34 +++--- ...rosoft.OData.Service.Sample.Trippin.csproj | 102 ++++++++++++------ RESTier/Trippin/Trippin/Web.config | 57 ++++++++-- RESTier/Trippin/Trippin/packages.config | 47 ++++---- 11 files changed, 238 insertions(+), 104 deletions(-) diff --git a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory.csproj b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory.csproj index 8dac3091..ac886d34 100644 --- a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory.csproj +++ b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory.csproj @@ -1,5 +1,6 @@  + Debug @@ -50,10 +51,10 @@ ..\packages\Ben.TypeDictionary.0.1.4\lib\netstandard2.0\Ben.TypeDictionary.dll - ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll + ..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.dll - ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll + ..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.SqlServer.dll ..\packages\Microsoft.AspNet.OData.7.6.1\lib\net45\Microsoft.AspNet.OData.dll @@ -75,13 +76,13 @@ ..\packages\Microsoft.OData.Edm.7.12.5\lib\net45\Microsoft.OData.Edm.dll - ..\packages\Microsoft.Restier.AspNet.1.0.0-rc9.20221114.1\lib\net472\Microsoft.Restier.AspNet.dll + ..\packages\Microsoft.Restier.AspNet.1.0.0\lib\net472\Microsoft.Restier.AspNet.dll - ..\packages\Microsoft.Restier.Core.1.0.0-rc9.20221114.1\lib\net472\Microsoft.Restier.Core.dll + ..\packages\Microsoft.Restier.Core.1.0.0\lib\net472\Microsoft.Restier.Core.dll - ..\packages\Microsoft.Restier.EntityFramework.1.0.0-rc5.20201113.1\lib\net472\Microsoft.Restier.EntityFramework.dll + ..\packages\Microsoft.Restier.EntityFramework.1.0.0\lib\net472\Microsoft.Restier.EntityFramework.dll ..\packages\Microsoft.Spatial.7.12.5\lib\net45\Microsoft.Spatial.dll @@ -223,6 +224,14 @@ + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + +
+ - + @@ -24,11 +28,11 @@ - - - - - + + + + + @@ -125,4 +129,9 @@ + + + + + \ No newline at end of file diff --git a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/packages.config b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/packages.config index 7692a443..6551fd72 100644 --- a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/packages.config +++ b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/packages.config @@ -2,7 +2,7 @@ - + @@ -16,9 +16,9 @@ - - - + + + diff --git a/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/Microsoft.Restier.Providers.InMemory.csproj b/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/Microsoft.Restier.Providers.InMemory.csproj index 92e0cb52..70d645f3 100644 --- a/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/Microsoft.Restier.Providers.InMemory.csproj +++ b/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/Microsoft.Restier.Providers.InMemory.csproj @@ -1,5 +1,6 @@  + Debug @@ -12,6 +13,8 @@ v4.7.2 512 + + true @@ -38,10 +41,10 @@ ..\packages\Ben.TypeDictionary.0.1.4\lib\netstandard2.0\Ben.TypeDictionary.dll - ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll + ..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.dll - ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll + ..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.SqlServer.dll ..\packages\Microsoft.AspNet.OData.7.6.1\lib\net45\Microsoft.AspNet.OData.dll @@ -62,13 +65,13 @@ ..\packages\Microsoft.OData.Edm.7.12.5\lib\net45\Microsoft.OData.Edm.dll - ..\packages\Microsoft.Restier.AspNet.1.0.0-rc9.20221114.1\lib\net472\Microsoft.Restier.AspNet.dll + ..\packages\Microsoft.Restier.AspNet.1.0.0\lib\net472\Microsoft.Restier.AspNet.dll - ..\packages\Microsoft.Restier.Core.1.0.0-rc9.20221114.1\lib\net472\Microsoft.Restier.Core.dll + ..\packages\Microsoft.Restier.Core.1.0.0\lib\net472\Microsoft.Restier.Core.dll - ..\packages\Microsoft.Restier.EntityFramework.1.0.0-rc5.20201113.1\lib\net472\Microsoft.Restier.EntityFramework.dll + ..\packages\Microsoft.Restier.EntityFramework.1.0.0\lib\net472\Microsoft.Restier.EntityFramework.dll ..\packages\Microsoft.Spatial.7.12.5\lib\net45\Microsoft.Spatial.dll @@ -155,6 +158,14 @@ + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + +
+ @@ -64,4 +68,9 @@ + + + + + \ No newline at end of file diff --git a/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/packages.config b/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/packages.config index efd6952a..e4938adc 100644 --- a/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/packages.config +++ b/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/packages.config @@ -2,7 +2,7 @@ - + @@ -14,9 +14,9 @@ - - - + + + diff --git a/RESTier/Trippin/Trippin/Api/TrippinApi.cs b/RESTier/Trippin/Trippin/Api/TrippinApi.cs index 016685b8..b4876f3e 100644 --- a/RESTier/Trippin/Trippin/Api/TrippinApi.cs +++ b/RESTier/Trippin/Trippin/Api/TrippinApi.cs @@ -44,7 +44,7 @@ private IQueryable PeopleWithFriends /// /// Implements an action import. /// - [Operation(Namespace = "Microsoft.OData.Service.Sample.Trippin.Models", OperationType = OperationType.Action)] + [UnboundOperation(Namespace = "Microsoft.OData.Service.Sample.Trippin.Models", OperationType = OperationType.Action)] public void ResetDataSource() { TrippinModel.ResetDataSource(); @@ -53,7 +53,7 @@ public void ResetDataSource() /// /// Action import - clean up all the expired trips. /// - [Operation(Namespace = "Microsoft.OData.Service.Sample.Trippin.Models", OperationType = OperationType.Action)] + [UnboundOperation(Namespace = "Microsoft.OData.Service.Sample.Trippin.Models", OperationType = OperationType.Action)] public void CleanUpExpiredTrips() { // DO NOT ACTUALLY REMOVE THE TRIPS. @@ -64,7 +64,7 @@ public void CleanUpExpiredTrips() /// /// The trip to update. /// The trip updated. - [Operation(Namespace = "Microsoft.OData.Service.Sample.Trippin.Models", IsBound = true, OperationType = OperationType.Action)] + [BoundOperation(Namespace = "Microsoft.OData.Service.Sample.Trippin.Models", OperationType = OperationType.Action)] public Trip EndTrip(Trip trip) { // DO NOT ACTUALLY UPDATE THE TRIP. @@ -76,7 +76,7 @@ public Trip EndTrip(Trip trip) /// /// The key of the binding person. /// The number of friends of the person. - [Operation(Namespace = "Microsoft.OData.Service.Sample.Trippin.Models", IsBound = true)] + [BoundOperation(Namespace = "Microsoft.OData.Service.Sample.Trippin.Models")] public int GetNumberOfFriends(Person person) { if (person == null) @@ -92,7 +92,7 @@ public int GetNumberOfFriends(Person person) /// Function import - gets the person with most friends. /// /// The person with most friends. - [Operation(Namespace = "Microsoft.OData.Service.Sample.Trippin.Models", EntitySet = "People")] + [UnboundOperation(Namespace = "Microsoft.OData.Service.Sample.Trippin.Models", EntitySet = "People")] public Person GetPersonWithMostFriends() { Person result = null; @@ -123,7 +123,7 @@ public Person GetPersonWithMostFriends() /// /// The minimum number of friends. /// People with at least n friends. - [Operation(Namespace = "Microsoft.OData.Service.Sample.Trippin.Models", EntitySet = "People")] + [UnboundOperation(Namespace = "Microsoft.OData.Service.Sample.Trippin.Models", EntitySet = "People")] public IEnumerable GetPeopleWithFriendsAtLeast(int n) { foreach (var person in PeopleWithFriends) @@ -154,9 +154,9 @@ public TrippinModelExtender(IModelBuilder innerHandler) this.InnerModelBuilder = innerHandler; } - public async Task GetModelAsync(ModelContext context, CancellationToken cancellationToken) + public IEdmModel GetModel(ModelContext context) { - var model = await InnerModelBuilder.GetModelAsync(context, cancellationToken); + var model = InnerModelBuilder.GetModel(context); // Issue (todo): model returned by EFModelProducer.GetModelAsync is always null; how do we extend? if (model != null) diff --git a/RESTier/Trippin/Trippin/App_Start/WebApiConfig.cs b/RESTier/Trippin/Trippin/App_Start/WebApiConfig.cs index 80eef081..c69f4fbc 100644 --- a/RESTier/Trippin/Trippin/App_Start/WebApiConfig.cs +++ b/RESTier/Trippin/Trippin/App_Start/WebApiConfig.cs @@ -22,28 +22,34 @@ public static class WebApiConfig public static void Register(HttpConfiguration config) { config.Filter().Expand().Select().OrderBy().MaxTop(null).Count(); + config.SetUrlKeyDelimiter(ODataUrlKeyDelimiter.Slash); - config.UseRestier((services) => + config.UseRestier((builder) => { - services.AddEF6ProviderServices(); - services.AddSingleton(); - services.AddSingleton( - new ODataValidationSettings - { - MaxAnyAllExpressionDepth = 3, - MaxExpansionDepth = 3 - } - ); - services.AddSingleton(); - services.AddRestierDefaultServices(); - services.AddChainedService((sp, next) => new TrippinApi.TrippinModelExtender(next)); + builder.AddRestierApi((services) => + { + services.AddEF6ProviderServices(); + services.AddSingleton(); + services.AddSingleton( + new ODataValidationSettings + { + MaxAnyAllExpressionDepth = 3, + MaxExpansionDepth = 3 + } + ); + services.AddSingleton(); + services.AddChainedService((sp, next) => new TrippinApi.TrippinModelExtender(next)); + }); } ); - config.MapRestier( + config.MapRestier((restierRouteBuilder) => + { + restierRouteBuilder.MapApiRoute( "TrippinApi", "", true); + }); } } } \ No newline at end of file diff --git a/RESTier/Trippin/Trippin/Microsoft.OData.Service.Sample.Trippin.csproj b/RESTier/Trippin/Trippin/Microsoft.OData.Service.Sample.Trippin.csproj index f48c9d9f..55e5ddd5 100644 --- a/RESTier/Trippin/Trippin/Microsoft.OData.Service.Sample.Trippin.csproj +++ b/RESTier/Trippin/Trippin/Microsoft.OData.Service.Sample.Trippin.csproj @@ -1,5 +1,6 @@  + Debug @@ -24,6 +25,8 @@ + + true @@ -84,73 +87,104 @@ - - ..\packages\Ben.Demystifier.0.1.4\lib\net45\Ben.Demystifier.dll + + ..\packages\Ben.Demystifier.0.4.1\lib\net45\Ben.Demystifier.dll + + + ..\packages\Ben.TypeDictionary.0.1.4\lib\netstandard2.0\Ben.TypeDictionary.dll - ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll + ..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.dll - ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll + ..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\packages\Microsoft.AspNet.OData.7.6.1\lib\net45\Microsoft.AspNet.OData.dll - - ..\packages\Microsoft.AspNet.OData.7.2.1\lib\net45\Microsoft.AspNet.OData.dll + + ..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll - - ..\packages\Microsoft.Extensions.DependencyInjection.2.2.0\lib\net461\Microsoft.Extensions.DependencyInjection.dll + + ..\packages\Microsoft.Extensions.DependencyInjection.6.0.1\lib\net461\Microsoft.Extensions.DependencyInjection.dll - - ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll + + ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.6.0.0\lib\net461\Microsoft.Extensions.DependencyInjection.Abstractions.dll - - ..\packages\Microsoft.OData.Core.7.6.0\lib\portable-net45+win8+wpa81\Microsoft.OData.Core.dll + + ..\packages\Microsoft.OData.Core.7.12.5\lib\net45\Microsoft.OData.Core.dll - - ..\packages\Microsoft.OData.Edm.7.6.0\lib\portable-net45+win8+wpa81\Microsoft.OData.Edm.dll + + ..\packages\Microsoft.OData.Edm.7.12.5\lib\net45\Microsoft.OData.Edm.dll - ..\packages\Microsoft.Restier.AspNet.1.0.0-rc1.20191105.1\lib\net472\Microsoft.Restier.AspNet.dll + ..\packages\Microsoft.Restier.AspNet.1.0.0\lib\net472\Microsoft.Restier.AspNet.dll - ..\packages\Microsoft.Restier.Core.1.0.0-rc1.20191105.1\lib\net472\Microsoft.Restier.Core.dll + ..\packages\Microsoft.Restier.Core.1.0.0\lib\net472\Microsoft.Restier.Core.dll - ..\packages\Microsoft.Restier.EntityFramework.1.0.0-rc1.20191105.1\lib\net472\Microsoft.Restier.EntityFramework.dll + ..\packages\Microsoft.Restier.EntityFramework.1.0.0\lib\net472\Microsoft.Restier.EntityFramework.dll - - ..\packages\Microsoft.Spatial.7.6.0\lib\portable-net45+win8+wpa81\Microsoft.Spatial.dll + + ..\packages\Microsoft.Spatial.7.12.5\lib\net45\Microsoft.Spatial.dll ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll True - - ..\packages\System.Collections.Immutable.1.4.0\lib\netstandard2.0\System.Collections.Immutable.dll + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + ..\packages\System.Collections.Immutable.5.0.0\lib\net461\System.Collections.Immutable.dll - ..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll + ..\packages\System.ComponentModel.Annotations.5.0.0\lib\net461\System.ComponentModel.Annotations.dll + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + - - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.9\lib\net45\System.Net.Http.Formatting.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Reflection.Metadata.5.0.0\lib\net461\System.Reflection.Metadata.dll - - ..\packages\System.Reflection.Metadata.1.5.0\lib\netstandard2.0\System.Reflection.Metadata.dll + + ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Text.Encodings.Web.4.7.2\lib\net461\System.Text.Encodings.Web.dll + + + ..\packages\System.Text.Json.4.6.0\lib\net461\System.Text.Json.dll + + + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll - - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.9\lib\net45\System.Web.Http.dll - - ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll + + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.9\lib\net45\System.Web.Http.WebHost.dll @@ -179,6 +213,14 @@ + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + +
- - +