Webrox.EntityFrameworkCore.MySql
2.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Webrox.EntityFrameworkCore.MySql --version 2.0.0
NuGet\Install-Package Webrox.EntityFrameworkCore.MySql -Version 2.0.0
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="Webrox.EntityFrameworkCore.MySql" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Webrox.EntityFrameworkCore.MySql --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Webrox.EntityFrameworkCore.MySql, 2.0.0"
#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.
// Install Webrox.EntityFrameworkCore.MySql as a Cake Addin #addin nuget:?package=Webrox.EntityFrameworkCore.MySql&version=2.0.0 // Install Webrox.EntityFrameworkCore.MySql as a Cake Tool #tool nuget:?package=Webrox.EntityFrameworkCore.MySql&version=2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Webrox.EntityFrameworkCore
Use the repo on GitHub to create issues and feature requests.
Features
Implement various Linq functions with Entity Framework Core
SQL | Linq |
---|---|
ROW_NUMBER |
EF.Functions.RowNumber |
ROW_NUMBER |
Select((entity, index)=>...) |
RANK |
EF.Functions.Rank |
DENSE_RANK |
EF.Functions.DenseRank |
AVG |
EF.Functions.Average |
SUM |
EF.Functions.Sum |
MIN |
EF.Functions.Min |
MAX |
EF.Functions.Max |
Supported providers :
Provider | Nuget Package | Version | .net 6 | .net 7 | .net 8 |
---|---|---|---|---|---|
SQL Server | Microsoft.EntityFrameworkCore.SqlServer | ✔️ EF6 | ✔️ + EF7 | ✔️ + EF8 | |
SQLite | Microsoft.EntityFrameworkCore.Sqlite | ✔️ + EF6 | ✔️ + EF7 | ✔️ + EF8 | |
MySQL | MySql.EntityFrameworkCore | ✔️ + EF6 | ✔️ + EF7 | ❌ (waiting for Oracle EF8 support) | |
PostgreSQL | Npgsql.EntityFrameworkCore.PostgreSQL | ✔️ + EF6 | ✔️ + EF7 | ✔️ + EF8 |
Setup
SQLServer
using Webrox.EntityFrameworkCore.SqlServer;
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
// SQL Server
optionsBuilder.UseSqlServer("connectionstring", opts |
{
opts.AddWebroxFeatures();
});
}
MySQL
using Webrox.EntityFrameworkCore.MySql;
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseMySQL("connectionstring", opts |
{
opts.AddWebroxFeatures();
});
}
SQLite
using Webrox.EntityFrameworkCore.Sqlite;
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite("connectionstring", opts |
{
opts.AddWebroxFeatures();
});
}
PostgreSQL
using Webrox.EntityFrameworkCore.Postgres;
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseNpgsql("connectionstring", opts |
{
opts.AddWebroxFeatures();
});
}
Functions Usage
RowNumber Syntax {#RowNumber}
EF Functions
using Webrox.EntityFrameworkCore.[Provider];
// simple RowNumber + OrderBy
context.Table1.Select(t => new
{
Id = t.Id,
RowNumber = EF.Functions.RowNumber(EF.Functions.OrderBy(t.Id))
}
// complex RowNumber + PartitionBy + OrderBy
context.Table1.Select(t => new
{
Id = t.Id,
RowNumber = EF.Functions.RowNumber(
EF.Functions.PartitionBy(t.GroupId)
.ThenPartitionBy(t.SubGroupId),
EF.Functions.OrderByDescending(t.Id)
.ThenBy(t.SubId)
)
}
Linq Select syntax {#RowNumber-Select-Syntax}
You can also use the function Select((e, index)=>{}) to access RowNumber.
It will not be ordered or partitionned and the parameter "index" is int.
context.Table1.Select((t, index) => new
{
Id = t.Id,
RowNumber = index
}
Rank Syntax {#Rank}
using Webrox.EntityFrameworkCore.[Provider];
// simple Rank + OrderBy
context.Table1.Select(t => new
{
Id = t.Id,
Rank = EF.Functions.Rank(EF.Functions.OrderBy(t.Id))
}
// complex Rank + PartitionBy + OrderBy
context.Table1.Select(t => new
{
Id = t.Id,
Rank = EF.Functions.Rank(
EF.Functions.PartitionBy(t.GroupId)
.ThenPartitionBy(t.SubGroupId),
EF.Functions.OrderByDescending(t.Id)
.ThenBy(t.SubId)
)
}
DenseRank Syntax {#DenseRank}
using Webrox.EntityFrameworkCore.[Provider];
// simple DenseRank + OrderBy
context.Table1.Select(t => new
{
Id = t.Id,
DenseRank = EF.Functions.DenseRank(EF.Functions.OrderBy(t.Id))
}
// complex DenseRank + PartitionBy + OrderBy
context.Table1.Select(t => new
{
Id = t.Id,
DenseRank = EF.Functions.DenseRank(
EF.Functions.PartitionBy(t.GroupId)
.ThenPartitionBy(t.SubGroupId),
EF.Functions.OrderByDescending(t.Id)
.ThenBy(t.SubId)
)
}
Average Syntax {#Average}
using Webrox.EntityFrameworkCore.[Provider];
// simple Average + OrderBy
context.Table1.Select(t => new
{
Id = t.Id,
Average = EF.Functions.Average(EF.Functions.OrderBy(t.Id))
}
// complex Average + PartitionBy + OrderBy
context.Table1.Select(t => new
{
Id = t.Id,
Average = EF.Functions.Average(
EF.Functions.PartitionBy(t.GroupId)
.ThenPartitionBy(t.SubGroupId),
EF.Functions.OrderByDescending(t.Id)
.ThenBy(t.SubId)
)
}
Sum Syntax {#Sum}
using Webrox.EntityFrameworkCore.[Provider];
// simple Sum + OrderBy
context.Table1.Select(t => new
{
Id = t.Id,
Sum = EF.Functions.Sum(EF.Functions.OrderBy(t.Id))
}
// complex Sum + PartitionBy + OrderBy
context.Table1.Select(t => new
{
Id = t.Id,
Sum = EF.Functions.Sum(
EF.Functions.PartitionBy(t.GroupId)
.ThenPartitionBy(t.SubGroupId),
EF.Functions.OrderByDescending(t.Id)
.ThenBy(t.SubId)
)
}
Min Syntax {#Min}
using Webrox.EntityFrameworkCore.[Provider];
// simple Min + OrderBy
context.Table1.Select(t => new
{
Id = t.Id,
Min = EF.Functions.Min(EF.Functions.OrderBy(t.Id))
}
// complex Min + PartitionBy + OrderBy
context.Table1.Select(t => new
{
Id = t.Id,
Min = EF.Functions.Min(
EF.Functions.PartitionBy(t.GroupId)
.ThenPartitionBy(t.SubGroupId),
EF.Functions.OrderByDescending(t.Id)
.ThenBy(t.SubId)
)
}
Max Syntax {#Max}
using Webrox.EntityFrameworkCore.[Provider];
// simple Max + OrderBy
context.Table1.Select(t => new
{
Id = t.Id,
Max = EF.Functions.Max(EF.Functions.OrderBy(t.Id))
}
// complex Max + PartitionBy + OrderBy
context.Table1.Select(t => new
{
Id = t.Id,
Max = EF.Functions.Max(
EF.Functions.PartitionBy(t.GroupId)
.ThenPartitionBy(t.SubGroupId),
EF.Functions.OrderByDescending(t.Id)
.ThenBy(t.SubId)
)
}
Product | Versions 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Microsoft.EntityFrameworkCore (>= 6.0.0)
- Microsoft.EntityFrameworkCore.Relational (>= 6.0.0)
- MySql.EntityFrameworkCore (>= 6.0.0)
- MySql.EntityFrameworkCore.Design.Tests (>= 1.0.0)
- Webrox.EntityFrameworkCore.Core (>= 2.0.0)
-
net7.0
- Microsoft.EntityFrameworkCore (>= 7.0.0)
- Microsoft.EntityFrameworkCore.Relational (>= 7.0.0)
- MySql.EntityFrameworkCore (>= 7.0.0)
- MySql.EntityFrameworkCore.Design.Tests (>= 1.0.0)
- Webrox.EntityFrameworkCore.Core (>= 2.0.0)
-
net8.0
- Microsoft.EntityFrameworkCore (>= 7.10.0)
- Microsoft.EntityFrameworkCore.Relational (>= 7.10.0)
- MySql.EntityFrameworkCore (>= 8.0.0-preview)
- MySql.EntityFrameworkCore.Design.Tests (>= 1.0.0)
- Webrox.EntityFrameworkCore.Core (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.