<commit_before># Newq

[![Build Status][travis-image]][travis-url]
[![NuGet Version][nuget-image]][nuget-url]

A new query builder for CSharp on .NET and Mono.

## Usage

```csharp
var queryBuilder = new QueryBuilder();

queryBuilder
    .Select<Customer>((target, context) => {
        target += context["Provider", "Products"];
    })

    .LeftJoin<Provider>((on, context) => {
        on += context["Customer", "Name"] == context["Provider", "Name"];
    })

    .Where((filter, context) => {
        filter += context["Customer", "City"].Like("New");
    })

    .GroupBy((target, context) => {
        target += context["Provider", "Products"];
    })

    .Having((filter, context) => {
        filter += context["Provider", "Name"].NotLike("New");
    })

    .OrderBy((target, context) => {
        target += context["Customer", "Name", SortOrder.Desc];
    });

    queryBuilder.Paginate(new Paginator());

    var result = queryBuilder.ToString();

    /* result:

    SELECT
        [Provider.Products]
        ,[Customer.Name]
    FROM (
        SELECT
            ROW_NUMBER() OVER(ORDER BY [Customer.Name] DESC) AS [$ROW_NUMBER]
            ,[Provider.Products]
            ,[Customer.Name]
        FROM (
            SELECT
                [Provider].[Products] AS [Provider.Products]
                ,[Customer].[Name] AS [Customer.Name]
            FROM
                [Customer]
            LEFT JOIN
                [Provider]
            ON
                [Customer].[Name] = [Provider].[Name]
            WHERE
                [Customer].[City] LIKE '%New%'
            GROUP BY
                [Provider].[Products]
            HAVING
                [Provider].[Name] NOT LIKE '%New%'
        ) AS [$ORIGINAL_QUERY]
    ) AS [$PAGINATOR]
    WHERE
        [$PAGINATOR].[$ROW_NUMBER] BETWEEN 1 AND 10

    */
```

## Installation

To install, run the following command in the `Package Manager Console`:

```
PM> Install-Package Newq
```

## License

```
Copyright 2015-2016 <NAME> and <NAME>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```

[travis-image]: https://travis-ci.org/apemost/Newq.svg?branch=master
[travis-url]: https://travis-ci.org/apemost/Newq
[nuget-image]: http://img.shields.io/nuget/v/Newq.svg?style=flat
[nuget-url]: https://www.nuget.org/packages/Newq/<commit_msg>Docs: add appveyor status badge<commit_after># Newq

[![Build Status][travis-image]][travis-url]
[![Build Status][appveyor-image]][appveyor-url]
[![NuGet Version][nuget-image]][nuget-url]

A new query builder for CSharp on .NET and Mono.

## Usage

```csharp
var queryBuilder = new QueryBuilder();

queryBuilder
    .Select<Customer>((target, context) => {
        target += context["Provider", "Products"];
    })

    .LeftJoin<Provider>((on, context) => {
        on += context["Customer", "Name"] == context["Provider", "Name"];
    })

    .Where((filter, context) => {
        filter += context["Customer", "City"].Like("New");
    })

    .GroupBy((target, context) => {
        target += context["Provider", "Products"];
    })

    .Having((filter, context) => {
        filter += context["Provider", "Name"].NotLike("New");
    })

    .OrderBy((target, context) => {
        target += context["Customer", "Name", SortOrder.Desc];
    });

    queryBuilder.Paginate(new Paginator());

    var result = queryBuilder.ToString();

    /* result:

    SELECT
        [Provider.Products]
        ,[Customer.Name]
    FROM (
        SELECT
            ROW_NUMBER() OVER(ORDER BY [Customer.Name] DESC) AS [$ROW_NUMBER]
            ,[Provider.Products]
            ,[Customer.Name]
        FROM (
            SELECT
                [Provider].[Products] AS [Provider.Products]
                ,[Customer].[Name] AS [Customer.Name]
            FROM
                [Customer]
            LEFT JOIN
                [Provider]
            ON
                [Customer].[Name] = [Provider].[Name]
            WHERE
                [Customer].[City] LIKE '%New%'
            GROUP BY
                [Provider].[Products]
            HAVING
                [Provider].[Name] NOT LIKE '%New%'
        ) AS [$ORIGINAL_QUERY]
    ) AS [$PAGINATOR]
    WHERE
        [$PAGINATOR].[$ROW_NUMBER] BETWEEN 1 AND 10

    */
```

## Installation

To install, run the following command in the `Package Manager Console`:

```
PM> Install-Package Newq
```

## License

```
Copyright 2015-2016 <NAME> and <NAME>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```

[travis-image]: https://travis-ci.org/apemost/Newq.svg?branch=master
[travis-url]: https://travis-ci.org/apemost/Newq
[appveyor-image]: https://ci.appveyor.com/api/projects/status/4trdjumrr47e6213/branch/master?svg=true
[appveyor-url]: https://ci.appveyor.com/project/apemost/newq/branch/master
[nuget-image]: http://img.shields.io/nuget/v/Newq.svg?style=flat
[nuget-url]: https://www.nuget.org/packages/Newq/
{'fraction_non_alphanumeric': 0.14540772532188842, 'fraction_numerical': 0.006351931330472103, 'mean_word_length': 2.591861898890259, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 25, 'https://': 8, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4453485', 'n_tokens_mistral': 1850, 'n_tokens_neox': 1694, 'n_words': 451}