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,130 1/27/2025
1.3.0 228 1/22/2025
1.2.9 129 1/22/2025
1.2.8 114 1/22/2025
1.2.7 188 1/21/2025
1.2.6 220 1/6/2025
1.2.5 140 1/6/2025
1.2.4 314 12/19/2024
1.2.3 126 12/19/2024
1.2.2 130 12/18/2024
1.2.1 135 12/18/2024
1.2.0 125 12/17/2024
1.1.9 133 12/17/2024
1.1.8 117 12/17/2024
1.1.7 130 12/17/2024
1.1.6 125 12/17/2024
1.1.5 116 12/17/2024
1.1.4 142 12/14/2024
1.1.3 133 12/14/2024
1.1.2 387 12/8/2024
1.1.1 135 12/8/2024
1.1.0 129 12/8/2024
1.0.37 129 12/8/2024
1.0.35 132 12/5/2024
1.0.34 210 12/2/2024
1.0.33 123 12/2/2024
1.0.32 125 12/2/2024
1.0.31 115 12/2/2024
1.0.30 117 12/2/2024
1.0.29 128 12/2/2024
1.0.28 144 12/1/2024
1.0.25 129 12/1/2024
1.0.24 133 11/29/2024
1.0.23 108 11/29/2024
1.0.22 200 11/27/2024
1.0.21 126 11/27/2024
1.0.20 128 11/27/2024
1.0.19 162 11/27/2024
1.0.18 127 11/26/2024
1.0.17 140 11/24/2024
1.0.16 132 11/24/2024
1.0.15 130 11/18/2024
1.0.14 127 11/18/2024
1.0.13 114 11/18/2024
1.0.12 148 11/18/2024
1.0.11 120 11/18/2024
1.0.10 130 11/18/2024
1.0.9 112 11/18/2024
1.0.8 124 11/17/2024
1.0.7 118 11/17/2024
1.0.6 128 11/17/2024
1.0.5 114 11/17/2024
1.0.4 127 11/17/2024
1.0.3 120 11/17/2024
1.0.2 130 11/17/2024
1.0.1 118 11/17/2024
1.0.0 125 11/17/2024
0.0.1 118 11/17/2024