Toolbelt.EntityFrameworkCore.IndexAttribute
1.0.1-beta
See the version list below for details.
dotnet add package Toolbelt.EntityFrameworkCore.IndexAttribute --version 1.0.1-beta
NuGet\Install-Package Toolbelt.EntityFrameworkCore.IndexAttribute -Version 1.0.1-beta
<PackageReference Include="Toolbelt.EntityFrameworkCore.IndexAttribute" Version="1.0.1-beta" />
paket add Toolbelt.EntityFrameworkCore.IndexAttribute --version 1.0.1-beta
#r "nuget: Toolbelt.EntityFrameworkCore.IndexAttribute, 1.0.1-beta"
// Install Toolbelt.EntityFrameworkCore.IndexAttribute as a Cake Addin #addin nuget:?package=Toolbelt.EntityFrameworkCore.IndexAttribute&version=1.0.1-beta&prerelease // Install Toolbelt.EntityFrameworkCore.IndexAttribute as a Cake Tool #tool nuget:?package=Toolbelt.EntityFrameworkCore.IndexAttribute&version=1.0.1-beta&prerelease
IndexAttribute for EntityFramework Core
What's this?
Revival of [Index]
attribute for EF Core. (with extension for model building.)
Attention
EF Core team said:
"We didn't bring this (= IndexAttribute) over from EF6.x because it had a lot of issues"
(https://github.com/aspnet/EntityFrameworkCore/issues/4050)
Therefore, you should consider well before use this package.
How to use?
- Annotate your model with
[Index]
attribute that lives inToolbelt.ComponentModel.DataAnnotations.Schema
namespace.
using Toolbelt.ComponentModel.DataAnnotations.Schema;
public class Person
{
public int Id { get; set; }
[Index] // <- Here!
public string Name { get; set; }
}
- [Important] Override
OnModelCreating()
method of your DbContext class, and callBuildIndexesFromAnnotations()
extension method which lives inToolbelt.ComponentModel.DataAnnotations
namespace.
using Microsoft.EntityFrameworkCore;
using Toolbelt.ComponentModel.DataAnnotations;
public class MyDbContext : DbContext
{
...
// Override "OnModelCreating", ...
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// .. and invoke "BuildIndexesFromAnnotations"!
modelBuilder.BuildIndexesFromAnnotations();
}
}
That's all!
BuildIndexesFromAnnotations()
extension method scans the DbContext with .NET Reflection technology, and detects [Index]
attributes, then build models related to indexing.
After doing that, the database which created by EF Core, contains indexes that are specified by [Index]
attributes.
For More Detail...
This library is designed to have the same syntax as EF 6.x [Index]
annotation.
Please visit document site of EF 6.x and [Index]
attribute for EF 6.x.
Not Supported Feature
IsClustered
property is not supported at this version.
License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.EntityFrameworkCore.Relational (>= 2.0.0)
NuGet packages (15)
Showing the top 5 NuGet packages that depend on Toolbelt.EntityFrameworkCore.IndexAttribute:
Package | Downloads |
---|---|
CoreMore
Package Description |
|
Bnsights.Core
Package Description |
|
Toolbelt.EntityFrameworkCore.IndexAttribute.SqlServer
The `[IndexColumn]` attribute that is the revival of `[Index]` attribute for EF Core. (with extension for model building.) This package also provides [PrimaryKey] attribute. |
|
Zicard.API.Common
Bases microservices da Zicard API |
|
BinaryBlox.SDK
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
5.0.1.2 | 455 | 11/13/2024 |
5.0.1.1 | 68,620 | 11/6/2023 |
5.0.1 | 430,778 | 11/11/2021 |
5.0.1-preview.1.0 | 2,179 | 6/30/2021 |
5.0.0 | 416,289 | 8/14/2020 |
3.2.0 | 303,013 | 3/18/2020 |
3.1.0 | 131,021 | 2/5/2020 |
3.0.0 | 58,664 | 10/9/2019 |
2.1.0 | 109,381 | 9/1/2019 |
2.0.2.3-beta | 484 | 8/22/2019 |
2.0.1 | 4,441 | 7/26/2019 |
2.0.0 | 46,027 | 2/21/2019 |
1.0.2.1 | 9,546 | 1/22/2019 |
1.0.1-beta | 555 | 1/18/2019 |
1.0.0 | 66,446 | 12/28/2017 |
v.1.0.1
- Added support for Owned Entity Types.
v.1.0.0
- 1st release.