Skip to content

Commit 4816c4b

Browse files
Update README.md
1 parent 20f5097 commit 4816c4b

File tree

1 file changed

+45
-66
lines changed

1 file changed

+45
-66
lines changed

README.md

+45-66
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,42 @@
22

33
[![NuGet version](https://badge.fury.io/nu/ServiceQuery.svg)](https://badge.fury.io/nu/ServiceQuery)
44
![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/holomodular-support/5a0fab9a9341bb94e27da49a1e89fd03/raw/servicequery-codecoverage.json)
5-
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-389DA0.svg)](https://opensource.org/licenses/MIT)
66

7-
# ServiceQuery Allows Querying Data Over REST APIs
8-
ServiceQuery, https://ServiceQuery.com, is an open-source library that allows dynamically querying database information over REST APIs. Similar to how OData and GraphQL work, it leverages the power of an expressions builder and a simple model that is capable of serializing query instructions over service boundaries. It supports numerous popular relational (SQL) and document (NoSQL) database engines that expose an IQueryable interface. ServiceQuery builds LINQ expressions using individually mapped functions and parsed data that eliminates injection attacks, so querying your data is safe and secure. This library provides clients and front end applications unprecedented queryability using a standardized endpoint supporting polyglot data access.
7+
# ServiceQuery: Dynamic Data Querying Over REST APIs
8+
## Overview
9+
Welcome to [ServiceQuery](https://ServiceQuery.com), the open-source library designed to revolutionize your data querying over REST APIs. Similar to OData and GraphQL, ServiceQuery harnesses the power of an expression builder and a straightforward model to serialize query instructions across service boundaries. It seamlessly supports a wide array of popular relational (SQL) and document (NoSQL) database engines, ensuring secure and efficient data querying by eliminating injection attacks. With ServiceQuery, your clients and front-end applications gain unprecedented querying capabilities through a standardized endpoint supporting polyglot data access.
910

10-
# Installation Instructions
11-
Install the NuGet Package <b>ServiceQuery</b>
11+
## Get Started
12+
### Installation is simple:
13+
Install the NuGet Package **ServiceQuery**
1214

13-
# Examples
14-
We have numerous examples built using the most popular database storage providers, such as Azure Data Tables, Cosmos DB, MongoDB, MySQL, SQLite, SQL Server, PostgreSQL, Oracle and more!
15-
View all our examples in the [examples](https://github.com/holomodular/ServiceQuery/blob/main/examples) folder in this project.
15+
## Why ServiceQuery?
16+
* **Versatile:** Supports numerous database engines including Azure Data Tables, Cosmos DB, MongoDB, MySQL, SQLite, SQL Server, PostgreSQL, Oracle, and more.
17+
* **Secure:** Builds LINQ expressions using individually mapped functions and parsed data, eliminating injection attacks.
18+
* **Powerful:** Provides clients and front-end applications with unprecedented querying capabilities.
1619

17-
# Feedback
18-
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
20+
## Examples
21+
Explore our [examples folder](https://github.com/holomodular/ServiceQuery/blob/main/examples/V2) for detailed implementations using the most popular database storage providers.
1922

20-
# Simple Example - Dynamic Querying Using Javascript
21-
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/V2/javascript/servicequery.js) javascript file to quickly build request queries in javascript.
23+
## We Value Your Feedback
24+
Join our discussion board to post any questions or issues. Don't forget to star our repository. For direct support, reach us at: Support@HoloModular.com
25+
26+
## Dynamic Querying Made Easy
27+
Here's how you can dynamically query data using JavaScript:
28+
Make sure to include the following [ServiceQuery.js](https://github.com/holomodular/ServiceQuery/blob/main/src/V2/javascript/servicequery.js) javascript file to quickly build request queries in javascript.
2229
```javascript
2330
<script src="/js/servicequery.js"></script>
2431
<script type="text/javascript">
2532

2633
function GetById() {
2734

28-
// Build the request
35+
// Build the request where id = 123
2936
var request = new ServiceQueryRequestBuilder().IsEqual("Id","123").Build();
3037

31-
// Send request to REST API
38+
// Send ajax request to REST Controller
3239
$.ajax({
33-
url: '/api/MyAPI/ExampleServiceQuery',
40+
url: '/ExampleServiceQuery',
3441
data: JSON.stringify(request),
3542
type: "POST",
3643
dataType: 'json',
@@ -44,8 +51,7 @@ Modeled based on LINQ, you create a simple request object that is sent over a RE
4451
}
4552
</script>
4653
```
47-
On the web server, the request is safely converted into IQueryable expressions that can be executed against several different database engines.
48-
The following exposes a REST API POST method that the client will call.
54+
On the server side, convert the request into IQueryable expressions and return the result:
4955
```csharp
5056
using ServiceQuery;
5157

@@ -58,14 +64,15 @@ public ServiceQueryResponse<ExampleTable> ExampleServiceQuery(ServiceQueryReques
5864
}
5965
```
6066

61-
# Documentation
62-
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.
67+
## Documentation
68+
Comprehensive cocumentation is available on our website at http://ServiceQuery.com including tables for supported data types and operations by .NET Framework version and database engine.
6369

6470
## ServiceQuery.AzureDataTables
65-
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.
71+
Azure Data Tables has certain limitations, like lack of support for aggregate functions, string comparisons and ordering.
72+
Our companion NuGet package <b>ServiceQuery.AzureDataTables</b> provides a solution to these limitations, allowing you to use standard operations and execute requests seamlessly. The solution is to download all records and then perform the query using an internal list. See our example project for more information.
6673

6774
## Building and Executing a Query
68-
Building a query is accomplished using the ServiceQueryRequestBuilder object to create the request.
75+
Construct queries using the ServiceQueryRequestBuilder object:
6976
```csharp
7077
using ServiceQuery;
7178

@@ -82,14 +89,14 @@ public void Example()
8289
```
8390

8491
## Supported Operations
85-
Aggregate Functions
92+
### Aggregate Functions
8693
* Average
8794
* Count
8895
* Maximum
8996
* Minimum
9097
* Sum
9198

92-
Comparison Functions
99+
### Comparison Functions
93100
* Between
94101
* Equal
95102
* Not Equal
@@ -100,31 +107,31 @@ Comparison Functions
100107
* In Set
101108
* Not In Set
102109

103-
Comparison Functions (string)
110+
### Comparison Functions (string)
104111
* Contains
105112
* StartsWith
106113
* EndsWith
107114

108-
Grouping Functions
115+
### Grouping Functions
109116
* And
110117
* Or
111118
* Begin
112119
* End
113120

114-
Nullability Functions
121+
### Nullability Functions
115122
* Null
116123
* Not Null
117124

118-
Paging Functions
125+
### Paging Functions
119126
* Page Number
120127
* Page Size
121128
* Include Count
122129

123-
Selecting Functions
130+
### Selecting Functions
124131
* Distinct
125132
* Select
126133

127-
Sorting Functions
134+
### Sorting Functions
128135
* Sort Ascending
129136
* Sort Descending
130137

@@ -196,54 +203,26 @@ If you are using javascript, make sure to download the [ServiceQuery.js](https:/
196203
```
197204

198205
## ServiceQuery Options
199-
We currently provide the following server-side options when processing queries.
206+
Customize server-side query processing with ServiceQueryOptions object:
200207
```csharp
201208
public class ServiceQueryOptions
202209
{
203-
/// <summary>
204-
/// Dictionary list of property name mappings.
205-
/// Exposed Class -> Internal Class
206-
/// Default will use all queryable class property names
207-
/// </summary>
208210
public Dictionary<string, string> PropertyNameMappings { get; set; }
209-
210-
/// <summary>
211-
/// Determine whether property names must be case sensitive or throw an exception.
212-
/// Default is false.
213-
/// </summary>
214211
public bool PropertyNameCaseSensitive { get; set; }
215-
216-
/// <summary>
217-
/// Determine if missing BEGIN/END/AND/OR expressions throw an exception
218-
/// or try to add them missing ones automatiically.
219-
/// </summary>
220212
public bool AllowMissingExpressions { get; set; }
221213
}
222214
```
223215

224216
## Advanced Usage Scenarios
225-
There are many benefits to being able to manipulate queries before they are executed. You could:
226-
227-
* Restrict properties by user roles
228-
229-
When receiving a query, you can use the ServiceQueryOptions to change the list of mapped properties based on the user's security role. If a user specifies a property that is not mapped, such as SSN property, an exception is thrown.
230-
231-
Note: You should restrict properties from select, where and orderby filters so that no information can be obtained, filtered, ordered or gleaned in anyway by its usage.
232-
233-
* Sharding data
234-
235-
When receiving a query, you can add expressions on to the query to make sure that it is only performed against a data segment that you specify, for instance a CustomerKey.
236-
This would be in the format:
237217

238-
**( originalquery ) AND CustomerKey = 123**
218+
### Manipulate queries before executing them
219+
Add to, change or remove filters from incoming queries for business reasons.
239220

240-
To accomplish this on a ServiceQueryRequest object, perform the following operations:
241-
1) Add a BEGIN expressions at the first index of the filters
242-
2) Add an END expression to the end of the list
243-
3) Add an AND expression to the end of the list
244-
4) Add an ISEQUAL for property CustomerKey and value 123
221+
### Restrict properties by user roles
222+
Adjust property mappings based on user role for security.
245223

246-
If the user doesn't pass any where filters, skip steps 1-3. The library will validate queries, ensuring begin and end expressions, their directions and counts match, ensuring users can't craft malicious queries to circumvent this, otherwise an exception is thrown.
224+
### Sharding data
225+
Add expressions to queries to target specific data segments, ensuring efficient data retrieval and enhanced security.
247226

248-
# About
249-
I am a business executive and software architect with over 26 years professional experience. You can reach me via www.linkedin.com/in/danlogsdon or https://HoloModular.com
227+
## About
228+
I am a business executive and software architect with 25+ years professional experience. You can reach me via www.linkedin.com/in/danlogsdon or visit https://HoloModular.com

0 commit comments

Comments
 (0)