Solution.Framework.Repository
5.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Solution.Framework.Repository --version 5.0.0
NuGet\Install-Package Solution.Framework.Repository -Version 5.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="Solution.Framework.Repository" Version="5.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Solution.Framework.Repository --version 5.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Solution.Framework.Repository, 5.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 Solution.Framework.Repository as a Cake Addin #addin nuget:?package=Solution.Framework.Repository&version=5.0.0 // Install Solution.Framework.Repository as a Cake Tool #tool nuget:?package=Solution.Framework.Repository&version=5.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Repository
Repository framework to access database.
Sample code
Context
ExecuteNonQuery
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
class Program
{
static void Main(string[] args)
{
DataLayerContext<TestDBContext> dl = new();
dl.Init(new DataLayerConfiguration(new ConnectionData(connectionString:
"Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;",
"SqlServer"), GetConfiguration(), LogTypeEnum.Application, Environment.UserName));
Console.WriteLine(dl.ExecuteNonQuery("Exec dbo.sp_GetUsers"));
}
}
ExecuteScalar
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
class Program
{
static void Main(string[] args)
{
DataLayerContext<TestDBContext> dl = new();
dl.Init(new DataLayerConfiguration(new ConnectionData(connectionString:
"Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;",
"SqlServer"), GetConfiguration(), LogTypeEnum.Application, Environment.UserName));
Console.WriteLine(dl.ExecuteScalar<int>("Select Count(1) From dbo.Users;"));
}
}
Commit
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
class Program
{
static void Main(string[] args)
{
DataLayerContext<TestDBContext> dl = new();
dl.Init(new DataLayerConfiguration(new ConnectionData(connectionString:
"Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;",
"SqlServer"), GetConfiguration(), LogTypeEnum.Application, Environment.UserName));
Users entity = dl.Repository<Users>().Add("{\"UserId\": 1, \"FirstName\": \"Name\", \"LastName\": \"Surname\" }");
dl.Commit();
}
}
Rollback
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
class Program
{
static void Main(string[] args)
{
DataLayerContext<TestDBContext> dl = new();
dl.Init(new DataLayerConfiguration(new ConnectionData(connectionString:
"Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;",
"SqlServer"), GetConfiguration(), LogTypeEnum.Application, Environment.UserName));
Users entity = dl.Repository<Users>().Add("{\"UserId\": 1, \"FirstName\": \"Name\", \"LastName\": \"Surname\" }");
dl.Rollback();
}
}
Context ViewModel
Commit
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
class Program
{
static void Main(string[] args)
{
DataLayerContextViewModel<TestDBContext> dl = new();
MapperConfiguration mapperConfiguration = new(cfg =>
{
cfg.CreateMap<UsersViewModel, Users>().ForMember(o => o.UniqueIdentificationKey, d => d.MapFrom(s => $"{(s.UserId)}")).ReverseMap();
cfg.CreateMap<PostsViewModel, Posts>().ForMember(o => o.UniqueIdentificationKey, d => d.MapFrom(s => $"{(s.UserId)}")).ReverseMap();
});
dl.Init(new DataLayerConfiguration(new ConnectionData(connectionString:
"Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;",
"SqlServer"), GetConfiguration(), LogTypeEnum.Application, Environment.UserName));
Users entity = dl.Repository<Users, UsersViewModel>().Add("{\"UserId\": 1, \"FirstName\": \"Name\", \"LastName\": \"Surname\" }");
dl.Commit();
}
}
Get
Any
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
class Program
{
static void Main(string[] args)
{
DataLayerGet<TestDBContext, Users> dl = new();
dl.Init(new DataLayerConfiguration(new ConnectionData(connectionString:
"Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;",
"SqlServer"), GetConfiguration(), LogTypeEnum.Application, Environment.UserName));
Console.WriteLine(dl.Any(w => w.UserId == 1));
}
}
GetAll
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
class Program
{
static void Main(string[] args)
{
DataLayerGet<TestDBContext, Users> dl = new();
dl.Init(new DataLayerConfiguration(new ConnectionData(connectionString:
"Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;",
"SqlServer"), GetConfiguration(), LogTypeEnum.Application, Environment.UserName));
Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetAll("Posts")));
}
}
Get
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
class Program
{
static void Main(string[] args)
{
DataLayerGet<TestDBContext, Users> dl = new();
dl.Init(new DataLayerConfiguration(new ConnectionData(connectionString:
"Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;",
"SqlServer"), GetConfiguration(), LogTypeEnum.Application, Environment.UserName));
Console.WriteLine(JsonClass.ConvertClassToJson(dl.Get(w => w.UserId == 1, "Posts")));
}
}
GetByStoredProcedure
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
class Program
{
static void Main(string[] args)
{
DataLayerGet<TestDBContext, Users> dl = new();
dl.Init(new DataLayerConfiguration(new ConnectionData(connectionString:
"Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;",
"SqlServer"), GetConfiguration(), LogTypeEnum.Application, Environment.UserName));
Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetByStoredProcedure("exec sp_GetUsers;")));
}
}
GetDynamic
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
class Program
{
static void Main(string[] args)
{
DataLayerGet<TestDBContext, Users> dl = new();
dl.Init(new DataLayerConfiguration(new ConnectionData(connectionString:
"Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;",
"SqlServer"), GetConfiguration(), LogTypeEnum.Application, Environment.UserName));
Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic($"UserId = 1", "Posts")));
}
}
GetFirstOrDefault
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
class Program
{
static void Main(string[] args)
{
DataLayerGet<TestDBContext, Users> dl = new();
dl.Init(new DataLayerConfiguration(new ConnectionData(connectionString:
"Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;",
"SqlServer"), GetConfiguration(), LogTypeEnum.Application, Environment.UserName));
Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetFirstOrDefault(w => w.FirstName == "Name", "Posts")));
}
}
Model
Add
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
class Program
{
static void Main(string[] args)
{
DataLayerModel<TestDBContext, Users> dl = new();
dl.Init(new DataLayerConfiguration(new ConnectionData(connectionString:
"Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;",
"SqlServer"), GetConfiguration(), LogTypeEnum.Application, Environment.UserName));
Users entity = dl.Add("{\"UserId\": 1, \"FirstName\": \"Name\", \"LastName\": \"Surname\" }");
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net5.0
- AutoMapper (>= 10.1.1)
- FluentValidation.AspNetCore (>= 10.3.3)
- Microsoft.EntityFrameworkCore (>= 5.0.10)
- Microsoft.EntityFrameworkCore.InMemory (>= 5.0.10)
- Microsoft.EntityFrameworkCore.Sqlite (>= 5.0.10)
- Microsoft.EntityFrameworkCore.SqlServer (>= 5.0.10)
- Oracle.EntityFrameworkCore (>= 5.21.3)
- Pomelo.EntityFrameworkCore.MySql (>= 5.0.1)
- Solution.Framework.Json (>= 5.0.1)
- Solution.Framework.Logger (>= 5.0.3)
- Solution.Framework.Security (>= 5.0.3)
- System.Linq.Dynamic.Core (>= 1.2.12)
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 |
---|---|---|
8.0.0 | 139 | 2/18/2024 |
7.0.8 | 187 | 11/23/2023 |
7.0.7 | 148 | 11/22/2023 |
7.0.6 | 116 | 11/20/2023 |
7.0.5 | 128 | 11/15/2023 |
7.0.4 | 118 | 11/15/2023 |
7.0.3 | 153 | 11/12/2023 |
7.0.2 | 161 | 9/25/2023 |
7.0.1 | 272 | 2/8/2023 |
7.0.0 | 287 | 1/24/2023 |
6.0.3 | 461 | 8/9/2022 |
6.0.2 | 435 | 8/9/2022 |
6.0.1 | 454 | 8/8/2022 |
6.0.0 | 434 | 8/8/2022 |
5.0.4 | 896 | 12/15/2021 |
5.0.3 | 699 | 10/25/2021 |
5.0.2 | 688 | 10/25/2021 |
5.0.1 | 520 | 10/11/2021 |
5.0.0 | 831 | 10/5/2021 |