|
| 1 | +--- |
| 2 | +title: "Announcing QueryLink v1.0.0: Simplify Your UI and Data Integration" |
| 3 | +date: 2025-03-04 |
| 4 | +series: ["ByteAether.QueryLink"] |
| 5 | +tags: ["Integration", "Entity Framework", "LINQ", "SQL", "Fullstack", "Database", "Blazor"] |
| 6 | +image: header.png |
| 7 | +--- |
| 8 | + |
| 9 | +We are thrilled to announce the official release of **[QueryLink v1.0.0](https://github.com/ByteAether/QueryLink/)**! This milestone release marks the culmination of our efforts to provide a seamless bridge between UI components and backend data sources powered by `IQueryable`. Whether you’re building dynamic data grids or data tables, QueryLink is here to [simplify your life](../20250218_front-back-glue-logic-querylink/index.md) by handling filters, sorting, and query string conversions with minimal code. |
| 10 | + |
| 11 | +## What is QueryLink? |
| 12 | + |
| 13 | +QueryLink is a [NuGet package](https://www.nuget.org/packages/ByteAether.QueryLink/) designed to integrate UI components (like datagrids and datatables) with backend `IQueryable` data sources. It helps you to: |
| 14 | +- Define and apply complex filters and sort orders effortlessly. |
| 15 | +- Override default behaviors with custom expressions. |
| 16 | +- Convert filtering and sorting definitions to and from query strings for smooth HTTP API integration. |
| 17 | + |
| 18 | +By abstracting these common tasks, QueryLink lets you focus on building great applications without getting bogged down in repetitive query logic. |
| 19 | + |
| 20 | +## Key Features |
| 21 | + |
| 22 | +- **Filter Definitions:** Easily define filters using a range of operators (e.g., equals, not equals, greater than, contains, etc.) to refine your queries. |
| 23 | +- **Order Definitions:** Specify sorting rules to control how your data is displayed. |
| 24 | +- **Expression-Based Overrides:** Customize default filter and order operations to suit your application's needs. |
| 25 | +- **Query String Conversion:** Convert definitions to and from query strings, making it straightforward to pass parameters via HTTP requests. |
| 26 | +- **IQueryable Extensions:** Directly apply filter and order definitions to your `IQueryable` data sources. |
| 27 | + |
| 28 | +With support for .NET 6.0, .NET 8.0, and .NET Standard 2.1, QueryLink fits neatly into your modern .NET projects. |
| 29 | + |
| 30 | +## Installation |
| 31 | + |
| 32 | +Getting started is as simple as running a single command. Install the latest stable version of QueryLink via NuGet: |
| 33 | + |
| 34 | +```sh |
| 35 | +dotnet add package ByteAether.QueryLink |
| 36 | +``` |
| 37 | + |
| 38 | +If you need a preview version, you can specify it with the `--version` option. This ease-of-installation helps you to integrate QueryLink into your project quickly and reliably. |
| 39 | + |
| 40 | +## How to Use QueryLink |
| 41 | + |
| 42 | +QueryLink provides a few core concepts that make filtering and sorting a breeze: |
| 43 | + |
| 44 | +### 1. Defining Filters and Orders |
| 45 | + |
| 46 | +The `Definitions` class allows you to specify filter and order criteria. For example: |
| 47 | + |
| 48 | +```csharp |
| 49 | +var definitions = new Definitions |
| 50 | +{ |
| 51 | + Filters = new List<FilterDefinition> |
| 52 | + { |
| 53 | + new("Name", FilterOperator.Eq, "John"), |
| 54 | + new("Age", FilterOperator.Gt, 30) |
| 55 | + }, |
| 56 | + Orders = new List<OrderDefinition> |
| 57 | + { |
| 58 | + new("Name", IsReversed: false), |
| 59 | + new("Age", IsReversed: true) |
| 60 | + } |
| 61 | +}; |
| 62 | +``` |
| 63 | + |
| 64 | +This snippet creates filters to select records where the name equals "John" and age is greater than 30, and then orders the results accordingly. |
| 65 | + |
| 66 | +### 2. Using Overrides for Custom Behavior |
| 67 | + |
| 68 | +Sometimes the default filtering logic isn’t enough. QueryLink’s `Overrides` class lets you tailor operations using expression-based overrides: |
| 69 | + |
| 70 | +```csharp |
| 71 | +var overrides = new Overrides |
| 72 | +{ |
| 73 | + Filter = new List<FilterOverride> |
| 74 | + { |
| 75 | + new(p => p.Name, p => p.FullName) |
| 76 | + }, |
| 77 | + Order = new List<OrderOverride> |
| 78 | + { |
| 79 | + new(p => p.Name, p => p.FullName) |
| 80 | + } |
| 81 | +}; |
| 82 | +``` |
| 83 | + |
| 84 | +This approach lets you substitute a property (like `Name`) with another (like `FullName`) when applying filters or orders, offering flexible customization. |
| 85 | + |
| 86 | +### 3. Converting to and from Query Strings |
| 87 | + |
| 88 | +Easily integrate with web APIs by converting your definitions to a query string and back: |
| 89 | + |
| 90 | +```csharp |
| 91 | +string queryString = definitions.ToQueryString(); |
| 92 | +Definitions parsedDefinitions = Definitions.FromQueryString(queryString); |
| 93 | +``` |
| 94 | + |
| 95 | +This feature ensures that your filtering and sorting logic is easily transferable over HTTP. |
| 96 | + |
| 97 | +### 4. Applying Definitions to IQueryable |
| 98 | + |
| 99 | +Finally, apply your definitions directly to an `IQueryable` source: |
| 100 | + |
| 101 | +```csharp |
| 102 | +IQueryable query = dbContext.People.AsQueryable(); |
| 103 | +query = query.Apply(definitions, overrides); |
| 104 | +``` |
| 105 | + |
| 106 | +By extending `IQueryable`, QueryLink seamlessly integrates with your existing data-access code, providing a clean and efficient query transformation pipeline. |
| 107 | + |
| 108 | +## Real-World Examples |
| 109 | + |
| 110 | +QueryLink shines in practical scenarios—like integrating with a MudBlazor DataGrid alongside EF Core. The package simplifies server-side data loading by reading grid state, generating query strings, and applying filter and order definitions to your data source. This comprehensive approach means fewer lines of code and less boilerplate for you to manage. |
| 111 | + |
| 112 | +## Join the Community |
| 113 | + |
| 114 | +We believe that community feedback is invaluable. As we celebrate this stable release, we invite you to contribute to the project: |
| 115 | +- **Submit Issues or Feature Requests:** Help us make QueryLink even better. |
| 116 | +- **Contribute Code:** Fork the repository, implement improvements, and send us a pull request. |
| 117 | +- **Spread the Word:** Share your experiences using QueryLink on social media and developer forums. |
| 118 | + |
| 119 | +Your contributions and insights will help shape the future of QueryLink. |
| 120 | + |
| 121 | +## License |
| 122 | + |
| 123 | +QueryLink is released under the MIT License, ensuring that it remains free and open for your use and customization. For more details, please refer to the LICENSE file in the repository. |
| 124 | + |
| 125 | +--- |
| 126 | + |
| 127 | +[QueryLink v1.0.0](https://github.com/ByteAether/QueryLink/) is here to make your UI and data integration simpler, more flexible, and efficient. We look forward to seeing the innovative solutions you build with it. Happy coding! |
0 commit comments