Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade v8 #943

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<RootNamespace>Simple.OData.Client</RootNamespace>
<DocumentationFile>$(DocumentationFile)\$(AssemblyName).xml</DocumentationFile>
<StrongNamePublicKey>$(StrongNamePublicKey)</StrongNamePublicKey>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<DocumentationFile>$(DocumentationFile)\$(AssemblyName).xml</DocumentationFile>
<StrongNamePublicKey>$(StrongNamePublicKey)</StrongNamePublicKey>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Simple.OData.Client.V4.Adapter/ResourceProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class ResourceProperties(ODataResource resource)
{
public ODataResource Resource { get; } = resource;
public string TypeName { get; set; }
public IEnumerable<ODataProperty> PrimitiveProperties => Resource.Properties;
public IEnumerable<ODataProperty> PrimitiveProperties => (IEnumerable<ODataProperty>)Resource.Properties;
public IDictionary<string, ODataCollectionValue> CollectionProperties { get; set; }
public IDictionary<string, ODataResource> StructuralProperties { get; set; }
}
4 changes: 2 additions & 2 deletions src/Simple.OData.Client.V4.Adapter/ResponseReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ protected override void ConvertEntry(ResponseNode entryNode, object entry)
var odataEntry = entry as ODataResource;
foreach (var property in odataEntry.Properties)
{
entryNode.Entry.Data.Add(property.Name, GetPropertyValue(property.Value));
entryNode.Entry.Data.Add(property.Name, GetPropertyValue(((ODataProperty)property).Value));
}

entryNode.Entry.SetAnnotations(CreateAnnotations(odataEntry));
Expand Down Expand Up @@ -267,7 +267,7 @@ private object GetPropertyValue(object value)
{
if (value is ODataResource resource)
{
return resource.Properties.ToDictionary(x => x.Name, x => GetPropertyValue(x.Value));
return resource.Properties.ToDictionary(x => x.Name, x => GetPropertyValue(((ODataProperty)x).Value));
}
else if (value is ODataCollectionValue collectionValue)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<DocumentationFile>$(DocumentationFile)\$(AssemblyName).xml</DocumentationFile>
<StrongNamePublicKey>$(StrongNamePublicKey)</StrongNamePublicKey>
</PropertyGroup>
Expand All @@ -20,7 +20,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.OData.Core" Version="[7.*, 8.0.0)" />
<PackageReference Include="Microsoft.OData.Core" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 0 additions & 14 deletions src/Simple.OData.Client.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Simple.OData.Client.V3.Adap
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Simple.OData.Client.V4.Adapter", "Simple.OData.Client.V4.Adapter\Simple.OData.Client.V4.Adapter.csproj", "{31D1CC1D-316E-4516-A2BD-F07423B394F6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Simple.OData.Samples.ApiV4", "Simple.OData.Samples.ApiV4\Simple.OData.Samples.ApiV4.csproj", "{25EEBCD4-0604-4B5A-AAF5-8A788939A217}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Simple.OData.Tests.Samples.ApiV4", "Simple.OData.Tests.Samples.ApiV4\Simple.OData.Tests.Samples.ApiV4.csproj", "{F01F7750-85F6-43D8-9C7B-34C75A3861E7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Simple.OData.Samples.ApiV3", "Simple.OData.Samples.ApiV3\Simple.OData.Samples.ApiV3.csproj", "{09CD2CB4-0B5B-4018-BFBB-7367CA7E10A4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Simple.OData.Tests.Samples.ApiV3", "Simple.OData.Tests.Samples.ApiV3\Simple.OData.Tests.Samples.ApiV3.csproj", "{57AA878B-3DD3-4B79-AB0B-ECC29563AAAC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Simple.OData.Tests.Client", "Simple.OData.Tests.Client\Simple.OData.Tests.Client.csproj", "{10A14EE1-39A6-4AE2-9A30-3B5573317E2C}"
Expand Down Expand Up @@ -78,18 +74,10 @@ Global
{31D1CC1D-316E-4516-A2BD-F07423B394F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31D1CC1D-316E-4516-A2BD-F07423B394F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31D1CC1D-316E-4516-A2BD-F07423B394F6}.Release|Any CPU.Build.0 = Release|Any CPU
{25EEBCD4-0604-4B5A-AAF5-8A788939A217}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25EEBCD4-0604-4B5A-AAF5-8A788939A217}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25EEBCD4-0604-4B5A-AAF5-8A788939A217}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25EEBCD4-0604-4B5A-AAF5-8A788939A217}.Release|Any CPU.Build.0 = Release|Any CPU
{F01F7750-85F6-43D8-9C7B-34C75A3861E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F01F7750-85F6-43D8-9C7B-34C75A3861E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F01F7750-85F6-43D8-9C7B-34C75A3861E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F01F7750-85F6-43D8-9C7B-34C75A3861E7}.Release|Any CPU.Build.0 = Release|Any CPU
{09CD2CB4-0B5B-4018-BFBB-7367CA7E10A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{09CD2CB4-0B5B-4018-BFBB-7367CA7E10A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09CD2CB4-0B5B-4018-BFBB-7367CA7E10A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{09CD2CB4-0B5B-4018-BFBB-7367CA7E10A4}.Release|Any CPU.Build.0 = Release|Any CPU
{57AA878B-3DD3-4B79-AB0B-ECC29563AAAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{57AA878B-3DD3-4B79-AB0B-ECC29563AAAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{57AA878B-3DD3-4B79-AB0B-ECC29563AAAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -120,9 +108,7 @@ Global
{812D678E-B428-41A1-BC05-8160695AD186} = {78D04AF9-B9B4-4025-93C6-B3DB01EDAAE9}
{A08B2D3D-91A6-4ECD-B7AF-5977E840E383} = {A1B189A0-8C64-4F23-A8FC-9DDD79B8AF36}
{31D1CC1D-316E-4516-A2BD-F07423B394F6} = {A1B189A0-8C64-4F23-A8FC-9DDD79B8AF36}
{25EEBCD4-0604-4B5A-AAF5-8A788939A217} = {6173C837-D890-4BF8-84F0-D8525997C52F}
{F01F7750-85F6-43D8-9C7B-34C75A3861E7} = {78D04AF9-B9B4-4025-93C6-B3DB01EDAAE9}
{09CD2CB4-0B5B-4018-BFBB-7367CA7E10A4} = {6173C837-D890-4BF8-84F0-D8525997C52F}
{57AA878B-3DD3-4B79-AB0B-ECC29563AAAC} = {78D04AF9-B9B4-4025-93C6-B3DB01EDAAE9}
{10A14EE1-39A6-4AE2-9A30-3B5573317E2C} = {78D04AF9-B9B4-4025-93C6-B3DB01EDAAE9}
{6E44E884-4949-4330-98B8-A919F814123E} = {78D04AF9-B9B4-4025-93C6-B3DB01EDAAE9}
Expand Down
2 changes: 1 addition & 1 deletion src/Simple.OData.Client/Simple.OData.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<DocumentationFile>$(DocumentationFile)\$(AssemblyName).xml</DocumentationFile>
<StrongNamePublicKey>$(StrongNamePublicKey)</StrongNamePublicKey>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Simple.OData.Samples.ApiV3/Models/MoviesContext.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using Microsoft.EntityFrameworkCore;

namespace WebApiOData.V3.Samples.Models;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net48</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<RootNamespace>Simple.OData.Samples.ApiV3</RootNamespace>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EntityFramework" Version="6.*" />
<PackageReference Include="Microsoft.AspNet.WebApi.OData" Version="5.*" />
<PackageReference Include="Microsoft.AspNet.WebApi.Owin" Version="5.2.*" />
<PackageReference Include="EntityFramework" Version="6.5.1" />
<PackageReference Include="Microsoft.AspNet.WebApi.OData" Version="5.7.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Owin" Version="1.0.0" />
</ItemGroup>

</Project>
20 changes: 12 additions & 8 deletions src/Simple.OData.Samples.ApiV4/Controllers/MoviesController.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
using System.Web.Http;
using Microsoft.AspNet.OData;
using Microsoft.AspNet.OData.Routing;
using Microsoft.AspNetCore.OData;
using Microsoft.AspNetCore.OData.Routing;
using Microsoft.AspNetCore.OData;
using Microsoft.AspNetCore.OData.Routing;
using WebApiOData.V4.Samples.Models;
using Microsoft.AspNetCore.OData.Routing.Controllers;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.OData.Formatter;

namespace WebApiOData.V4.Samples.Controllers;

public class MoviesController : ODataController
{
private readonly MoviesContext _db = new();

public IHttpActionResult Get()
public IActionResult Get()
{
return Ok(_db.Movies);
}

[HttpPost]
public IHttpActionResult CheckOut(int key)
public IActionResult CheckOut(int key)
{
var movie = _db.Movies.FirstOrDefault(m => m.ID == key);
if (movie is null)
Expand All @@ -32,7 +36,7 @@ public IHttpActionResult CheckOut(int key)
}

[HttpPost]
public IHttpActionResult Return(int key)
public IActionResult Return(int key)
{
var movie = _db.Movies.FirstOrDefault(m => m.ID == key);
if (movie is null)
Expand All @@ -47,7 +51,7 @@ public IHttpActionResult Return(int key)

// Check out a list of movies.
[HttpPost]
public IHttpActionResult CheckOutMany(ODataActionParameters parameters)
public IActionResult CheckOutMany(ODataActionParameters parameters)
{
if (!ModelState.IsValid)
{
Expand All @@ -73,7 +77,7 @@ public IHttpActionResult CheckOutMany(ODataActionParameters parameters)

[HttpPost]
[ODataRoute("CreateMovie")]
public IHttpActionResult CreateMovie(ODataActionParameters parameters)
public IActionResult CreateMovie(ODataActionParameters parameters)
{
if (!ModelState.IsValid)
{
Expand Down
29 changes: 16 additions & 13 deletions src/Simple.OData.Samples.ApiV4/Controllers/ProductsController.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using System.Collections.Concurrent;
using System.Web.Http;
using Microsoft.AspNet.OData;
using Microsoft.AspNet.OData.Query;
using Microsoft.AspNet.OData.Routing;
using System.Web.Http.OData.Routing;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.OData;
using Microsoft.AspNetCore.OData.Formatter;
using Microsoft.AspNetCore.OData.Query;
using Microsoft.AspNetCore.OData.Routing;
using Microsoft.AspNetCore.OData.Routing.Controllers;
using WebApiOData.V4.Samples.Models;

namespace WebApiOData.V4.Samples.Controllers;
Expand Down Expand Up @@ -32,7 +35,7 @@ public ProductsController()
}

[Route("*")]
public IHttpActionResult Default()
public IActionResult Default()
{
return Ok("OK!!!");
}
Expand All @@ -43,7 +46,7 @@ public static IQueryable<Product> Get()
return _data.Values.AsQueryable();
}

public IHttpActionResult GetProduct(int key)
public IActionResult GetProduct(int key)
{
if (_data.TryGetValue(key, out var retval))
{
Expand All @@ -56,7 +59,7 @@ public IHttpActionResult GetProduct(int key)
}

[HttpGet]
public IHttpActionResult MostExpensive()
public IActionResult MostExpensive()
{
var retval = _data.Max(pair => pair.Value.Price);

Expand All @@ -66,7 +69,7 @@ public IHttpActionResult MostExpensive()
// Returns top 3 most expensive products
// This is needed to check function name matching
[HttpGet]
public IHttpActionResult MostExpensives()
public IActionResult MostExpensives()
{
var retval = _data.Values.OrderByDescending(p => p.Price).Take(3).ToList();

Expand All @@ -75,15 +78,15 @@ public IHttpActionResult MostExpensives()

// Returns the top ten most expensive products
[HttpGet]
public IHttpActionResult Top10()
public IActionResult Top10()
{
var retval = _data.Values.OrderByDescending(p => p.Price).Take(10).ToList();

return Ok(retval);
}

[HttpGet]
public IHttpActionResult GetPriceRank(int key)
public IActionResult GetPriceRank(int key)
{
if (_data.TryGetValue(key, out var product))
{
Expand All @@ -99,7 +102,7 @@ public IHttpActionResult GetPriceRank(int key)
}

[HttpGet]
public IHttpActionResult CalculateGeneralSalesTax(int key, string state)
public IActionResult CalculateGeneralSalesTax(int key, string state)
{
var taxRate = GetRate(state);

Expand All @@ -116,15 +119,15 @@ public IHttpActionResult CalculateGeneralSalesTax(int key, string state)

[HttpGet]
[ODataRoute("GetSalesTaxRate(state={state})")]
public IHttpActionResult GetSalesTaxRate([FromODataUri] string state)
public IActionResult GetSalesTaxRate([FromODataUri] string state)
{
return Ok(GetRate(state));
}

[HttpGet]
[EnableQuery]
[ODataRoute("Products({key})/Default.Placements()")]
public IHttpActionResult Placements([FromODataUri] int key, ODataQueryOptions<Movie> options)
public IActionResult Placements([FromODataUri] int key, ODataQueryOptions<Movie> options)
{
var source = new MoviesContext().Movies.Where(x => x.ID < key).AsQueryable();
return Ok(source);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Web.Http.Dispatcher;
using Microsoft.AspNet.OData;
using Microsoft.AspNetCore.OData;
using Microsoft.AspNetCore.OData.Routing.Controllers;

namespace WebApiOData.V4.Samples;

Expand Down
13 changes: 9 additions & 4 deletions src/Simple.OData.Samples.ApiV4/Simple.OData.Samples.ApiV4.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net48</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<RootNamespace>Simple.OData.Samples.ApiV4</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNet.OData" Version="7.*" />
<PackageReference Include="Microsoft.AspNet.WebApi.Owin" Version="5.2.*" />
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.3.0" />
<PackageReference Include="Microsoft.AspNet.WebApi.OData" Version="5.7.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Microsoft.AspNetCore.OData" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.*" />
<PackageReference Include="Microsoft.OData.Core" Version="7.*" />
<PackageReference Include="Microsoft.OData.Core" Version="8.0.1" />
<PackageReference Include="Microsoft.OData.Edm" Version="8.0.1" />
<PackageReference Include="Microsoft.Spatial" Version="8.0.1" />
<PackageReference Include="Owin" Version="1.0.0" />
</ItemGroup>

</Project>
1 change: 0 additions & 1 deletion src/Simple.OData.Samples.ApiV4/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Web.Http;
using System.Web.Http.Dispatcher;
using Microsoft.AspNet.OData.Extensions;
using Owin;

namespace WebApiOData.V4.Samples;
Expand Down
5 changes: 2 additions & 3 deletions src/Simple.OData.Samples.ApiV4/Startups/ActionStartup.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using System.Web.Http;
using Microsoft.AspNet.OData.Batch;
using Microsoft.AspNet.OData.Builder;
using Microsoft.AspNet.OData.Extensions;
using Microsoft.AspNetCore.OData.Batch;
using Microsoft.OData.Edm;
using Microsoft.OData.ModelBuilder;
using WebApiOData.V4.Samples.Controllers;
using WebApiOData.V4.Samples.Models;

Expand Down
4 changes: 1 addition & 3 deletions src/Simple.OData.Samples.ApiV4/Startups/FunctionStartup.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System.Web.Http;
using Microsoft.AspNet.OData.Batch;
using Microsoft.AspNet.OData.Builder;
using Microsoft.AspNet.OData.Extensions;
using Microsoft.AspNetCore.OData.Batch;
using Microsoft.OData.Edm;
using WebApiOData.V4.Samples.Controllers;
using WebApiOData.V4.Samples.Models;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net48;</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
Expand All @@ -15,6 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Simple.OData.Tests.Client.Integration/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public abstract class TestBase : IDisposable
{
private static readonly HttpClient metadataHttpClient = new();

protected const string ODataV2ReadWriteUri = "https://services.odata.org/V2/%28S%28readwrite%29%29/odata/OData.svc/";
protected const string ODataV2ReadWriteUri = "https://services.odata.org/V2/%28S%28readwrite%29%29/OData/OData.svc/";
protected const string ODataV3ReadOnlyUri = "https://services.odata.org/V3/OData/OData.svc/";
protected const string ODataV3ReadWriteUri = "https://services.odata.org/V3/%28S%28readwrite%29%29/OData/OData.svc/";
protected const string ODataV4ReadOnlyUri = "https://services.odata.org/V4/OData/OData.svc/";
Expand Down
Loading