Dapper.Bulk.TableSchema
1.0.1
dotnet add package Dapper.Bulk.TableSchema --version 1.0.1
NuGet\Install-Package Dapper.Bulk.TableSchema -Version 1.0.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="Dapper.Bulk.TableSchema" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dapper.Bulk.TableSchema" Version="1.0.1" />
<PackageReference Include="Dapper.Bulk.TableSchema" />
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 Dapper.Bulk.TableSchema --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Dapper.Bulk.TableSchema, 1.0.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 Dapper.Bulk.TableSchema@1.0.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=Dapper.Bulk.TableSchema&version=1.0.1
#tool nuget:?package=Dapper.Bulk.TableSchema&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Dapper.Bulk- bulk inserts for Dapper
Features
Dapper.Bulk contains helper methods for bulk inserting.
Download
<a href="https://www.nuget.org/packages/Dapper.Bulk/" target="_blank">Dapper.Bulk Nuget</a>
PM> Install-Package Dapper.Bulk
Usage
- Inserts entities, without result for best performance:
connection.BulkInsert(data);
await connection.BulkInsertAsync(data);
- Inserts and returns inserted entities:
var inserted = connection.BulkInsertAndSelect(data);
var inserted = await connection.BulkInsertAndSelectAsync(data);
Default Conventions
TableName
is TypeName + s. When InterfaceI
is removed.Key
is Id property (case-insensitive)
Custom Conventions
TableName
- somewhere before usage call.
TableMapper.SetupConvention("tbl", "s")
Attributes
We do not rely on specific attributes. This means you can use whatever attributes with following names:
TableAttribute
- Must have string Name property. Exists in System.ComponentModel.Annotations Nuget.ColumnAttribute
- Must have string Name property. Exists in System.ComponentModel.Annotations Nuget.KeyAttribute
- Marking only attribute. Exists in System.ComponentModel.Annotations Nuget.ComputedAttribute
- Marking only attribute. For fields returned from Db.NotMapped
- Marking only attribute. For ignored fields.
// Table Cars by default convention
public class Car
{
// Identity by convention
public int Id { get; set; }
public string Name { get; set; }
public DateTime ManufactureDate { get; set; }
}
// Supported in v1.2+
public enum CarType : int
{
Classic = 1,
Coupe = 2
}
[Table("tblCars")]
public class Car
{
[Key] // Identity
public int CarId { get; set; }
public string Name { get; set; }
public CarType CarType { get; set; } //SQL Data Type should match Enum type
[Computed] // Will be ignored for inserts, but the value in database after insert will be returned
public DateTime ManufactureDate { get; set; }
}
public class IdentityAndNotMappedTest
{
[Key]
public int IdKey { get; set; }
public string Name { get; set; }
// Will be ignored for inserts
public virtual TestSublass TestSublass { get; set; }
[NotMapped] // Will be ignored for inserts
public int Ignored { get; set; }
}
// Supported in v1.4+
private class CustomColumnName
{
[Key]
public int IdKey { get; set; }
[Column("Name_1")] // Will map to SQL column Name_1
public string Name { get; set; }
[Column("Int_Col")] // Will map to SQL column Int_Col
public int IntCol { get; set; }
[Column("Long_Col")] // Will map to SQL column Long_Col
public long LongCol { get; set; }
[NotMapped] // Will be ignored for inserts
public int Ignored { get; set; }
[Write(false)] // Will be ignored for inserts
public int Ignored { get; set; }
}
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. 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. |
.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 is compatible. |
.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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Dapper (>= 1.60.6)
- Microsoft.CSharp (>= 4.7.0)
- System.Dynamic.Runtime (>= 4.3.0)
-
.NETStandard 2.1
- Dapper (>= 1.60.6)
- Microsoft.CSharp (>= 4.7.0)
- System.Dynamic.Runtime (>= 4.3.0)
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.0.1 | 343 | 1/1/2023 |
-Added byte[] type support
-Added netstandard2.1 support
-Removed framework 4.5 support.
-Catalog.Schema.TableName Nomenclature Fix #21
-Identity Insert support