-
Notifications
You must be signed in to change notification settings - Fork 459
[DataGrid] Add OData Adaptor package #2938
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
Merged
vnbaaij
merged 14 commits into
microsoft:dev
from
miguelhasse:odata-async-query-executor
Nov 19, 2024
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2f1664a
OData client implementation for IAsyncQueryExecutor
miguelhasse 2fdd68a
Merge branch 'microsoft:dev' into odata-async-query-executor
miguelhasse d4a7235
Merge branch 'microsoft:dev' into odata-async-query-executor
miguelhasse 97dff9d
Merge branch 'microsoft:dev' into odata-async-query-executor
miguelhasse 684d5ca
Merge branch 'microsoft:dev' into odata-async-query-executor
miguelhasse ac9252f
Merge branch 'microsoft:dev' into odata-async-query-executor
miguelhasse 31e3b68
Merge branch 'microsoft:dev' into odata-async-query-executor
miguelhasse 7b08658
Optimized count handling in ODataAsyncQueryExecutor
miguelhasse d707abe
Removed empty unit tests project and added content to README file
miguelhasse 78ecf5b
Removed unused package references from Directory.Packages.props
miguelhasse 1c775d8
Merge branch 'dev' into odata-async-query-executor
dvoituron 6e1e218
Merge branch 'dev' into odata-async-query-executor
miguelhasse a07ccfe
Merge branch 'dev' into odata-async-query-executor
vnbaaij 9235415
Renamed project 'Microsoft.FluentUI.AspNetCore.Components.DataGrid.ODβ¦
miguelhasse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
OData client implementation for IAsyncQueryExecutor
- Loading branch information
commit 2f1664adbbdc93ea6fc3034ea56fe0876bfa8b50
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...taGrid.OData.Client/Microsoft.FluentUI.AspNetCore.Components.DataGrid.OData.Client.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFrameworks>net8.0;net9.0</TargetFrameworks> | ||
| <PackageId>Microsoft.FluentUI.AspNetCore.Components.DataGrid.OData.Client</PackageId> | ||
| <Authors>Microsoft</Authors> | ||
| <Copyright>Β© Microsoft Corporation. All rights reserved.</Copyright> | ||
| <NeutralLanguage>en</NeutralLanguage> | ||
| <Owners>Microsoft Corporation</Owners> | ||
| <PackageProjectUrl>https://github.com/microsoft/fluentui-blazor</PackageProjectUrl> | ||
| <PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
| <Summary>An adapter for using the Fluent UI Blazor DataGrid with OData Client.</Summary> | ||
| <PackageTags>Fluent UI, Blazor, DataGrid, .NET8</PackageTags> | ||
| <Title>Microsoft Fluent UI DataGrid adapter for Entity Framework</Title> | ||
| <Description>An adapter for using the Fluent UI Blazor DataGrid with OData Client.</Description> | ||
| <SignAssembly>false</SignAssembly> | ||
| <Nullable>enable</Nullable> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <DebugType>embedded</DebugType> | ||
| <EmbedUntrackedSources>true</EmbedUntrackedSources> | ||
|
|
||
| <PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
| <RepositoryUrl>https://github.com/microsoft/fluentui-blazor</RepositoryUrl> | ||
| <RepositoryType>git</RepositoryType> | ||
| <PackageReadmeFile>README.md</PackageReadmeFile> | ||
| <LangVersion>latest</LangVersion> | ||
| <GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
| <IsPackable>true</IsPackable> | ||
| <PackageIcon>icon.png</PackageIcon> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup Condition="'$(Configuration)'=='Release'"> | ||
| <IsShipping>true</IsShipping> | ||
| <Optimize>True</Optimize> | ||
| <NoWarn>1701;1702;8669;1591</NoWarn> | ||
| <DebuggerSupport>false</DebuggerSupport> | ||
| <TrimmerRemoveSymbols>true</TrimmerRemoveSymbols> | ||
| <GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
| <PackageOutputPath>$(SolutionDir)artifacts</PackageOutputPath> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.OData.Client" /> | ||
| <PackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core"> | ||
| <PrivateAssets>all</PrivateAssets> | ||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
| </PackageReference> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\Core\Microsoft.FluentUI.AspNetCore.Components.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <None Include="README.md" Pack="true" PackagePath="\" /> | ||
| <None Include="..\..\..\icon.png" Pack="true" PackagePath="\" /> | ||
| </ItemGroup> | ||
|
|
||
| <PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true' Or '$(TF_BUILD)' == 'true'"> | ||
| <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild> | ||
| </PropertyGroup> | ||
|
|
||
| </Project> |
19 changes: 19 additions & 0 deletions
19
src/Extensions/DataGrid.OData.Client/ODataAdapterServiceCollectionExtensions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| using Microsoft.FluentUI.AspNetCore.Components.DataGrid.OData.Client; | ||
| using Microsoft.FluentUI.AspNetCore.Components.DataGrid.Infrastructure; | ||
|
|
||
| namespace Microsoft.Extensions.DependencyInjection; | ||
|
|
||
| /// <summary> | ||
| /// Provides extension methods to configure <see cref="IAsyncQueryExecutor"/> on a <see cref="IServiceCollection"/>. | ||
| /// </summary> | ||
| public static class ODataAdapterServiceCollectionExtensions | ||
| { | ||
| /// <summary> | ||
| /// Registers an OData aware implementation of <see cref="IAsyncQueryExecutor"/>. | ||
| /// </summary> | ||
| /// <param name="services">The <see cref="IServiceCollection"/>.</param> | ||
| public static void AddDataGridODataAdapter(this IServiceCollection services) | ||
| { | ||
| services.AddScoped<IAsyncQueryExecutor, ODataAsyncQueryExecutor>(); | ||
| } | ||
| } |
20 changes: 20 additions & 0 deletions
20
src/Extensions/DataGrid.OData.Client/ODataAsyncQueryExecutor.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| using Microsoft.OData.Client; | ||
| using Microsoft.FluentUI.AspNetCore.Components.DataGrid.Infrastructure; | ||
|
|
||
| namespace Microsoft.FluentUI.AspNetCore.Components.DataGrid.OData.Client; | ||
|
|
||
| internal class ODataAsyncQueryExecutor : IAsyncQueryExecutor | ||
| { | ||
| public bool IsSupported<T>(IQueryable<T> queryable) => queryable.Provider is DataServiceQueryProvider; | ||
|
|
||
| public async Task<int> CountAsync<T>(IQueryable<T> queryable, CancellationToken cancellationToken) | ||
| => (int)(await ExecuteAsync(queryable, cancellationToken)).Count; | ||
|
|
||
| public async Task<T[]> ToArrayAsync<T>(IQueryable<T> queryable, CancellationToken cancellationToken) | ||
| => [.. await ExecuteAsync(queryable, cancellationToken)]; | ||
|
|
||
| private static async Task<QueryOperationResponse<T>> ExecuteAsync<T>(IQueryable<T> queryable, CancellationToken cancellationToken) | ||
| { | ||
| return (QueryOperationResponse<T>)await ((DataServiceQuery<T>)queryable).IncludeCount().ExecuteAsync(cancellationToken); | ||
| } | ||
| } |
Empty file.
36 changes: 36 additions & 0 deletions
36
....OData.Client/Microsoft.FluentUI.AspNetCore.Components.DataGrid.OData.Client.Tests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk.Razor"> | ||
miguelhasse marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| <PropertyGroup> | ||
| <TargetFrameworks>net8.0;net9.0</TargetFrameworks> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
| <LangVersion>latest</LangVersion> | ||
| <GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
| <IsPackable>false</IsPackable> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="FluentAssertions" /> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" /> | ||
| <PackageReference Include="Moq" /> | ||
| <PackageReference Include="xunit" /> | ||
| <PackageReference Include="xunit.runner.visualstudio"> | ||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
| <PrivateAssets>all</PrivateAssets> | ||
| </PackageReference> | ||
| <PackageReference Include="coverlet.msbuild"> | ||
| <PrivateAssets>all</PrivateAssets> | ||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
| </PackageReference> | ||
| <PackageReference Include="coverlet.collector"> | ||
| <PrivateAssets>all</PrivateAssets> | ||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
| </PackageReference> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\..\src\Core\Microsoft.FluentUI.AspNetCore.Components.csproj" /> | ||
| <ProjectReference Include="..\..\..\src\Extensions\DataGrid.OData.Client\Microsoft.FluentUI.AspNetCore.Components.DataGrid.OData.Client.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.