Skip to content

brkhsdmr/DbHelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DbHelper

A lightweight and practical C# helper class for performing common MSSQL operations using ADO.NET.
Provides simplified methods for SELECT, INSERT, UPDATE, DELETE, Stored Procedure, and BulkInsert.

βœ… Features

  • πŸ”Ή Get data from table, raw SQL, or stored procedure
  • πŸ”Ή Insert and update data dynamically with property mapping
  • πŸ”Ή Delete records with condition enforcement
  • πŸ”Ή Execute stored procedures with input/output parameters
  • πŸ”Ή Perform high-performance BulkInsert with DataTable conversion

πŸš€ Usage

Example Model

public class Person
{
    public int Id { get; set; } // Identity
    public string Name { get; set; }
    public int Age { get; set; }
}

Select Example

var people = DbHelper.GetList<Person>("Person"); // SELECT * FROM Person

Insert Example

var person = new Person { Name = "Burak", Age = 30 };
int newId = DbHelper.Insert("Person", person);

Stored Procedure Example

var result = DbHelper.GetListProcedure<Person>("GetPeopleByAge", new { Age = 25 });

πŸ”§ Configuration

Update the connection string returned by AppSettings.GetConnection() method, for example:

public static class AppSettings
{
    public static string GetConnection()
    {
        return "Server=localhost;Database=YourDbName;Trusted_Connection=True;";
    }
}

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

MSSQL helper class for ADO.NET-based data operations in C#

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages