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,068 1/27/2025
1.3.0 206 1/22/2025
1.2.9 108 1/22/2025
1.2.8 102 1/22/2025
1.2.7 175 1/21/2025
1.2.6 198 1/6/2025
1.2.5 117 1/6/2025
1.2.4 293 12/19/2024
1.2.3 112 12/19/2024
1.2.2 108 12/18/2024
1.2.1 113 12/18/2024
1.2.0 114 12/17/2024
1.1.9 111 12/17/2024
1.1.8 105 12/17/2024
1.1.7 108 12/17/2024
1.1.6 114 12/17/2024
1.1.5 104 12/17/2024
1.1.4 129 12/14/2024
1.1.3 111 12/14/2024
1.1.2 365 12/8/2024
1.1.1 113 12/8/2024
1.1.0 106 12/8/2024
1.0.37 107 12/8/2024
1.0.35 110 12/5/2024
1.0.34 198 12/2/2024
1.0.33 100 12/2/2024
1.0.32 103 12/2/2024
1.0.31 103 12/2/2024
1.0.30 114 12/2/2024
1.0.29 112 12/2/2024
1.0.28 113 12/1/2024
1.0.25 108 12/1/2024
1.0.24 111 11/29/2024
1.0.23 107 11/29/2024
1.0.22 186 11/27/2024
1.0.21 102 11/27/2024
1.0.20 106 11/27/2024
1.0.19 141 11/27/2024
1.0.18 119 11/26/2024
1.0.17 117 11/24/2024
1.0.16 111 11/24/2024
1.0.15 108 11/18/2024
1.0.14 103 11/18/2024
1.0.13 102 11/18/2024
1.0.12 118 11/18/2024
1.0.11 108 11/18/2024
1.0.10 107 11/18/2024
1.0.9 100 11/18/2024
1.0.8 102 11/17/2024
1.0.7 103 11/17/2024
1.0.6 105 11/17/2024
1.0.5 103 11/17/2024
1.0.4 105 11/17/2024
1.0.3 109 11/17/2024
1.0.2 107 11/17/2024
1.0.1 107 11/17/2024
1.0.0 113 11/17/2024
0.0.1 106 11/17/2024