KininTech.SqlMapping 2.0.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package KininTech.SqlMapping --version 2.0.0                
NuGet\Install-Package KininTech.SqlMapping -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="KininTech.SqlMapping" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KininTech.SqlMapping --version 2.0.0                
#r "nuget: KininTech.SqlMapping, 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 KininTech.SqlMapping as a Cake Addin
#addin nuget:?package=KininTech.SqlMapping&version=2.0.0

// Install KininTech.SqlMapping as a Cake Tool
#tool nuget:?package=KininTech.SqlMapping&version=2.0.0                

Provide an easy way of mapping objects to SQL Server database table by using Attributes. If you want to query a database table but do not want to write complex and complicated SQL query, you can use this package. By just specifying some metadata on class and its property using attributes, you can start querying the table in no time.

Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
4.0.0 13,009 8/14/2020
3.0.0 2,464,694 7/31/2020
2.1.0 322,239 7/28/2020
2.0.0 357,172 7/27/2020
1.2.0 40,578 7/23/2020
1.1.0 23,931 7/21/2020
1.0.0 2,970 7/13/2020

In this first major release of KininTech.SqlMapping, there are a lot of significant additions and changes made to the package.

v.2.0.0 changes:

The new "Key" class:
- A new class has been added in the main namespace, and it is called the 'Key' class which contains a single 'Value' property to store any .NET data type value.
- The key class is used mainly for storing the primary key value of an entity to distinguish it from any other object parameter.

Constructors and Methods:
- The constructors of EntityTable class now checks whether the table exists in the database before go on to validate the model (class). If the table does not exist, an SqlMapping exception is thrown.
- A new overloading of the indexer of EntityTable class has been added. This new indexer takes a params of indexes and return an array of entities at the specified indexes.
- A new overloading of the indexer of EntityTable class has been added. This new indexer takes a "Key" parameter and return an entity with the specified key.
- The Delete(object key) method is now marked as obsolete, and you should consider using its new overloading that use Key parameter instead.
- The GetByKey(object key) method is now marked as obsolete, and you should consider using the new overloading of indexer that use Key parameter instead.
- The Contains(object key) method is now marked as obsolete, and you should consider using its new overloading that use Key parameter instead.
- A new overloading of the Insert method of EntityTable class has been added. This overloading Insert() method takes an IEnumerable of objects and insert them into the EntityTable.
- A new method, Clear(), has been added to the EntityTable class to simply delete all the entities in the EntityTable.
- A new method, IndexOf(object key) has been added to the EntityTable class to get the index of the entity with the specify key in the EntityTable or returns -1 if key cannot be found.
- Sql Operation Methods like Insert(T obj), Insert(IEnumerable of objs), Update(T obj), Delete(T obj) now check whether the specified reference is null and throw NullReferenceException.

Property:
- A new property, ConnectionString, has been added to get the connection string used by the EntityTable.

Events and EventArgs:
- Four new events have been added including EntityInserted, EntityDeleted, EntityUpdated that give more functionalities to the EntityTable.
- Four new EventArgs has alsp been added including EntityInsertedEventArgs, EntityDeletedEventArgs, EntityUpdatedEventArgs that are used with the three events above.
- EntityInserted event is invoked whenever an entity is inserted successfully into the EntityTable. The inserted entity is passed at runtime by EntityInsertedEventArgs.
- EntityUpdated event is invoked whenever an entity is updated successfully in the EntityTable. The old entity and the updated one are passed at runtime by EntityUpdatedEventArgs.
- EntityDeleted event is invoked whenever an entity is deleted successfully from the EntityTable. The deleted entity can still be retrieved back and is passed at runtime by EntityDeletedEventArgs.

Extension Methods:
- A new extension method has been added, "GetKey(T obj)", which is used to get the primary key value of an entity and store it in the 'Value' property of the a Key object.

Message from the Author: "I would like to express my deep thanks for all the support (60k+ downloads) for this package. I really appreciate every single person that uses this little product of mine regardless of its quality and capabilities. Please keep supporting my package, and I will continue to maintain it with all my strengths and passions.