CSharp.OpenSource.LinqToKql 1.3.1

dotnet add package CSharp.OpenSource.LinqToKql --version 1.3.1
                    
NuGet\Install-Package CSharp.OpenSource.LinqToKql -Version 1.3.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CSharp.OpenSource.LinqToKql" Version="1.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CSharp.OpenSource.LinqToKql" Version="1.3.1" />
                    
Directory.Packages.props
<PackageReference Include="CSharp.OpenSource.LinqToKql" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CSharp.OpenSource.LinqToKql --version 1.3.1
                    
#r "nuget: CSharp.OpenSource.LinqToKql, 1.3.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CSharp.OpenSource.LinqToKql@1.3.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CSharp.OpenSource.LinqToKql&version=1.3.1
                    
Install as a Cake Addin
#tool nuget:?package=CSharp.OpenSource.LinqToKql&version=1.3.1
                    
Install as a Cake Tool

CSharp.OpenSource.LinqToKql

Nuget Package NuGet Version

Example of using ORMGenerator

Live Example

Generate

var providerExecutor = _mockExecutor.Object;
var ormGenerator = new ORMGenerator(new()
{
    ProviderExecutor = providerExecutor,
    ModelsFolderPath = "../../../../ORMGeneratorTests/Models",
    DbContextFolderPath = "../../../../ORMGeneratorTests",
    DbContextName = "AutoGenORMKustoDbContext",
    Namespace = "AutoGen",
    ModelsNamespace = "AutoGen",
    DbContextNamespace = "AutoGen",
    CreateDbContext = true,
    CleanFolderBeforeCreate = true,
    EnableNullable = true,
    FileScopedNamespaces = true,
    DatabaseConfigs = new List<ORMGeneratorDatabaseConfig>
    {
        new ORMGeneratorDatabaseConfig
        {
            DatabaseName = DbName1,
            Filters = new ORMGeneratorFilterConfig()
        },
        new ORMGeneratorDatabaseConfig
        {
            DatabaseName = DbName2,
            DatabaseDisplayName = "db2",
            Filters = new ORMGeneratorFilterConfig()
        }
    }
});
await _ormGenerator.GenerateAsync();
// output example https://github.com/csharp-opensource/CSharp.OpenSource.LinqToKql/tree/master/Samples/ORMGeneratorTest

Usage

using AutoGen;
using CSharp.OpenSource.LinqToKql.Extensions;
using CSharp.OpenSource.LinqToKql.Http;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();
services.AddKustoDbContext<AutoGenORMKustoDbContext, KustoHttpClient>(sp => new KustoHttpClient("mycluster", "auth", "dbName"));
var provider = services.BuildServiceProvider();
var dbContext = provider.GetRequiredService<AutoGenORMKustoDbContext>();

dbContext.TestTable1.Where(x => x.TestColumn == "test").ToList();
dbContext.db2<object>("customQuery").ToList();
dbContext.func1().ToList();
dbContext.func2("name", "lastName").ToList();

Example of using KustoDbContext

public interface IMyMultiDbContext : IKustoDbContext
{
    IQueryable<SampleObject> SampleObjects { get; }
    IQueryable<SampleObject2> SampleObjects2 { get; }

    IQueryable<SampleObject> Func(int minYear);
    IQueryable<SampleObject> Func2(int minYear);
    IQueryable<SampleObject> Func3(int minYear);
}

public class MyMultiDbContext : KustoDbContext, IMyMultiDbContext
{
    public MyMultiDbContext(IKustoDbContextExecutor<MyMultiDbContext> executor) : base(executor)
    {
    }

    // from default db
    public IQueryable<SampleObject> SampleObjects
        => CreateQuery<SampleObject>("sampleObjects");

    // from different db
    public IQueryable<SampleObject2> SampleObjects2
        => CreateQuery<SampleObject2>("sampleObjects2", database: "diffDb");

    public IQueryable<SampleObject> Func(int minYear)
        => CreateQuery<SampleObject>($"sampleObjects | where year > {minYear}");

    public IQueryable<SampleObject> Func2(int minYear)
        => CreateQuery<SampleObject>($"sampleObjectsByMinYear({minYear})");

    public IQueryable<SampleObject> Func3(int minYear)
        => SampleObjects.Where(x => x.Year > minYear);

    protected override LinqToKQLQueryTranslatorConfig GetConfig() => new() { DisableNestedProjection = true };
}

Example of using KustoHttpClientLinqProviderFactory

using CSharp.OpenSource.LinqToKql.Http;
using CSharp.OpenSource.LinqToKql.Test.Model;

namespace CSharp.OpenSource.LinqToKql.Test.Provider;

public class SampleKustoHttpClientLinqProviderFactory : KustoHttpClientLinqProviderFactory
{
    private string _cluster = "https://myclusterUrl/";
    private string _auth = "myBearerToken";
    private string _defaultDbName = "myDatabaseName";

    public IQueryable<SampleObject> SampleObject
        => CreateQuery<SampleObject>(_cluster, _auth, _defaultDbName, "SampleObjectTable");

    public IQueryable<SampleObject> SampleObjectFunction(long number)
        => CreateQuery<SampleObject>(_cluster, _auth, _defaultDbName, $"SampleObjectFunction({number})");

    public IQueryable<SampleObject2> SampleObject2(long number)
        => CreateQuery<SampleObject2>(_cluster, _auth, _defaultDbName, $"SampleObject2Table");
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.1 2,105 1/27/2025
1.3.0 226 1/22/2025
1.2.9 128 1/22/2025
1.2.8 112 1/22/2025
1.2.7 185 1/21/2025
1.2.6 213 1/6/2025
1.2.5 137 1/6/2025
1.2.4 313 12/19/2024
1.2.3 122 12/19/2024
1.2.2 128 12/18/2024
1.2.1 133 12/18/2024
1.2.0 124 12/17/2024
1.1.9 131 12/17/2024
1.1.8 115 12/17/2024
1.1.7 128 12/17/2024
1.1.6 124 12/17/2024
1.1.5 114 12/17/2024
1.1.4 139 12/14/2024
1.1.3 131 12/14/2024
1.1.2 386 12/8/2024
1.1.1 133 12/8/2024
1.1.0 126 12/8/2024
1.0.37 127 12/8/2024
1.0.35 130 12/5/2024
1.0.34 208 12/2/2024
1.0.33 121 12/2/2024
1.0.32 123 12/2/2024
1.0.31 113 12/2/2024
1.0.30 114 12/2/2024
1.0.29 122 12/2/2024
1.0.28 143 12/1/2024
1.0.25 128 12/1/2024
1.0.24 131 11/29/2024
1.0.23 107 11/29/2024
1.0.22 196 11/27/2024
1.0.21 122 11/27/2024
1.0.20 126 11/27/2024
1.0.19 161 11/27/2024
1.0.18 122 11/26/2024
1.0.17 137 11/24/2024
1.0.16 131 11/24/2024
1.0.15 128 11/18/2024
1.0.14 123 11/18/2024
1.0.13 112 11/18/2024
1.0.12 141 11/18/2024
1.0.11 118 11/18/2024
1.0.10 127 11/18/2024
1.0.9 110 11/18/2024
1.0.8 122 11/17/2024
1.0.7 114 11/17/2024
1.0.6 125 11/17/2024
1.0.5 113 11/17/2024
1.0.4 125 11/17/2024
1.0.3 119 11/17/2024
1.0.2 127 11/17/2024
1.0.1 117 11/17/2024
1.0.0 123 11/17/2024
0.0.1 117 11/17/2024