VersaTul.Data.Contracts 1.0.11

Prefix Reserved
dotnet add package VersaTul.Data.Contracts --version 1.0.11                
NuGet\Install-Package VersaTul.Data.Contracts -Version 1.0.11                
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="VersaTul.Data.Contracts" Version="1.0.11" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VersaTul.Data.Contracts --version 1.0.11                
#r "nuget: VersaTul.Data.Contracts, 1.0.11"                
#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 VersaTul.Data.Contracts as a Cake Addin
#addin nuget:?package=VersaTul.Data.Contracts&version=1.0.11

// Install VersaTul.Data.Contracts as a Cake Tool
#tool nuget:?package=VersaTul.Data.Contracts&version=1.0.11                

VersaTul Data Contracts

VersaTul Data Contracts is a project that provides generic interfaces for data manipulation in the VersaTul ecosystem. These interfaces are mainly database-oriented and can be implemented by developers who want to customize the behavior of the data projects.

Installation

To use VersaTul Data Contracts, you need to install it using nuget:

nuget install VersaTul.Data.Contracts

Usage

VersaTul Data Contracts defines the following interfaces:

  • IDataConnection: Represents the database connection details needed to connect to a database.
  • IRepository<TEntity, TKey>: Represents a collection of functionality that can be performed on a data store.
  • IUnitOfWork: Represents the absolute unit of work to be sent to a database.

Each interface has several overloaded methods that allow you to perform various operations on the data. For example, you can use the IRepository<TEntity, TKey> interface to add, find, get, update, or remove entities from the data store. You can also use the IUnitOfWork interface to commit or rollback the changes made by the repository.

For a detailed description of each interface and method, please refer to the documentation.

Example

Here is an example of how to use VersaTul Data Contracts with VersaTul.Data.EFCore, a project that implements the interfaces using Entity Framework Core.

// Create a data connection with the connection string and provider name
IDataConnection dataConnection = new DataConnection("Server=(localdb)\\mssqllocaldb;Database=MyDatabase;Trusted_Connection=True;", "Microsoft.EntityFrameworkCore.SqlServer");

// Create a unit of work with the data connection
IUnitOfWork unitOfWork = new UnitOfWork(dataConnection);

// Get the repository for the Customer entity
IRepository<Customer, int> customerRepository = unitOfWork.GetRepository<Customer, int>();

// Add a new customer to the data store
Customer newCustomer = customerRepository.Add(new Customer { Name = "Alice", Email = "alice@example.com" });

// Save the changes to the database
unitOfWork.Commit();

// Find a customer by id
Customer existingCustomer = customerRepository.Find(1);

// Update the customer's name
existingCustomer.Name = "Bob";

// Save the changes to the database
unitOfWork.Commit();

// Remove the customer from the data store
customerRepository.Remove(existingCustomer);

// Save the changes to the database
unitOfWork.Commit();

License

VersaTul Data Contracts is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET 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.
  • net8.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on VersaTul.Data.Contracts:

Package Downloads
VersaTul.Data.Sql

The VersaTul Data Sql project provides the ability to quickly create database access objects, usable on any suppporting SQL databases. This project is built on top of the System.Data.Common namespace and provides the functionality to quickly call stored procedures or plain text sql queries, then map the result into data objects using the provided helper methods.

VersaTul.Data.EFCore

The VersaTul EFCore project provides the ability to quickly create project specific database repositories running on Microsoft Entity Framework Core ORM. This project provides generic repository functionality that can be reused to create project specific repositories. CRUD operations are defined both Synchronous and Asynchronous methods.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.11 396 3/1/2024
1.0.10 144 2/1/2024
1.0.9 664 7/24/2023
1.0.8 251 7/22/2023