Skip to content

Commit

Permalink
Release v1.8 to support .Net 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny Logsdon committed Feb 10, 2024
1 parent cf38be1 commit e77347f
Show file tree
Hide file tree
Showing 1,936 changed files with 661,026 additions and 977 deletions.
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<img src="https://github.com/holomodular/ServiceQuery/blob/main/examples/InMemory7/wwwroot/Logo.png" title="ServiceQuery Logo" width="250"/>

# Service Query Allows Querying Data Over REST APIs
Service Query (http://ServiceQuery.com) is an open-source library that allows dynamically querying database information over REST APIs. It leverages the power of an expressions builder and a simple model that is capable of serializing query instructions over service boundaries, similar to how ODATA works but better. It supports numerous popular relational (SQL) and document (NoSQL) database engines that expose an IQueryable interface. This provides clients and front end applications unprecedented queryability as well as a standardized endpoint for a microservice-based architecture supporting polyglot data access to system database data.
Service Query (http://ServiceQuery.com) is an open-source library that allows dynamically querying database information over REST APIs. It leverages the power of an expressions builder and a simple model that is capable of serializing query instructions over service boundaries, similar to how OData and GraphQL work. It supports numerous popular relational (SQL) and document (NoSQL) database engines that expose an IQueryable interface. ServiceQuery dynamically builds LINQ expressions for querying data, so your data is safe and secure. This library provides clients and front end applications unprecedented queryability using a standardized endpoint supporting polyglot data access.

# Installation Instructions
Install the NuGet Package <b>ServiceQuery</b>
Expand All @@ -14,11 +14,13 @@ View all our examples in the [examples](https://github.com/holomodular/ServiceQu
We want to hear from our users. Please feel free to post any issues or questions on our discussion board. You can star our repository or you can also reach us at: Support@HoloModular.com

# Simple Example - Dynamic Querying Using Javascript
Modeled based on LINQ, you create a simple request object that is sent over a REST API endpoint to your web server. Make sure to include the following [ServiceQuery.js](https://servicequery.com/js/servicequery.js) javascript file to quickly build request queries in javascript.
Modeled based on LINQ, you create a simple request object that is sent over a REST API endpoint to your web server. Make sure to include the following [ServiceQuery.js](https://github.com/holomodular/ServiceQuery/blob/main/src/javascript/servicequery.js) javascript file to quickly build request queries in javascript.
```javascript
<script src="/js/servicequery.js"></script>
<script type="text/javascript">

function GetById() {

// Build the request
var request = new ServiceQueryRequestBuilder().IsEqual("Id","123").Build();

Expand Down Expand Up @@ -47,7 +49,7 @@ using ServiceQuery;
[Route("ExampleServiceQuery")]
public ServiceQueryResponse<ExampleTable> ExampleServiceQuery(ServiceQueryRequest request)
{
var queryable = _context.ExampleTable.AsQueryable(); //_context is your database context
var queryable = databaseContext.ExampleTable.AsQueryable();
return request.Execute(queryable);
}
```
Expand All @@ -56,17 +58,17 @@ public ServiceQueryResponse<ExampleTable> ExampleServiceQuery(ServiceQueryReques
Documentation is located on our website at (http://ServiceQuery.com) as well as a simplified version below. The website also contains tables for supported data types and operations by .NET Framework version and database engine.

## ServiceQuery.AzureDataTables
AzureDataTables does not support several things out of the box, such as aggregates, string comparisons and ordering (solved by downloading all records). We have built a companion NuGet package <b>ServiceQuery.AzureDataTables</b> that provides workarounds to these limitations so you can use all standard operations and execute the request in one line of code. See our example project for more information.
AzureDataTables does not support several things out of the box, such as aggregates, string comparisons and ordering (solved by downloading all records). We have built a companion NuGet package <b>ServiceQuery.AzureDataTables</b> that provides workarounds to these limitations so you can use all standard operations and execute the request in one line of code. See our example projects for more information.

## Building and Executing a Query
Building a query is accomplish using the ServiceQueryRequestBuilder object to create the request.
Building a query is accomplished using the ServiceQueryRequestBuilder object to create the request.
```csharp
using ServiceQuery;

public void Example()
{
var request = new ServiceQueryRequestBuilder().Build();
var queryable = context.ExampleTable.AsQueryable();
var queryable = databaseContext.ExampleTable.AsQueryable();
var response = request.Execute(queryable);

List<ExampleTable> list = response.List; // contains the list of objects returned from the query
Expand Down Expand Up @@ -112,6 +114,7 @@ Nullability Functions
Paging Functions
* Page Number
* Page Size
* Include Count

Selecting Functions
* Distinct
Expand All @@ -123,7 +126,7 @@ Sorting Functions


## Using Query Operations
If you are using javascript, make sure to download the [ServiceQuery.js](https://servicequery.com/js/servicequery.js) javascript file. This allows you to use the same syntax as the .NET code below!
If you are using javascript, make sure to download the [ServiceQuery.js](https://github.com/holomodular/ServiceQuery/blob/main/src/javascript/servicequery.js) javascript file. This allows you to use the same syntax as the .NET code below!
```csharp
using ServiceQuery;

Expand All @@ -134,27 +137,32 @@ If you are using javascript, make sure to download the [ServiceQuery.js](https:/
.Paging(1, 1000, false)
.Build();

// Include the count of records with the response
request = new ServiceQueryRequestBuilder()
.IsGreaterThan("id","1")
.IsGreaterThan("id","10")
.IncludeCount()
.Build();

// Select only the properties you want
request = new ServiceQueryRequestBuilder()
.IsEqual("id","1")
.Select("Id","FirstName","LastName")
.Build();

// Build AND expressions
request = new ServiceQueryRequestBuilder()
.IsEqual("Id","1")
.And() // You can also comment this out, an And() will be added by default
.And()
.StartsWith("FirstName", "John")
.Build();

// Build OR expressions
request = new ServiceQueryRequestBuilder()
.Between("Id","1", "5")
.Or()
.Contains("LastName", "Smith")
.Build();

// Group expressions with BEGIN, END, AND and OR. Nest as deeply as needed.
request = new ServiceQueryRequestBuilder()
.Begin()
.IsEqual("Id","1")
Expand All @@ -163,17 +171,19 @@ If you are using javascript, make sure to download the [ServiceQuery.js](https:/
.End()
.Or()
.Begin()
.LessThanOrEqual("BirthDate","1/1/2000")
.IsLessThanOrEqual("BirthDate","1/1/2000")
.And()
.IsNull("CloseDate")
.End()
.Build();

// Sorting
request = new ServiceQueryRequestBuilder()
.IsEqual("Age", "21")
.Count()
.SortAsc("FirstName")
.Build();

// Aggregate functions
request = new ServiceQueryRequestBuilder()
.IsLessThan("Id", "200")
.Sum("Age")
Expand Down
3 changes: 3 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.0.8
- Support .NET 8.0

# 1.0.6
- DateTime parsing using System.Globalization.DateTimeStyles.RoundtripKind

Expand Down
57 changes: 32 additions & 25 deletions ServiceQuery.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceQuery", "src\Service
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{B95F2A1E-93C5-4CB8-847A-1695011B9C6F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceQuery7.Xunit", "src\tests\ServiceQuery7.Xunit\ServiceQuery7.Xunit.csproj", "{8B1BAD7D-878D-4D4D-87EA-48BBD44FE9ED}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceQuery.AzureDataTables", "src\ServiceQuery.AzureDataTables\ServiceQuery.AzureDataTables.csproj", "{164E1DD7-9227-4CDA-BC19-9761180438AB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceQuery6.Xunit", "src\tests\ServiceQuery6.Xunit\ServiceQuery6.Xunit.csproj", "{CC9680C9-FE11-4F33-937D-A2FEB6E0C1E2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceQueryNet6.Xunit", "src\tests\ServiceQueryNet6.Xunit\ServiceQueryNet6.Xunit.csproj", "{AB5F494F-8FF9-42F3-B1B2-237E158D4FCA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceQuery7.Integration.Xunit", "src\tests\ServiceQuery7.Integration.Xunit\ServiceQuery7.Integration.Xunit.csproj", "{AAF6EC25-AF7F-4262-AF57-31E870A1B057}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceQueryNet7.Xunit", "src\tests\ServiceQueryNet7.Xunit\ServiceQueryNet7.Xunit.csproj", "{83563838-E9D7-46E0-A75A-791BEA0B21B1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceQuery.AzureDataTables", "src\ServiceQuery.AzureDataTables\ServiceQuery.AzureDataTables.csproj", "{164E1DD7-9227-4CDA-BC19-9761180438AB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceQueryNet8.Integration.Xunit", "src\tests\ServiceQueryNet8.Integration.Xunit\ServiceQueryNet8.Integration.Xunit.csproj", "{6EE6807C-8F10-456C-83FD-88BBC4BDD332}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceQueryNet8.Xunit", "src\tests\ServiceQueryNet8.Xunit\ServiceQueryNet8.Xunit.csproj", "{99CC31AC-0187-48C7-83CF-EB9D049F883E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceQuery.AzureDataTables7.Integration.Xunit", "src\tests\ServiceQuery.AzureDataTables7.Integration.Xunit\ServiceQuery.AzureDataTables7.Integration.Xunit.csproj", "{FB65DDA1-CC62-4A8B-8FAC-D5ED12ABC8C7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceQuery.AzureDataTablesNet8.Integration.Xunit", "src\tests\ServiceQuery.AzureDataTablesNet8.Integration.Xunit\ServiceQuery.AzureDataTablesNet8.Integration.Xunit.csproj", "{F18413C0-2BAE-47DD-9BEC-1795ACF5CEEF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -27,35 +29,40 @@ Global
{9E0DFD17-9698-475F-A453-1D680A34DC7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E0DFD17-9698-475F-A453-1D680A34DC7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9E0DFD17-9698-475F-A453-1D680A34DC7D}.Release|Any CPU.Build.0 = Release|Any CPU
{8B1BAD7D-878D-4D4D-87EA-48BBD44FE9ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B1BAD7D-878D-4D4D-87EA-48BBD44FE9ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B1BAD7D-878D-4D4D-87EA-48BBD44FE9ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B1BAD7D-878D-4D4D-87EA-48BBD44FE9ED}.Release|Any CPU.Build.0 = Release|Any CPU
{CC9680C9-FE11-4F33-937D-A2FEB6E0C1E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC9680C9-FE11-4F33-937D-A2FEB6E0C1E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC9680C9-FE11-4F33-937D-A2FEB6E0C1E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC9680C9-FE11-4F33-937D-A2FEB6E0C1E2}.Release|Any CPU.Build.0 = Release|Any CPU
{AAF6EC25-AF7F-4262-AF57-31E870A1B057}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AAF6EC25-AF7F-4262-AF57-31E870A1B057}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AAF6EC25-AF7F-4262-AF57-31E870A1B057}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AAF6EC25-AF7F-4262-AF57-31E870A1B057}.Release|Any CPU.Build.0 = Release|Any CPU
{164E1DD7-9227-4CDA-BC19-9761180438AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{164E1DD7-9227-4CDA-BC19-9761180438AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{164E1DD7-9227-4CDA-BC19-9761180438AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{164E1DD7-9227-4CDA-BC19-9761180438AB}.Release|Any CPU.Build.0 = Release|Any CPU
{FB65DDA1-CC62-4A8B-8FAC-D5ED12ABC8C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FB65DDA1-CC62-4A8B-8FAC-D5ED12ABC8C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB65DDA1-CC62-4A8B-8FAC-D5ED12ABC8C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB65DDA1-CC62-4A8B-8FAC-D5ED12ABC8C7}.Release|Any CPU.Build.0 = Release|Any CPU
{AB5F494F-8FF9-42F3-B1B2-237E158D4FCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB5F494F-8FF9-42F3-B1B2-237E158D4FCA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB5F494F-8FF9-42F3-B1B2-237E158D4FCA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB5F494F-8FF9-42F3-B1B2-237E158D4FCA}.Release|Any CPU.Build.0 = Release|Any CPU
{83563838-E9D7-46E0-A75A-791BEA0B21B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{83563838-E9D7-46E0-A75A-791BEA0B21B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{83563838-E9D7-46E0-A75A-791BEA0B21B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{83563838-E9D7-46E0-A75A-791BEA0B21B1}.Release|Any CPU.Build.0 = Release|Any CPU
{6EE6807C-8F10-456C-83FD-88BBC4BDD332}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6EE6807C-8F10-456C-83FD-88BBC4BDD332}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EE6807C-8F10-456C-83FD-88BBC4BDD332}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6EE6807C-8F10-456C-83FD-88BBC4BDD332}.Release|Any CPU.Build.0 = Release|Any CPU
{99CC31AC-0187-48C7-83CF-EB9D049F883E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99CC31AC-0187-48C7-83CF-EB9D049F883E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99CC31AC-0187-48C7-83CF-EB9D049F883E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99CC31AC-0187-48C7-83CF-EB9D049F883E}.Release|Any CPU.Build.0 = Release|Any CPU
{F18413C0-2BAE-47DD-9BEC-1795ACF5CEEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F18413C0-2BAE-47DD-9BEC-1795ACF5CEEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F18413C0-2BAE-47DD-9BEC-1795ACF5CEEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F18413C0-2BAE-47DD-9BEC-1795ACF5CEEF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{8B1BAD7D-878D-4D4D-87EA-48BBD44FE9ED} = {B95F2A1E-93C5-4CB8-847A-1695011B9C6F}
{CC9680C9-FE11-4F33-937D-A2FEB6E0C1E2} = {B95F2A1E-93C5-4CB8-847A-1695011B9C6F}
{AAF6EC25-AF7F-4262-AF57-31E870A1B057} = {B95F2A1E-93C5-4CB8-847A-1695011B9C6F}
{FB65DDA1-CC62-4A8B-8FAC-D5ED12ABC8C7} = {B95F2A1E-93C5-4CB8-847A-1695011B9C6F}
{AB5F494F-8FF9-42F3-B1B2-237E158D4FCA} = {B95F2A1E-93C5-4CB8-847A-1695011B9C6F}
{83563838-E9D7-46E0-A75A-791BEA0B21B1} = {B95F2A1E-93C5-4CB8-847A-1695011B9C6F}
{6EE6807C-8F10-456C-83FD-88BBC4BDD332} = {B95F2A1E-93C5-4CB8-847A-1695011B9C6F}
{99CC31AC-0187-48C7-83CF-EB9D049F883E} = {B95F2A1E-93C5-4CB8-847A-1695011B9C6F}
{F18413C0-2BAE-47DD-9BEC-1795ACF5CEEF} = {B95F2A1E-93C5-4CB8-847A-1695011B9C6F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F708D827-C6F0-4D56-A3C1-F45D8B98F897}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public IActionResult Index()

[HttpGet]
[Route("Error")]
public IActionResult Error(string? message = null)
public IActionResult Error(string message = null)
{
var model = new ErrorViewModel()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using WebApp.Model;
using Azure;
using System.Linq;
using Asp.Versioning;

namespace WebApp.Controllers.api.v1
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using WebApp.Database;
using WebApp.Mapping;
using WebApp.Model;
using Asp.Versioning;

namespace WebApp.Controllers.api.v1
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using AutoMapper;
using Asp.Versioning;
using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Versioning;
using Microsoft.OpenApi.Models;
using System.Reflection;
using System.Text.Json.Serialization;
Expand Down Expand Up @@ -51,17 +51,18 @@ public static IServiceCollection AddAutomapper(this IServiceCollection services)
public static IServiceCollection AddCustomSwagger(this IServiceCollection services, IConfiguration configuration)
{
services.AddEndpointsApiExplorer();
services.AddVersionedApiExplorer(options =>
{
options.GroupNameFormat = "'v'V";
options.SubstituteApiVersionInUrl = true;
});
services.AddApiVersioning(options =>
var apiVersioningBuilder = services.AddApiVersioning(options =>
{
options.ReportApiVersions = true;
options.DefaultApiVersion = new ApiVersion(1, 0);
options.AssumeDefaultVersionWhenUnspecified = true;
options.ApiVersionReader = new MediaTypeApiVersionReader();
});
apiVersioningBuilder.AddApiExplorer(options =>
{
options.GroupNameFormat = "'v'VVV";
options.SubstituteApiVersionInUrl = true;
});
services.AddSwaggerGen(options =>
{
options.ResolveConflictingActions(descriptions =>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public Startup(IConfiguration configuration)
Configuration = configuration;
}

public static IConfiguration? Configuration { get; set; }
public static IConfiguration Configuration { get; set; }

public void ConfigureServices(IServiceCollection services)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
public class ErrorViewModel
{
public string? Message { get; set; }
public string Message { get; set; }
}
}
Loading

0 comments on commit e77347f

Please sign in to comment.