Training
Learning path
Implement finance and operations apps - Training
Plan and design your project methodology to successfully implement finance and operations apps with FastTrack services, data management and more.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Fixes [ #2737 ]: Support getting navigation source for complex types by @mikepizzo in [#2744]
Bump version to 7.6.4 by @xuzhg in [#2750]
[ #2699 ] Add virtual method for complex property serialization.
Fix the NewtonSoft.JSON package version reference problem.
Warning: This version had issues and was unlisted from NuGet.
[ #2668 ] Update Newtonsoft.Json version to 13.0.1
[ #2652 ] Add settings flag to avoid swallowing serialization errors when ILogger is registered
[ #2692 ] Update ODL version to 7.12.2
[ #2650 ] Argument null exception in containerbuilder on .net 6
[ #2420 ] Scale is not working on decimal property
[ #2601 ] Update Patch to Return TStructuralType and Handle Patch for Derived Complex type
[ #2621 ] Update ODL version to Latest 7.10 in WebAPi projects
[ #2622 ] Create type annotation only with type name
[ #2626 ] Support $id references across entire batch
[ #2339 ] Ensure that untyped values escaped in ODL are unescaped in OData WebApi during deserialization
[ #2544 ] Fix to ignore Unmapped properties in Delta<T>
[ #2575 ] Fixing Patching Complex type when using one derived type over another
[ #2582 ] Enable Auto expand on complex type
[ #2559 ] Fix attribute routing error when action parameters don't match route keys
[ #2565 ] Consider the operation segment when determining the target structured type of an action or function
Fix a code signing issue affecting 7.5.10
[ #2483 ] Support changing of updatable properties when handling delta updates
Fix an issue with Microsoft.OData.Core 7.9.0 dependency
[ #2421 ] Add support for $this
[ #2456 ] Built-in support for deeply nested paths
[ #2521 ] Add support for $count segment in filter
[ #2470 ] Fix casing issue preventing project from compiling under case-sensitive OS like Linux
[ #2491 ] Improve logic around dependency injection and services registration
[ #2492 ] Fix ClrTypeCache memory leak
[ #2494 ] Fix API Explorer usage with OData
[ #2497 ] Upgrade Microsoft.OData.Core, Microsoft.OData.Edm and Microsoft.Spatial dependencies to v7.9.0
[ #2512 ] Fix behaviour on status code results (for example error response from a controller action decorated with EnableQuery attribute)
[ #2515 ] Enable constant parameterization in DateTime constants
[ #2525 ] Fixed Enum TryParse issue
[ #2530 ] Fix bug in filter=any(...) within expand
[ #2538/#2539/#2540 ] Bump System.Text.RegularExpressions from 4.3.0 to 4.3.1
[ #2426 ] Multiple orderby level.
[ #2457 ] Filter is not working with date function
[ #2482 ] Revert "inconsistencies in query options when_returnscollection is used on collection entity. #2398 ]"
[ #2450 ] Add the OData version to reader settings when specified in the request
[ #2445 ] ODataResourceDeserializer Preserves Request on ODataDeserializerContext for Nested Resource
[ #2438 ] Extend runtime Type methods of OperationConfiguration
[ #2436 ] Excessive memory in ODataConventionModelBuilder BuildDerivedTypesMapping
[ #2431 ] Using Metadata writer async
[ #2418 ] Check for empty Namespace
[ #2398 ] Inconsistencies in query options when returnscollection is used on collection of entity types
Fix the ODL package version dependency issue
[ #2397 ] Moving EnableQuery request level query data storage to HttpContext
If your code has custom implementations of the methods below, you may encounter a breaking change.
BadRequest(string message);
Conflict(string message);
Unauthorized(string message);
NotFound(string message);
UnprocessableEntity(string message);
For example, in your custom implementation of BadRequest(string message)
, you may be inheriting from BadRequestObjectResult
, yet in this fix, we are inheriting from BadRequestResult
.
[ #2361 ] Enable JSON Metadata You can use one of the following to return the JSON metadata:
[ #2341 ] Create ODataError in Non-Success responses
[ #2311 ] Enable case insensitive request binding
[ #2379 ] Fix duplicate batch Cookie header
[ #2377 ] Fix MergeIndividualAndBatchPreferences method
[ #2368 ] Fix bug in attribute convention route values
[ #2362 ] Enabling query validation EnableQuery before action execution
[ #2356 ] Fix behaviour for Preflight requests on the ODataBatchMiddleware
[ #2332 ] Fix invalid next page link in nested collections
[ #2342 ] Remove GuidCompare method in ExpressionBinderBase.cs
It's breaking change since 'GuidCompare' was a public API. Please use Guid.CompareTo(Guid) method directly.
[ #2336 ] Full async reader & writer support
This change makes the call stack within ASP.NET Core OData completely asynchronous,
enabling ASP.NET Core applications to use OData without requiring AsynchronousIO=true
.
The change also wraps the stream given to OData Library to ensure that all calls made
from OData Library to the stream are through asychnronous APIs.
[ #2332 ] Fix invalid next page link in nested collections
[ #2299 ] Create the correct expression when casting entity/complex type to derived type
[ #2302 ] Group by on date throws exceptions
[ #2306 ] Throw exception if the function call without providing the parameter value
[ #2310 ] Fix buggy behaviour when addressing derived types
[ #2313 ] Add support for parameters defined with type
[ #2315 ] Fix routing regression causing 404 on actions with [FromQuery]
[ #2320 ] Select a complex with null value fails
[ #2323 ] Fix regression affecting usage of "in" expression with primitive collection property on RHS
The NuGet packages for ASP.NET Web API OData v7.5.0 are available on the NuGet gallery.
The corresponding symbols now can load from the nuget symbol server.
[ #2252 ] Add HEAD Support for Attribute Routing
[ #2219 ] Support intance annotation
[ #2195 ] Add cast operation to FilterBinder.BindIn
[ #2191 ] support long URL pattern
[ #2189 ] Enable convention routing for operation import
[ #2167 ] support fine grained cors access control
[ #2232 ] AspNetCore Resolving of Batch ContentId for AddRelatedObject
[ #2231 ] Enhance $batch accept header decision
[ #2288 ] ResourceContext.ResourceInstance throws exception if there's a select or expand
[ #2287 ] Invalid partial JSON response happens expanding an entity
[ #2279 ] Fix incorrect child collection nextlink
[ #2267 ] enable enum member alias for query options
[ #2248 ] Fix invalid location header generated when key property for a model contains unicode chars
[ #2246 ] Fix Delta<TStructuralType>.GetInstance() method
[ #2200 ] Avoid NullReferenceException on TruncatedCollection<T>
[ #2197 ] Fix skip token encoding
[ #2168 ] Improve action selector routing
[ #2142 ] Remove the null check for classic EF
[ #2060 ] opertation returns path for the return entity set or singleton
[ #2053 ] Fix client-side evaluation for string comparison queries
[ #2147 ] Fix #2141 and #2144: the context Uri and location wrong with PathBase setting
[ #2149 ] Remove sync calls within async batch processing
[ #2154 ] SetDefaultODataOptions doesn't work
[ #2160 ] Fix logic for patching structured type with complex type dynamic property
[ #2169 ] Copy query settings correctly
[ #2172 ] Fix EfCore memory leak when query contains collection constant
Revert the default HandleNullPropagationOption
to HandleNullPropagationOption.False
by default for EF Core.
[ #2055 ] Batch request copies content headers to embedded requests without content.
The NuGet packages for ASP.NET Web API OData v7.4.0 are available on the NuGet gallery.
Assessed EF Core 3.x aggregation support
Aggregation support was introduced in EF Core 2.0, however it was implemented as client-side execution. Query translation was rewritten in EF Core 3.0 and client-side evaluation was removed to leverage database side execution and achieve great performance. However, not all LINQ queries translated to appropriate SQL queries. As a result, $apply isn’t compatible with EF Core 3.0 and 3.1. We will work with EF Core team to extend aggregation support in next versions of EF Core. Meanwhile, we recommend using Entity Framework 6. Starting with EF 6.3 it works with .NET Core 3 on all supported platform.
[ #2014 ] Fix performance drop when using a big model.
[ #2048 ] Fix multiple batch issues
[ #1962 ] Fix cast issue
[ #1953 ] Fix Skiptoken value with DateTime
[ #1948 ] Use ODataValueProvider
[ #1933 ] Ensures nullable enums are handled for In operator
The NuGet packages for ASP.NET Web API OData v7.3.0 are available on the NuGet gallery.
You can install or update the NuGet packages for OData Web API v7.3.0 using the Package Manager Console:
PM> Install-Package Microsoft.AspNetCore.OData -Version 7.3.0
or
PM> Install-Package Microsoft.AspNet.OData -Version 7.3.0
[ #1748 ] Add .NET Core 3.x supporting.
Be noted: v7.3.0 includes .NET Core 3.1 supporting, meanwhile v7.3.0-beta includes .NET Core 3.0 supporting.
[ #1992)) ] Missing Null check in SelectExpandNode class
[ #1989 ] Fix error message to state that value must be 1 or greater, instead of zero or greater
[ #1984 ] $select on property of type byte[] not working since 7.2.3
The NuGet packages for ASP.NET Web API OData v7.2.3 are available on the NuGet gallery.
You can install or update the NuGet packages for OData Web API v7.2.3 using the Package Manager Console:
PM> Install-Package Microsoft.AspNetCore.OData -Version 7.2.3
or
PM> Install-Package Microsoft.AspNet.OData -Version 7.2.3
The NuGet packages for ASP.NET Web API OData v7.2.2 are available on the NuGet gallery.
You can install or update the NuGet packages for OData Web API v7.2.2 using the Package Manager Console:
PM> Install-Package Microsoft.AspNetCore.OData -Version 7.2.2
or
PM> Install-Package Microsoft.AspNet.OData -Version 7.2.2
This provides a flag that can revert the breaking change introduced in the last release. You can use this flag to generate the incorrect nextlink to avoid a null nextlink.
[ #1919)) ] Update to ODL 7.6.1.
[ #1910 ] Allow IN operator for enums
[ #1907 ] AmbiguousMatchException in ApplyTo method
[ #1895 ] Ensure generated skip token respects casing conventions
[ #1884 ] Ensure that all expand item options preserved when translating SELECT *
[ #1882 ] ODataQuerySettings missing copy EnableCorrelatedSubqueryBuffering in ODataQuerySettings .CopyFrom function.
[ #1814 ] CreateODataResult.Entity made public
The NuGet packages for ASP.NET Web API OData v7.2.0 are available on the NuGet gallery.
You can install or update the NuGet packages for OData Web API v7.2.0 using the Package Manager Console:
PM> Install-Package Microsoft.AspNetCore.OData -Version 7.2.0
or
PM> Install-Package Microsoft.AspNet.OData -Version 7.2.0
If your code is using the request extension method to generate the nextlink, you may encounter a breaking change. Previously, if the page size was greater than $top query option value, the nextlink generated would have contained negative $top value. Now, we return null if the page size is larger than the $top value.
[ #1844 ] Support count in orderby and filter query options
[ #1839 ] Support 4.01 OData version
[ #1797 ] Enable $ref after $expand
[ #1728 ] Support $apply for EF Core
[ #1724 ] Custom NextLink generation with default SkipToken implementation
[ #1867 ] Fix ordering the keys according to the ColumnAttribute.Order property Update to OData Library v7.6 1825
[ #1855 ] Flatten properties before using in aggregation to avoid nested querie…
[ #1854 ] Fix error response in ValidateODataBatchRequest
[ #1851 ] Support default value for primitive and enum property
[ #1849 ] Improvement support continue-on-error in batch request
[ #1825 ] Update to OData Library v7.6
[ #1823 ] Support leading and trailing spaces in query options
[ #1802 ] ODataEnumDeserializer.ReadInline fails with InvalidCastException when edmType comes from CsdlParser
[ #1742 ] Fixes and coverage for primitives in URL parameters.
[ #1725 ] No coercion operator is defined between types 'Microsoft.OData.Edm.Date' and 'System.DateTimeOffset'.
[ #1715 ] Fix for Nav/any(f:false) conversion
[ #1693 ] Fix assignment of CollectionExpandedProperty.TotalCount when using EF
[ #1653 ] Fixing N+1 query bug on expands
[ #1542 ] Fix SelectExpandBinder to take into account constant parameterization
The NuGet packages for ASP.NET Web API OData v7.1.0 are available on the NuGet gallery.
You can install or update the NuGet packages for OData Web API v7.1.0 using the Package Manager Console:
PM> Install-Package Microsoft.AspNetCore.OData -Version 7.1.0
or
PM> Install-Package Microsoft.AspNet.OData -Version 7.1.0
[!Notes]: issue #1591 fixes an issue where types created by the ODataModelBuilder did not respect the namespace of the >ModelBuilder and instead used the namespace of the CLR type. With PR #1592, OData WebAPI 7.1.0 now correctly uses the namespace on the ModelBuilder, if it has been explicitly set. In order to retain the old behavior of using the namespace of the CLR type, do not set the namespace on the ModelBuilder, or set the namespace on the ModelBuilder to null or to the desired namespace of the CLR type.
[ #1631 ] Don't require keys for singleton instances
[ #1628 ] Allow adding new members to a collection through a POST request
[ #1591 ] Support namespaces in OData ModelBuilder
[ #1656 ] Allowing the definition of partner relationships
[ #1543 ] Json batch response body if 404
[ #1555 ] aspnetcore ETagMessageHandler throws then ClrType property name and EdmModel property name differs
[ #1559 ] Don't assume port 80 for nextLink when request was HTTPS
[ #1579 ] Star select ( $select= * ) not returning dynamic properties
[ #1588 ] Null check on ODataQueryParameterBindingAttribute for Net Core
[ #736 ] EDMX returned from $metadata endpoint has incorrect "Unicode" attributes
[ #850 ] ODataConventionModelBuilder takes into account [EnumMember] on enum members, but ODataPrimitiveSerializer (?) does not, causing mismatch in the payload.
[ #1612 ] Add the iconUrl to the nuget spec
[ #1615 ] fix compile error in sample project
[ #1421 ] Improve error message when structured type is received and properties are in incorrect case
[ #1658 ] Fix the security vulnerabilities in project dependencies
[ #1637 ] Change Request: Remove null check on 'ODataFeature().TotalCount' property
[ #1673 ] Respect preference header for paging
[ #1600 ] ActionDescriptorExtensions is not thread safe
[ #1617 ] Take and Top query use wrong Provider.CreateQuery Method
[ #1659 ] OData V4 group by with Top and skip not working
[ #1679 ] Fix typo: routePrerix updated to routePrefix
The NuGet packages for ASP.NET Web API OData v7.0.1 are available on the NuGet gallery.
You can install or update the NuGet packages for OData Web API v7.0.1 using the Package Manager Console:
PM> Install-Package Microsoft.AspNetCore.OData -Version 7.0.1
or
PM> Install-Package Microsoft.AspNet.OData -Version 7.0.1
[ Web API issue #1488 ] Support optional parameters
[ Web API PR #1527 ] Add UseOData() extension methods
[ Web API issue #1518 ] Fix the Newtonsoft.Json dependency problem in classic version
[ Web API issue #1529 ] Fix ETag missing on derived Entity Set
[ Web API issue #1532 ] Fix JSON batch response content type
We're happy to announce the release of ASP.NET Web API OData 7.0 on the NuGet gallery!
ASP.NET Web API OData 7.0 is available in two packages:
Get started with ASP.NET Web API OData 7.0 today!
You can install or update the NuGet packages for OData Web API v7.0.0 using the Package Manager Console:
PM> Install-Package Microsoft.AspNetCore.OData
or
PM> Install-Package Microsoft.AspNet.OData
See main issues from:
[ Web API issue #939 ] .NET Core Support.
[ Web API issue #772 ] Roadmap for OData WebAPI run on ASP.NET Core.
[ Web API issue #229 ] Port ASP.NET Web API OData to ASP.NET 5/MVC 6.
Getting started ASP.NET Core OData from here, get samples from here.
[ PR #1497 ] Support In
operator.
[ PR #1409 ] Set default to Unqualified-function/action call and case insensitive.
[ PR #1393 ] Set default to enable KeyAsSegment.
[ Issue #1503 ] Enable support for Json Batch.
[ Issue #1386 ] Use TemplateMatcher for ODataBatchPathMapping.
[ Issue #1248 ] Allow recursive complex types in OData model builder.
[ Issue #1225 ] Support optional dollar sign.
[ Issue #893 ] Support aggregation of Entity Set.
Both Microsoft.AspNetCore.OData and Microsoft.AspNet.OData are using "Microsoft.AspNet.OData" namespace.
[ PR #1489 ] Change the OptionalReturn to ReturnNullable in OperationConfiguration.
[ PR #1353 ] Change OptionalParameter as Nullable .
[ Issue #1510 ] move $top & $skip execute as late as possible.
[ Issue #1489 ] Return Task<> from method of controller doesn't pick up OData output formatter (Core).
[ Issue #1407 ] Fix the BaseAddressFactory in ODataMediaTypeFormatter .
[ Issue #1471 ] Issue in non-odata routing with DataContact & DataMember.
[ Issue #1434 ] Add OData-Version into the No-Content response header.
[ Issue #1398 ] Expose underlying semantic OData path.
[ Issue #1388 ] Make Match as virtual in ODataPathRouteConstraint.
[ Issue #1387 ] Move Instance to select all.
[ Issue #1313 ] Batch requests are incorrectly routed when ASP.NET Core OData web application has any BasePath.
[ Issue #1263 ] Patch nested structural resources.
[ Issue #1247 ] Fix Spatial post/update problem.
[ Issue #1113 ] ODataResourceDeserializer no longer supports null ComplexType values.
[ Issue #822 ] Fix for memory leak in EdmLibHelpers.
Web API OData Beta1, Beta2 & Beta4 includes a new package for WebApi OData V7.0.0 for ASP.NET Core 2.x. The nightly version of this package is available from this nightly url.
There is also a new WebApi OData V7.0.0 for ASP.NET Framework.
The nightly version of this package is available from this nightly url.
The APIs are the same as those in WebApi OData V6.x, except for the new namespace Microsoft.AspNet.OData
for V7, which is changed from System.Web.OData
.
Both packages depends on OData Lib 7.0.0.
The code for the packages can be found here
Web API OData for ASP.NET Core Beta1, has following limitations which are known issues:
Value cannot be null. Parameter name: routeName
. You
can work around this issue by adding routes.EnableDependencyInjection();
in UseMvc()
lambda in Configure
. You can configure
the default startup request in Project properties, Debug, App URL.Web API OData for ASP.NET, there are no known issues.
The new OData V7.0.0 for ASP.NET Core 2.x package supports the same features set as Web API OData V6.0.0 but works with ASP.NET Core. You can learn more about ASP.NET Core from the documentation.
To get started with OData V7.0.0 for ASP.NET Core 2.x, you can use code that is very similar to Web API OData V6.0.0. All of the documentation in Writing a simple OData V4 service is correct except for configuring the OData endpoint. Instead of using the Register() method, you'll follow the new service + route configuration model used in ASP.NET Core.
The namespace for both Web API OData packages is Microsoft.AspNet.OData.
In Visual Studio 2017, create a new C# project from the ASP.NET Core Web Application template. Name the project "ODataService".
In the New Project dialog, select ASP.NET Core 2.0 and select the WebApi template. Click OK.
In the Nuget Package Manager, install Microsoft.AspNetCore.OData
and all it's dependencies.
Add a C# class to the Models folder:
namespace ODataService.Models
{
public class Product
{
public int ID { get; set; }
public string Name { get; set; }
}
}
Add a C# class to the Controllers folder:
namespace ODataService.Controllers
{
public class ProductsController : ODataController
{
private List<Product> products = new List<Product>()
{
new Product()
{
ID = 1,
Name = "Bread",
}
};
[EnableQuery]
public List<Product> Get()
{
return products;
}
}
}
In the controller, we defined a List<Product>
object which has one product element. It's considered as an in-memory storage
of the data of the OData service.
We also defined a Get
method that returns the list of products. The method refers to the handling of HTTP GET requests. We'll
cover that in the sections about routing.
This Get
method is decorated with EnableQueryAttribute
, which in turns supports OData query options, for example $expand, $filter
etc.
Open the file Startup.cs. Replace the existing ConfigureServices
and Configure
methods with the
following code:
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddOData();
}
public void Configure(IApplicationBuilder app)
{
var builder = new ODataConventionModelBuilder(app.ApplicationServices);
builder.EntitySet<Product>("Products");
app.UseMvc(routeBuilder =>
{
// and this line to enable OData query option, for example $filter
routeBuilder.Select().Expand().Filter().OrderBy().MaxTop(100).Count();
routeBuilder.MapODataServiceRoute("ODataRoute", "odata", builder.GetEdmModel());
// uncomment the following line to Work-around for #1175 in beta1
// routeBuilder.EnableDependencyInjection();
});
}
Start the OData service by running the project and open a browser to consume it. You should be able to get access to the service
document at https://host/odata/
in which https://host/odata/
is the root path of your service. The metadata document
can be accessed at GET https://host:port/odata/$metadata
and the products at GET https://host:port/odata/Products
where
host:port
is the host and port of your service, usually something like localhost:1234
.
As mentioned earlier, most of the samples for Web API OData V6.0.0 apply to Web API OData V7.0.0. One of the design goals was to keep the API between the two as similar as possible. While the APIs are similar, they are not identical due to differences between ASP.NET and ASP.NET Core, such as HttpRequestMessage is now HttpRequest.
Both Microsoft.AspNet.OData
and Microsoft.AspNetCore.OData
packages support same set of OData routing conventions, including default built-in routing conventions and attribute routing convention, so that each request can be routed to matching controller for processing. All routing conventions implement the interface IODataRoutingConvention
, however, with different definitions, as ``` csharp below, for the two packages due to different route matching implementations based on ASP.NET Framework and ASP.NET Core:
For ASP.NET Framework:
namespace Microsoft.AspNet.OData.Routing.Conventions
{
/// <summary>
/// Provides an abstraction for selecting a controller and an action for OData requests.
/// </summary>
public interface IODataRoutingConvention
{
/// <summary>
/// Selects the controller for OData requests.
/// </summary>
string SelectController(ODataPath odataPath, HttpRequestMessage request);
/// <summary>
/// Selects the action for OData requests.
/// </summary>
string SelectAction(ODataPath odataPath, HttpControllerContext controllerContext, ILookup<string, HttpActionDescriptor> actionMap);
}
}
For ASP.NET Core 2.x:
namespace Microsoft.AspNet.OData.Routing.Conventions
{
/// <summary>
/// Provides an abstraction for selecting a controller and an action for OData requests.
/// </summary>
public interface IODataRoutingConvention
{
/// <summary>
/// Selects the controller and action for OData requests.
/// </summary>
IEnumerable<ControllerActionDescriptor> SelectAction(RouteContext routeContext);
}
}
Specific routing convention, e.g. MetadataRoutingConvention, typically implements the package-specific interface, provides package-specific implementation, and shares common logic for both platform in the Microsoft.AspNet.OData.Shared
shared project.
Training
Learning path
Implement finance and operations apps - Training
Plan and design your project methodology to successfully implement finance and operations apps with FastTrack services, data management and more.