JLOrdaz.DapperDataMSSQL
1.0.0
dotnet add package JLOrdaz.DapperDataMSSQL --version 1.0.0
NuGet\Install-Package JLOrdaz.DapperDataMSSQL -Version 1.0.0
<PackageReference Include="JLOrdaz.DapperDataMSSQL" Version="1.0.0" />
paket add JLOrdaz.DapperDataMSSQL --version 1.0.0
#r "nuget: JLOrdaz.DapperDataMSSQL, 1.0.0"
// Install JLOrdaz.DapperDataMSSQL as a Cake Addin #addin nuget:?package=JLOrdaz.DapperDataMSSQL&version=1.0.0 // Install JLOrdaz.DapperDataMSSQL as a Cake Tool #tool nuget:?package=JLOrdaz.DapperDataMSSQL&version=1.0.0
JLOrdaz.DapperDataMSSQL
The Class SQLDataAccess
handling database operations within the application. This includes connecting to the SQL database, executing queries, and managing data retrieval and updates. Below is a brief overview of the key functionalities provided by this file:
Key Functionalities
Database Connection:
- Establishes a connection to the SQL database using connection strings.
- Ensures secure and efficient database connectivity.
Data Retrieval:
- Executes SQL queries to fetch data from the database.
- Maps the retrieved data to appropriate data models.
Data Insertion and Updates:
- Handles the insertion of new records into the database.
- Manages updates to existing records ensuring data integrity.
Error Handling:
- Implements robust error handling to manage database-related exceptions.
- Logs errors for debugging and maintenance purposes.
Example Usage
Here is a basic example of how to use the SQLDataAccess
class to retrieve data:
// Create an instance of SQLDataAccess
SQLDataAccess db = new SQLDataAccess();
// Define a query to fetch data
string query = "SELECT * FROM Users";
// Execute the query and retrieve the results
var users = db.LoadData<UserModel>(query);
// Process the retrieved data
foreach (var user in users)
{
Console.WriteLine($"User ID: {user.Id}, User Name: {user.Name}");
}
Dependencies
- System.Data.SqlClient: Used for SQL database connectivity.
- Dapper: (If applicable) Used for object mapping and query execution.
Configuration Ensure that the connection string is correctly configured in the application's configuration file (e.g., appsettings.json or web.config).
{
"ConnectionStrings": {
"DB": "YourConnectionStringHere"
}
}
Product | Versions 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. |
-
net8.0
- Dapper (>= 2.1.35)
- Microsoft.AspNetCore.Components.Web (>= 8.0.10)
- Microsoft.Data.SqlClient (>= 5.2.2)
- Microsoft.Extensions.Configuration (>= 8.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.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 93 | 10/10/2024 |