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..55344b65 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..ab89de43 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 @@ -33,50 +33,48 @@ public static void Register(HttpConfiguration config) config.MessageHandlers.Add(new ETagMessageHandler()); 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.Routes.MapHttpRoute("Options", "{*OPTIONS}", new { controller = "CORS", action = "Options" }, new { Options = new myHttpRouteConstraint() }); + config.Filter().Expand().Select().OrderBy().MaxTop(100).Count().SetTimeZoneInfo(TimeZoneInfo.Utc); + config.UseRestier((builder) => { - Func> defaultDataStoreManager = - sp => new DefaultDataStoreManager() + builder.AddRestierApi(services => { - MaxDataStoreInstanceCapacity = 1000, - MaxDataStoreInstanceLifeTime = new TimeSpan(0, 30, 0) - }; + Func> defaultDataStoreManager = + sp => new DefaultDataStoreManager() + { + MaxDataStoreInstanceCapacity = 1000, + MaxDataStoreInstanceLifeTime = new TimeSpan(0, 30, 0) + }; - Func validationSettingFactory = sp => new ODataValidationSettings - { - MaxAnyAllExpressionDepth = 4, - MaxExpansionDepth = 4 - }; + Func validationSettingFactory = sp => new ODataValidationSettings + { + MaxAnyAllExpressionDepth = 4, + 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); + 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); - - } - - public static void RegisterTrippin( - HttpConfiguration config, HttpServer server) - { - // enable query options for all properties - config.Filter().Expand().Select().OrderBy().MaxTop(null).Count(); - config.SetTimeZoneInfo(TimeZoneInfo.Utc); - config.MapRestier( - routeName, - "", - false); // Custom TrippinBatchHandler registered in UseRestier + config.MapRestier((builder) => + { + builder.MapApiRoute( + routeName, + "", + false); // Custom TrippinBatchHandler registered in UseRestier + }); } } + public class myHttpRouteConstraint : IHttpRouteConstraint { bool IHttpRouteConstraint.Match(HttpRequestMessage request, IHttpRoute route, string parameterName, IDictionary values, HttpRouteDirection routeDirection) 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..c2a74c09 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 @@ -43,45 +44,51 @@ 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 + ..\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.5.0\lib\net45\Microsoft.AspNet.OData.dll + + ..\packages\Microsoft.AspNet.OData.7.7.5\lib\net45\Microsoft.AspNet.OData.dll - - ..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.1\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll + + ..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\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.6.0.0\lib\net461\Microsoft.Extensions.DependencyInjection.Abstractions.dll - - ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.3.1.31\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll + + ..\packages\Microsoft.Extensions.ObjectPool.6.0.3\lib\net461\Microsoft.Extensions.ObjectPool.dll - - ..\packages\Microsoft.OData.Core.7.7.2\lib\net45\Microsoft.OData.Core.dll + + ..\packages\Microsoft.OData.Core.7.21.3\lib\net45\Microsoft.OData.Core.dll - - ..\packages\Microsoft.OData.Edm.7.7.2\lib\net45\Microsoft.OData.Edm.dll + + ..\packages\Microsoft.OData.Edm.7.21.3\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.1.0\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.1.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.1.0\lib\net472\Microsoft.Restier.EntityFramework.dll - - ..\packages\Microsoft.Spatial.7.7.2\lib\net45\Microsoft.Spatial.dll + + ..\packages\Microsoft.Spatial.7.21.3\lib\net45\Microsoft.Spatial.dll ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll @@ -89,39 +96,39 @@ ..\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.8.0.0\lib\net462\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\System.Memory.4.5.5\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.8.0.0\lib\net462\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 + + ..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll - - ..\packages\System.Text.Json.4.7.2\lib\net461\System.Text.Json.dll + + ..\packages\System.Text.Json.8.0.4\lib\net462\System.Text.Json.dll ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll @@ -138,14 +145,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 @@ -220,6 +227,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}. + + + + + + + +
+ - + @@ -27,7 +31,7 @@ - + @@ -53,39 +57,39 @@ - + - + - + - + - + - + - + - + - + @@ -105,11 +109,11 @@ - + - + @@ -119,6 +123,27 @@ + + + + + + + + + + + + + + + + + + + + + \ 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..86a5e1ae 100644 --- a/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/packages.config +++ b/RESTier/TripPinInMemory/Microsoft.OData.Service.Sample.TrippinInMemory/packages.config @@ -1,43 +1,46 @@  - - + + + - - - - + + + + - - - - - - - - - - + + + + + + + + + + + + - + - + - + - + - + - - + + 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..8e5faad3 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 @@ -31,91 +34,100 @@ 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 + ..\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.7.5\lib\net45\Microsoft.AspNet.OData.dll - - ..\packages\Microsoft.AspNet.OData.7.5.0\lib\net45\Microsoft.AspNet.OData.dll + + ..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll - - ..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll + + ..\packages\Microsoft.Extensions.DependencyInjection.6.0.1\lib\net461\Microsoft.Extensions.DependencyInjection.dll - - ..\packages\Microsoft.Extensions.DependencyInjection.2.2.0\lib\net461\Microsoft.Extensions.DependencyInjection.dll + + ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.6.0.0\lib\net461\Microsoft.Extensions.DependencyInjection.Abstractions.dll - - ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll + + ..\packages\Microsoft.Extensions.ObjectPool.6.0.3\lib\net461\Microsoft.Extensions.ObjectPool.dll - - ..\packages\Microsoft.OData.Core.7.7.2\lib\net45\Microsoft.OData.Core.dll + + ..\packages\Microsoft.OData.Core.7.21.3\lib\net45\Microsoft.OData.Core.dll - - ..\packages\Microsoft.OData.Edm.7.7.2\lib\net45\Microsoft.OData.Edm.dll + + ..\packages\Microsoft.OData.Edm.7.21.3\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.1.0\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.1.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.1.0\lib\net472\Microsoft.Restier.EntityFramework.dll - - ..\packages\Microsoft.Spatial.7.7.2\lib\net45\Microsoft.Spatial.dll + + ..\packages\Microsoft.Spatial.7.21.3\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.8.0.0\lib\net462\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\System.Memory.4.5.5\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.8.0.0\lib\net462\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 + + ..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll - - ..\packages\System.Text.Json.4.6.0\lib\net461\System.Text.Json.dll + + ..\packages\System.Text.Json.8.0.4\lib\net462\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 @@ -149,6 +161,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}. + + + + + +
+ - + - + - + - + - + - + - + @@ -48,8 +52,37 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 a5a62e02..51733243 100644 --- a/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/packages.config +++ b/RESTier/TripPinInMemory/Microsoft.Restier.Providers.InMemory/packages.config @@ -1,42 +1,46 @@  - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - - + + - + \ No newline at end of file