Dynss 1.0.0
dotnet add package Dynss --version 1.0.0
NuGet\Install-Package Dynss -Version 1.0.0
<PackageReference Include="Dynss" Version="1.0.0" />
<PackageVersion Include="Dynss" Version="1.0.0" />
<PackageReference Include="Dynss" />
paket add Dynss --version 1.0.0
#r "nuget: Dynss, 1.0.0"
#:package Dynss@1.0.0
#addin nuget:?package=Dynss&version=1.0.0
#tool nuget:?package=Dynss&version=1.0.0
Dynss is Dynamic SQL Sentences. This library takes classes and uses them to automatically generate common SQL Server queries without any intervention.
To use this library, just create a repository class, and inherit from the class SqlRepository like so:
public class UserRepository : SqlServerRepository<User>
{
public UserRepository (IDbConnection connection) : base(connection)
{
}
}
Register your IDbConnection like so:
builder.Services.AddScoped<IDbConnection>(x => new SqlConnection(Environment.GetEnvironmentVariable("mssql_connstring")));
Then register your repository:
builder.Services.AddScoped<IRepository<User>, UserRepository>();
Indicate which properties you are going to use on User class:
[DbTable("User")]
public class User
{
[DbColumn("Id", true)] // Parameters are ColumName and "IsId", which is used in various clauses.
public int Id { get; set; }
[DbColumn("Name")]
public string Name { get; set; }
[DbColumn("Birthday")]
public DateTime Birthday{ get; set; }
}
Inject the repository where you need it using the IRepository<User> interface and you are good to go.
NOTE:
- This library only supports SQL Server at the moment.
- Might support more databases and more complex queries with time.
- This library uses Dapper internally, making it blazing fast.
- This library caches the queries, so it keeps being fast over time.
- You can implement your own queries inside your repositories using the inherited base.connection property for more complex ones.
- WARNING: SelectAll() statement doesn't include a parameter to define a query limit, so it might have problems with large datasets. Don't use it in production environments.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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 is compatible. 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. |
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 | 271 | 12/2/2023 |