├── jetbrains.png
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE.md
├── CONTRIBUTING.md
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ └── build.yml
├── src
└── DynamicQueryable
│ ├── icon.png
│ ├── DynamicQueryable.Compare.cs
│ ├── DynamicQueryable.Alter.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── DynamicQueryable.csproj
│ ├── DynamicQueryable.Count.cs
│ ├── DynamicQueryable.Look.cs
│ ├── DynamicQueryable.Select.cs
│ ├── DynamicQueryable.cs
│ ├── DynamicQueryable.Filter.cs
│ ├── DynamicQueryable.Group.cs
│ ├── DynamicQueryable.Order.cs
│ ├── DynamicQueryable.Join.cs
│ ├── DynamicQueryable.Aggregate.cs
│ └── DynamicQueryable.Get.cs
├── test
└── DynamicQueryable.Tests
│ ├── Fixture
│ ├── Entity.cs
│ ├── Address.cs
│ ├── Company.cs
│ ├── Product.cs
│ ├── Person.cs
│ ├── Order.cs
│ └── OrderLine.cs
│ ├── DynamicQueryable.Tests.csproj
│ └── ExpressionTests.cs
├── .idea
└── .idea.DynamicQueryable
│ └── .idea
│ ├── encodings.xml
│ ├── vcs.xml
│ ├── indexLayout.xml
│ └── .gitignore
├── .gitignore
├── omnisharp.json
├── LICENSE
├── Dockerfile
├── README.md
├── DynamicQueryable.sln
└── notebooks
└── README.ipynb
/jetbrains.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutozel/DynamicQueryable/HEAD/jetbrains.png
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [umutozel]
4 | patreon: umutozel
5 |
--------------------------------------------------------------------------------
/src/DynamicQueryable/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/umutozel/DynamicQueryable/HEAD/src/DynamicQueryable/icon.png
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## DynamicQueryable version
2 |
3 |
4 | ## Steps to reproduce
5 |
6 |
7 | ## Expected behavior
8 |
9 |
10 | ## Actual behavior
11 |
--------------------------------------------------------------------------------
/test/DynamicQueryable.Tests/Fixture/Entity.cs:
--------------------------------------------------------------------------------
1 | namespace DynamicQueryable.Tests.Fixture;
2 |
3 | public class Entity {
4 | public bool IsActive { get; set; }
5 | public int IsSomething { get; set; }
6 | }
7 |
--------------------------------------------------------------------------------
/.idea/.idea.DynamicQueryable/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/.idea.DynamicQueryable/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/test/DynamicQueryable.Tests/Fixture/Address.cs:
--------------------------------------------------------------------------------
1 | namespace DynamicQueryable.Tests.Fixture;
2 |
3 | public class Address {
4 | public string City { get; set; } = "";
5 | public int Zip { get; set; }
6 | public int? Number { get; set; }
7 | }
8 |
--------------------------------------------------------------------------------
/test/DynamicQueryable.Tests/Fixture/Company.cs:
--------------------------------------------------------------------------------
1 | namespace DynamicQueryable.Tests.Fixture;
2 |
3 | public class Company {
4 | public int Id { get; set; }
5 | public string? CompanyName { get; set; }
6 | public string? Phone { get; set; }
7 | }
8 |
--------------------------------------------------------------------------------
/test/DynamicQueryable.Tests/Fixture/Product.cs:
--------------------------------------------------------------------------------
1 | namespace DynamicQueryable.Tests.Fixture;
2 |
3 | public class Product {
4 | public int Id { get; set; }
5 | public string? Name { get; set; }
6 | public Company? Supplier { get; set; }
7 | }
8 |
--------------------------------------------------------------------------------
/.idea/.idea.DynamicQueryable/.idea/indexLayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/test/DynamicQueryable.Tests/Fixture/Person.cs:
--------------------------------------------------------------------------------
1 | namespace DynamicQueryable.Tests.Fixture;
2 |
3 | public class Person {
4 | public string Name { get; set; } = "";
5 | public int Age { get; set; }
6 | public int? Number { get; set; }
7 | public Address Address { get; set; } = new();
8 | }
9 |
--------------------------------------------------------------------------------
/.idea/.idea.DynamicQueryable/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Rider ignored files
5 | /modules.xml
6 | /projectSettingsUpdater.xml
7 | /.idea.DynamicQueryable.iml
8 | /contentModel.xml
9 | # Editor-based HTTP Client requests
10 | /httpRequests/
11 | # Datasource local storage ignored files
12 | /dataSources/
13 | /dataSources.local.xml
14 |
--------------------------------------------------------------------------------
/test/DynamicQueryable.Tests/Fixture/Order.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace DynamicQueryable.Tests.Fixture;
5 |
6 | public class Order {
7 | public int Id { get; set; }
8 | public string? OrderNo { get; set; }
9 | public DateTime? OrderDate { get; set; }
10 | public double? Price;
11 | public IList Lines { get; set; } = [];
12 | }
13 |
--------------------------------------------------------------------------------
/test/DynamicQueryable.Tests/Fixture/OrderLine.cs:
--------------------------------------------------------------------------------
1 | namespace DynamicQueryable.Tests.Fixture;
2 |
3 | public class OrderLine {
4 | public int Id { get; set; }
5 | public Product? Product;
6 | public int ProductId { get; set; }
7 | public Order? Order { get; set; }
8 | public int OrderId { get; set; }
9 | public int? Count { get; set; }
10 | public double? UnitPrice { get; set; }
11 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.swp
2 | *.*~
3 | project.lock.json
4 | .DS_Store
5 | *.pyc
6 | nupkg/
7 |
8 | # Visual Studio Code
9 | .vscode
10 |
11 | # User-specific files
12 | *.suo
13 | *.user
14 | *.userosscache
15 | *.sln.docstates
16 |
17 | # Build results
18 | [Dd]ebug/
19 | [Dd]ebugPublic/
20 | [Rr]elease/
21 | [Rr]eleases/
22 | x64/
23 | x86/
24 | build/
25 | bld/
26 | [Bb]in/
27 | [Oo]bj/
28 | [Oo]ut/
29 | msbuild.log
30 | msbuild.err
31 | msbuild.wrn
32 |
33 | # Visual Studio 2015
34 | .vs/
35 |
36 | # Coverage
37 | coverage.json
38 | coverage.xml
39 | lcov.info
40 | .ipynb_checkpoints
41 |
--------------------------------------------------------------------------------
/omnisharp.json:
--------------------------------------------------------------------------------
1 | {
2 | "FormattingOptions": {
3 | "NewLinesForBracesInLambdaExpressionBody": false,
4 | "NewLinesForBracesInAnonymousMethods": false,
5 | "NewLinesForBracesInAnonymousTypes": false,
6 | "NewLinesForBracesInControlBlocks": false,
7 | "NewLinesForBracesInTypes": false,
8 | "NewLinesForBracesInMethods": false,
9 | "NewLinesForBracesInProperties": false,
10 | "NewLinesForBracesInAccessors": false,
11 | "NewLineForElse": false,
12 | "NewLineForCatch": false,
13 | "NewLineForFinally": false
14 | }
15 | }
--------------------------------------------------------------------------------
/src/DynamicQueryable/DynamicQueryable.Compare.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | // ReSharper disable once CheckNamespace
4 | namespace System.Linq.Dynamic;
5 |
6 | public static partial class DynamicQueryable {
7 |
8 | public static IQueryable Except(this IQueryable source, IEnumerable items)
9 | => HandleConstant(source, "Except", items);
10 |
11 | public static IQueryable Intersect(this IQueryable source, IEnumerable items)
12 | => HandleConstant(source, "Intersect", items);
13 |
14 | public static IQueryable Union(this IQueryable source, IEnumerable items)
15 | => HandleConstant(source, "Union", items);
16 |
17 | public static IQueryable Concat(this IQueryable source, IEnumerable items)
18 | => HandleConstant(source, "Concat", items);
19 | }
20 |
--------------------------------------------------------------------------------
/src/DynamicQueryable/DynamicQueryable.Alter.cs:
--------------------------------------------------------------------------------
1 | // ReSharper disable once CheckNamespace
2 | namespace System.Linq.Dynamic;
3 |
4 | public static partial class DynamicQueryable {
5 |
6 | public static IQueryable Take(this IQueryable source, int count)
7 | => HandleConstant(source, "Take", count);
8 |
9 | public static IQueryable Skip(this IQueryable source, int count)
10 | => HandleConstant(source, "Skip", count);
11 |
12 | public static IQueryable Distinct(this IQueryable source)
13 | => Handle(source, "Distinct");
14 |
15 | public static IQueryable Reverse(this IQueryable source)
16 | => Handle(source, "Reverse");
17 |
18 | public static IQueryable DefaultIfEmpty(this IQueryable source)
19 | => Handle(source, "DefaultIfEmpty");
20 |
21 | public static IQueryable DefaultIfEmpty(this IQueryable source, object defaultValue)
22 | => HandleConstant(source, "DefaultIfEmpty", defaultValue);
23 | }
24 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ## How to contribute to DynamicQueryable
2 |
3 | #### **Did you find a bug?**
4 | * Go on, open an [Issue](https://github.com/umutozel/DynamicQueryable/issues/new).
5 |
6 | * *Ensure the bug was not already reported* by searching on GitHub under [Issues](https://github.com/umutozel/DynamicQueryable/issues).
7 |
8 | #### **Did you write a patch that fixes a bug?**
9 |
10 | * Open a new GitHub pull request with the patch.
11 |
12 | * Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
13 |
14 | #### **Did you fix whitespace, format code, or make a purely cosmetic patch?**
15 |
16 | Unless we really loved the style, or we missed something out of the norm and you catched it, we won't accept the pull request, sorry!
17 |
18 | #### **Do you have questions about the source code?**
19 |
20 | [Be a good open source citizen!](https://hackernoon.com/being-a-good-open-source-citizen-9060d0ab9732)
21 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## Change list
2 |
3 | *Please provide briefly described change list which are you going to propose.*
4 |
5 | ## Types of changes
6 |
7 | What types of changes are you proposing/introducing?
8 | _Put an `x` in the boxes that apply_
9 |
10 | - [ ] Bugfix (non-breaking change which fixes an issue)
11 | - [ ] New feature (non-breaking change which adds functionality)
12 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
13 |
14 | ## Details
15 |
16 | Please provide more details about changes if it is necessary. If there are new features you can provide code samples which show the way they
17 | work and possible use cases. Also you can create [gists](https://gist.github.com) with pasted C# code samples or put them here using markdown.
18 | About markdown please read [Mastering markdown](https://guides.github.com/features/mastering-markdown/) and [Writing on GitHub](https://help.github.com/categories/writing-on-github/)
19 |
--------------------------------------------------------------------------------
/src/DynamicQueryable/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("DynamicQueryable - Construct Linq queries using strings.")]
8 | [assembly: AssemblyDescription("Construct Linq queries using strings.")]
9 | #if DEBUG
10 | [assembly: AssemblyConfiguration("Debug")]
11 | #else
12 | [assembly: AssemblyConfiguration("Release")]
13 | #endif
14 | [assembly: AssemblyCompany("Umut Özel")]
15 | [assembly: AssemblyProduct("DynamicQueryable")]
16 | [assembly: AssemblyCopyright("Copyright © 2018")]
17 | [assembly: AssemblyTrademark("")]
18 | [assembly: AssemblyCulture("")]
19 |
20 | // Setting ComVisible to false makes the types in this assembly not visible
21 | // to COM components. If you need to access a type in this assembly from
22 | // COM, set the ComVisible attribute to true on that type.
23 | [assembly: ComVisible(false)]
24 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Umut Ozel
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/DynamicQueryable/DynamicQueryable.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | 2.1.0
6 | false
7 | Umut Özel
8 | Construct Linq queries using strings.
9 | Copyright (c) 2018
10 | MIT
11 | https://github.com/umutozel/DynamicQueryable
12 | icon.png
13 | csharp expression linq string dynamic iqueryable
14 | https://github.com/umutozel/DynamicQueryable
15 | git
16 | 13
17 | enable
18 | full
19 | True
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/test/DynamicQueryable.Tests/DynamicQueryable.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net9.0
5 | false
6 | 13
7 | enable
8 |
9 |
10 |
11 |
12 | all
13 | runtime; build; native; contentfiles; analyzers; buildtransitive
14 |
15 |
16 |
17 |
18 |
19 | all
20 | runtime; build; native; contentfiles; analyzers; buildtransitive
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/DynamicQueryable/DynamicQueryable.Count.cs:
--------------------------------------------------------------------------------
1 | using Jokenizer.Net;
2 | using VarType = System.Collections.Generic.IDictionary;
3 |
4 | // ReSharper disable once CheckNamespace
5 | namespace System.Linq.Dynamic;
6 |
7 | public static partial class DynamicQueryable {
8 |
9 | public static int Count(this IQueryable source, string? predicate = null, params object[] values)
10 | => Count(source, predicate, null, null, values);
11 |
12 | public static int Count(this IQueryable source, string predicate, Settings settings, params object[] values)
13 | => Count(source, predicate, null, settings, values);
14 |
15 | public static int Count(this IQueryable source, string predicate, VarType variables, params object[] values)
16 | => Count(source, predicate, variables, null, values);
17 |
18 | public static int Count(this IQueryable source, string? predicate, VarType? variables, Settings? settings, params object[] values)
19 | => (int)ExecuteOptionalExpression(source, "Count", predicate, string.IsNullOrEmpty(predicate), variables, values, settings)!;
20 |
21 | public static long LongCount(this IQueryable source, string? predicate = null, params object[] values)
22 | => LongCount(source, predicate, null, null, values);
23 |
24 | public static long LongCount(this IQueryable source, string predicate, Settings settings, params object[] values)
25 | => LongCount(source, predicate, null, settings, values);
26 |
27 | public static long LongCount(this IQueryable source, string predicate, VarType variables, params object[] values)
28 | => LongCount(source, predicate, variables, null, values);
29 |
30 | public static long LongCount(this IQueryable source, string? predicate, VarType? variables, Settings? settings, params object[] values)
31 | => (long)ExecuteOptionalExpression(source, "LongCount", predicate, string.IsNullOrEmpty(predicate), variables, values, settings)!;
32 | }
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM jupyter/scipy-notebook:7a0c7325e470
2 |
3 | # .NET SDK versiyonunu ayarla
4 | ENV DOTNET_SDK_VERSION 9.0.200
5 |
6 | # Kullanıcı ve UID ayarları
7 | ARG NB_USER=jovyan
8 | ARG NB_UID=1000
9 | ENV USER ${NB_USER}
10 | ENV NB_UID ${NB_UID}
11 | ENV HOME /home/${NB_USER}
12 |
13 | WORKDIR ${HOME}
14 |
15 | USER root
16 | RUN apt-get update && apt-get install -y curl
17 |
18 | # Install .NET CLI dependencies
19 | RUN apt-get install -y --no-install-recommends \
20 | libc6 \
21 | libgcc1 \
22 | libgssapi-krb5-2 \
23 | libicu60 \
24 | libssl1.1 \
25 | libstdc++6 \
26 | zlib1g
27 |
28 | RUN rm -rf /var/lib/apt/lists/*
29 |
30 | # Install .NET Core SDK
31 | RUN curl -SL --output dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz \
32 | && mkdir -p /usr/share/dotnet \
33 | && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
34 | && rm dotnet.tar.gz \
35 | && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
36 |
37 | # PATH güncellemesi
38 | ENV PATH="${PATH}:/root/.dotnet/tools"
39 |
40 | # .NET Interactive'i yükle
41 | RUN dotnet tool install -g Microsoft.dotnet-interactive
42 | RUN dotnet tool install -g Microsoft.dotnet-try
43 |
44 | # Jupyter ile etkileşimi sağlamak için kernel kurulumunu yap
45 | RUN dotnet interactive jupyter install
46 |
47 | # Global araçlar için PATH güncellemesi
48 | ENV PATH="${PATH}:/root/.dotnet/tools"
49 |
50 | # Notebooks dosyalarını kopyala
51 | COPY ./notebooks/ ${HOME}/notebooks/
52 |
53 | # NuGet kaynaklarını kopyala (eğer varsa)
54 | COPY ./NuGet.config ${HOME}/nuget.config
55 |
56 | # Kullanıcı sahipliğini ayarla
57 | RUN chown -R ${NB_UID} ${HOME}
58 |
59 | # Jupyter'ı kullanıcı olarak çalıştır
60 | USER ${USER}
61 |
62 | # Notebook dizinine geç
63 | WORKDIR ${HOME}/notebooks/
64 |
65 | # Varsayılan Jupyter portunu aç
66 | EXPOSE 8888
67 |
68 | # Jupyter'i başlat
69 | CMD ["start-notebook.sh"]
70 |
--------------------------------------------------------------------------------
/src/DynamicQueryable/DynamicQueryable.Look.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Jokenizer.Net;
3 | using VarType = System.Collections.Generic.IDictionary;
4 |
5 | // ReSharper disable once CheckNamespace
6 | namespace System.Linq.Dynamic;
7 |
8 | public static partial class DynamicQueryable {
9 |
10 | public static bool All(this IQueryable source, string? predicate = null, params object[] values)
11 | => All(source, predicate, null, null, values);
12 |
13 | public static bool All(this IQueryable source, string predicate, Settings settings, params object[] values)
14 | => All(source, predicate, null, settings, values);
15 |
16 | public static bool All(this IQueryable source, string predicate, VarType variables, params object[] values)
17 | => All(source, predicate, variables, null, values);
18 |
19 | public static bool All(this IQueryable source, string? predicate, VarType? variables, Settings? settings, params object[] values)
20 | => (bool)ExecuteLambda(source, "All", predicate, false, variables, values, settings)!;
21 |
22 | public static bool Any(this IQueryable source, string? predicate = null, params object[] values)
23 | => Any(source, predicate, null, null, values);
24 |
25 | public static bool Any(this IQueryable source, string predicate, Settings settings, params object[] values)
26 | => Any(source, predicate, null, settings, values);
27 |
28 | public static bool Any(this IQueryable source, string predicate, VarType variables, params object[] values)
29 | => Any(source, predicate, variables, null, values);
30 |
31 | public static bool Any(this IQueryable source, string? predicate, VarType? variables, Settings? settings, params object[] values)
32 | => (bool)ExecuteOptionalExpression(source, "Any", predicate, string.IsNullOrEmpty(predicate), variables, values, settings)!;
33 |
34 | public static bool Contains(this IQueryable source, object item)
35 | => (bool)ExecuteConstant(source, "Contains", item)!;
36 |
37 | public static bool SequenceEqual(this IQueryable source, IEnumerable