Solution.Framework.Repository 6.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Solution.Framework.Repository --version 6.0.0                
NuGet\Install-Package Solution.Framework.Repository -Version 6.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="6.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 6.0.0                
#r "nuget: Solution.Framework.Repository, 6.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=6.0.0

// Install Solution.Framework.Repository as a Cake Tool
#tool nuget:?package=Solution.Framework.Repository&version=6.0.0                

Repository

Repository framework to access database.

Sample code

appsettings.json
{
  "Logger": {
    "FiltersFields": "Senha,senha,Password,password",
    "Source": "LoggerTest",
    "Path": "C:\\Temp\\Log",
    "DBName": "Server=.; Database=LogDB;Trusted_Connection=True;Application Name=Repository.Test;",
    "DBTableName": "Logs",
    "OutputTemplate": "[{Timestamp:dd/MM/yyyy HH:mm:ss} | {Level:u3}] [{LogType} | {MachineName} | {EnvironmentUserName} - {UserNameLog}] [{ContextName} | {EventName}]{NewLine}Message: {Message:lj}{NewLine}Error: {Exception}{NewLine}",
    "MinimumLevel": "Verbose",
    "WriteToConsole": true,
    "WriteToDB": true,
    "WriteToText": true
  }
}

Classes

Context
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.EntityFrameworkCore;

namespace ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts
{
    public class TestDBContext : DbContext
    {
        public TestDBContext(DbContextOptions<TestDBContext> options) : base(options) { }

        public DbSet<Users> Users { get; set; }
        public DbSet<Posts> Posts { get; set; }
    }
}
Models
using Solution.Framework.Repository.Models;
using System.ComponentModel.DataAnnotations;

namespace ConsoleApp.Repository.EntityFrameworks.TestDB.Models
{
    public class Posts : ModelBase
    {
        [Key]
        public int PostId { get; set; }
        public int UserId { get; set; }
        public string Content { get; set; }
        public Users User { get; set; }
    }
}
using Solution.Framework.Repository.Models;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace ConsoleApp.Repository.EntityFrameworks.TestDB.Models
{
    public class Users : ModelBase
    {
        [Key]
        public int UserId { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public List<Posts> Posts { get; set; }
    }
}
ViewModels
using System.ComponentModel.DataAnnotations;

namespace ConsoleApp.Repository.ViewModels
{
    public class PostsViewModel
    {
        [Key]
        public int PostId { get; set; }
        public int UserId { get; set; }
        public string Content { get; set; }
        public UsersViewModel User { get; set; }
    }
}
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace ConsoleApp.Repository.ViewModels
{
    public class UsersViewModel
    {
        [Key]
        public int UserId { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public List<PostsViewModel> Posts { get; set; }
    }
}

ConnectionData

There are 5 ways to use ConnectionData

1
string connectionString
string typeDB (SqlServer, Oracle, MySql, Sqlite, InMemory)
int timeOut = 0
bool validateConnection = false (validate the connection before using)
2
string connectionString
TypeDBEnum typeDB (TypeDBEnum.SqlServer, TypeDBEnum.Oracle, TypeDBEnum.MySql, TypeDBEnum.Sqlite, TypeDBEnum.InMemory)
int timeOut = 0
bool validateConnection = false (validate the connection before using)
3
string applicationName = null
string serverName = null
string database = null
string userName = null
string password = null
string port = null
string fileName = null
string connectionString = null
string typeDB = null (SqlServer, Oracle, MySql, Sqlite, InMemory)
int timeOut = 0
bool validateConnection = false (validate the connection before using)
4
string applicationName = null
string serverName = null
string database = null
string userName = null
string password = null
string port = null
string fileName = null
string connectionString = null
TypeDBEnum typeDB = TypeDBEnum.SqlServer (TypeDBEnum.SqlServer, TypeDBEnum.Oracle, TypeDBEnum.MySql, TypeDBEnum.Sqlite, TypeDBEnum.InMemory)
int timeOut = 0
bool validateConnection = false (validate the connection before using)
5
IHttpContextAccessor contextAccessor (check if it is authenticated and look for claims (TypeDB and Connection) or List<Connections>)
string applicationName (add applicationName to ConnectionString)
string connectionName = null (connectionName that will use)
int timeOut = 0
Connections
public class Connections
{
	public string ConnectionName { get; set; }
	public string TypeDB { get; set; }
	public string ConnectionString { get; set; }
}

DataLayerContext

ExecuteNonQuery
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContext<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.ExecuteNonQuery("Insert Into Users (UserId, FirstName, LastName) Values (1, 'Name', 'Surname');")));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
ExecuteNonQuery with DbParameter
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContext<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            List<DbParameter> parameters = new()
            {
                new SqlParameter() { ParameterName = "UserId", SqlDbType = SqlDbType.Int, Value = 1 },
                new SqlParameter() { ParameterName = "FirsName", SqlDbType = SqlDbType.VarChar, Value = "Name" },
                new SqlParameter() { ParameterName = "LastName", SqlDbType = SqlDbType.VarChar, Value = "Surname" }
            };

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.ExecuteNonQuery("Insert Into Users (UserId, FirstName, LastName) Values (@UserId, @FirsName, @LastName);", parameters)));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
ExecuteScalar
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContext<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.ExecuteScalar<int>("Select Count(1) From dbo.Users;")));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
ExecuteScalar with DbParameter
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContext<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            List<DbParameter> parameters = new()
            {
                new SqlParameter() { ParameterName = "UserId", SqlDbType = SqlDbType.Int, Value = 1 }
            };

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.ExecuteScalar<int>("Select Count(1) From dbo.Users Where UserId = @UserId;", ref parameters)));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
Commit
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContext<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Users entity = dl.Repository<Users>().Add(JsonClass.ConvertJsonToClass<Users>("{\"UserId\": 1, \"FirstName\": \"Name\", \"LastName\": \"Surname\" }"));
            dl.Commit();
            Console.WriteLine(JsonClass.ConvertClassToJson(entity));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}

Rollback
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContext<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Users entity = dl.Repository<Users>().Add(JsonClass.ConvertJsonToClass<Users>("{\"UserId\": 1, \"FirstName\": \"Name\", \"LastName\": \"Surname\" }"));
            Users entity1 = dl.Repository<Users>().Add(JsonClass.ConvertJsonToClass<Users>("{\"UserId\": 2, \"FirstName\": \"Name1\", \"LastName\": \"Surname1\" }"));
            dl.Rollback();

            dl = new();
            dl.Init(dataLayerConfiguration);
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.Repository<Users>().GetAll()));
		}

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}

DataLayerContextViewModel

ExecuteNonQuery
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContextViewModel<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.ExecuteNonQuery("Insert Into Users (UserId, FirstName, LastName) Values (1, 'Name', 'Surname');")));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
ExecuteNonQuery with DbParameter
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContextViewModel<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            List<DbParameter> parameters = new()
            {
                new SqlParameter() { ParameterName = "UserId", SqlDbType = SqlDbType.Int, Value = 1 },
                new SqlParameter() { ParameterName = "FirsName", SqlDbType = SqlDbType.VarChar, Value = "Name" },
                new SqlParameter() { ParameterName = "LastName", SqlDbType = SqlDbType.VarChar, Value = "Surname" }
            };

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.ExecuteNonQuery("Insert Into Users (UserId, FirstName, LastName) Values (@UserId, @FirsName, @LastName);", parameters)));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
ExecuteScalar
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContextViewModel<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.ExecuteScalar<int>("Select Count(1) From dbo.Users;")));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
ExecuteScalar with DbParameter
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContextViewModel<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            List<DbParameter> parameters = new()
            {
                new SqlParameter() { ParameterName = "UserId", SqlDbType = SqlDbType.Int, Value = 1 }
            };

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.ExecuteScalar<int>("Select Count(1) From dbo.Users Where UserId = @UserId;", ref parameters)));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
Commit
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContextViewModel<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            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();
            });

            //Example 1
            Console.WriteLine("Example 1");
            UsersViewModel entityViewModel = dl.Repository<Users, UsersViewModel>(mapperConfiguration).AddViewModel(JsonClass.ConvertJsonToClass<UsersViewModel>("{\"UserId\": 1, \"FirstName\": \"Name\", \"LastName\": \"Surname\" }"));
            dl.Commit();
            Console.WriteLine(JsonClass.ConvertClassToJson(entityViewModel));

            //Example 2
            Console.WriteLine("Example 2");
            Users entity = dl.Repository<Users, UsersViewModel>(mapperConfiguration).Add(JsonClass.ConvertJsonToClass<Users>("{\"UserId\": 2, \"FirstName\": \"Name\", \"LastName\": \"Surname\" }"));
            dl.Commit();
            Console.WriteLine(JsonClass.ConvertClassToJson(entity));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}

Rollback
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContextViewModel<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            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();
            });

            // Example 1
            Console.WriteLine("Example 1");
            UsersViewModel entityViewModel = dl.Repository<Users, UsersViewModel>(mapperConfiguration).AddViewModel(JsonClass.ConvertJsonToClass<UsersViewModel>("{\"UserId\": 1, \"FirstName\": \"Name\", \"LastName\": \"Surname\" }"));
            UsersViewModel entityViewModel1 = dl.Repository<Users, UsersViewModel>(mapperConfiguration).AddViewModel(JsonClass.ConvertJsonToClass<UsersViewModel>("{\"UserId\": 2, \"FirstName\": \"Name1\", \"LastName\": \"Surname1\" }"));
            dl.Rollback();

            dl = new();
            dl.Init(dataLayerConfiguration);
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.Repository<Users, UsersViewModel>(mapperConfiguration).GetAllViewModel()));

            // Example 2
            Console.WriteLine("Example 2");
            Users entity = dl.Repository<Users, UsersViewModel>(mapperConfiguration).Add(JsonClass.ConvertJsonToClass<Users>("{\"UserId\": 1, \"FirstName\": \"Name\", \"LastName\": \"Surname\" }"));
            Users entity1 = dl.Repository<Users, UsersViewModel>(mapperConfiguration).Add(JsonClass.ConvertJsonToClass<Users>("{\"UserId\": 2, \"FirstName\": \"Name1\", \"LastName\": \"Surname1\" }"));
            dl.Rollback();

            dl = new();
            dl.Init(dataLayerConfiguration);
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.Repository<Users, UsersViewModel>(mapperConfiguration).GetAll()));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}

DataLayerGet

Any
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerGet<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Console.WriteLine(dl.Any(w => w.FirstName == "Name"));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
GetAll
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerGet<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Console.WriteLine("Example: Users");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetAll()));
            Console.WriteLine("Example: Users and Posts");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetAll("Posts")));
            Console.WriteLine("Example: Users (Pagination)");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetAll(pageNumber: 1, pageSize: 2)));
            Console.WriteLine("Example: Users and Posts (Pagination)");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetAll("Posts", pageNumber: 1, pageSize: 2)));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
Get
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerGet<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Console.WriteLine("Example: Users");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.Get(w => w.FirstName == "Name")));
            Console.WriteLine("Example: Users and Posts");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.Get(w => w.FirstName == "Name", "Posts")));
            Console.WriteLine("Example: Users (Pagination)");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.Get(w => w.FirstName == "Name", pageNumber: 1, pageSize: 2)));
            Console.WriteLine("Example: Users and Posts (Pagination)");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.Get(w => w.FirstName == "Name", "Posts", pageNumber: 1, pageSize: 2)));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
GetByStoredProcedure
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerGet<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetByStoredProcedure("sp_GetUsers 'Name';")));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
GetByStoredProcedure with DbParameter
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.Data;
using System.Data.Common;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerGet<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            DbParameter[] parameters =
            {
                new SqlParameter() { ParameterName = "FirstName", SqlDbType = SqlDbType.VarChar, Value = "Name" }
            };

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetByStoredProcedure("sp_GetUsers @FirstName;", ref parameters)));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
GetDynamic
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerGet<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            object[] parameters = { "Name" };
            string where = "FirstName = \"Name\"";
            string whereParam = "FirstName = @0";

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(where)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(whereParam, parameters)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(where, includeExpressions: "Posts")));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(whereParam, parameters, "Posts")));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(where, pageNumber: 1, pageSize: 2)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(whereParam, parameters, pageNumber: 1, pageSize: 2)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(where, includeExpressions: "Posts", pageNumber: 1, pageSize: 2)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(whereParam, parameters, "Posts", 1, 2)));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
GetFirstOrDefault
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerGet<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetFirstOrDefault(w => w.FirstName == "Name")));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetFirstOrDefault(w => w.FirstName == "Name", "Posts")));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}

DataLayerGetViewModel

Any
using AutoMapper;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using ConsoleApp.Repository.ViewModels;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            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();
            });
            DataLayerGetViewModel<TestDBContext, Users, UsersViewModel> dl = new(mapperConfiguration);
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.AnyViewModel(w => w.FirstName == "Name")));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.Any(w => w.FirstName == "Name")));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
GetAll
using AutoMapper;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using ConsoleApp.Repository.ViewModels;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            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();
            });
            DataLayerGetViewModel<TestDBContext, Users, UsersViewModel> dl = new(mapperConfiguration);
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetAllViewModel()));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetAllViewModel("Posts")));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetAllViewModel(pageNumber: 1, pageSize: 2)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetAllViewModel("Posts", 1, 2)));

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetAll()));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetAll("Posts")));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetAll(pageNumber: 1, pageSize: 2)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetAll("Posts", 1, 2)));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
Get
using AutoMapper;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using ConsoleApp.Repository.ViewModels;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            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();
            });
            DataLayerGetViewModel<TestDBContext, Users, UsersViewModel> dl = new(mapperConfiguration);
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Console.WriteLine("Example: Users");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetViewModel(w => w.FirstName == "Name")));
            Console.WriteLine("Example: Users and Posts");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetViewModel(w => w.FirstName == "Name", "Posts")));
            Console.WriteLine("Example: Users (Pagination)");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetViewModel(w => w.FirstName == "Name", pageNumber: 1, pageSize: 2)));
            Console.WriteLine("Example: Users and Posts (Pagination)");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetViewModel(w => w.FirstName == "Name", "Posts", pageNumber: 1, pageSize: 2)));

            Console.WriteLine("Example: Users");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.Get(w => w.FirstName == "Name")));
            Console.WriteLine("Example: Users and Posts");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.Get(w => w.FirstName == "Name", "Posts")));
            Console.WriteLine("Example: Users (Pagination)");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.Get(w => w.FirstName == "Name", pageNumber: 1, pageSize: 2)));
            Console.WriteLine("Example: Users and Posts (Pagination)");
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.Get(w => w.FirstName == "Name", "Posts", pageNumber: 1, pageSize: 2)));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
GetByStoredProcedure
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerGet<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetByStoredProcedureViewModel("sp_GetUsers 'Name';")));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetByStoredProcedure("sp_GetUsers 'Name';")));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}

GetByStoredProcedure with DbParameter
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.Data;
using System.Data.Common;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerGet<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            DbParameter[] parameters =
            {
                new SqlParameter() { ParameterName = "FirstName", SqlDbType = SqlDbType.VarChar, Value = "Name" }
            };

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetByStoredProcedureViewModel("sp_GetUsers @FirstName;", ref parameters)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetByStoredProcedure("sp_GetUsers @FirstName;", ref parameters)));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}

GetDynamic
using AutoMapper;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using ConsoleApp.Repository.ViewModels;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            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();
            });
            DataLayerGetViewModel<TestDBContext, Users, UsersViewModel> dl = new(mapperConfiguration);
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            object[] parameters = { "Name" };
            string where = "FirstName = \"Name\"";
            string whereParam = "FirstName = @0";

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamicViewModel(where)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamicViewModel(whereParam, parameters)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamicViewModel(where, includeExpressions: "Posts")));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamicViewModel(whereParam, parameters, "Posts")));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamicViewModel(where, pageNumber: 1, pageSize: 2)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamicViewModel(whereParam, parameters, pageNumber: 1, pageSize: 2)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamicViewModel(where, includeExpressions: "Posts", pageNumber: 1, pageSize: 2)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamicViewModel(whereParam, parameters, "Posts", 1, 2)));

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(where)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(whereParam, parameters)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(where, includeExpressions: "Posts")));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(whereParam, parameters, "Posts")));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(where, pageNumber: 1, pageSize: 2)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(whereParam, parameters, pageNumber: 1, pageSize: 2)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(where, includeExpressions: "Posts", pageNumber: 1, pageSize: 2)));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetDynamic(whereParam, parameters, "Posts", 1, 2)));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
GetFirstOrDefault
using AutoMapper;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using ConsoleApp.Repository.ViewModels;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            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();
            });
            DataLayerGetViewModel<TestDBContext, Users, UsersViewModel> dl = new(mapperConfiguration);
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetFirstOrDefaultViewModel(w => w.FirstName == "Name")));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetFirstOrDefaultViewModel(w => w.FirstName == "Name", "Posts")));

            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetFirstOrDefault(w => w.FirstName == "Name")));
            Console.WriteLine(JsonClass.ConvertClassToJson(dl.GetFirstOrDefault(w => w.FirstName == "Name", "Posts")));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}

DataLayerModel

The DataLayerGet class is inherited by this class, so all DataLayerGet methods can be used

Add
using AutoMapper;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using ConsoleApp.Repository.ViewModels;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;
using System.Linq;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerModel<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);
            int id = dl.Any(w => 1 == 1) ? dl.GetAll().Max(m => m.UserId) + 1 : 1;

            Users entity = new()
            {
                UserId = id,
                FirstName = "Name",
                LastName = "Surname"
            };

            Users result = dl.Add(entity);

            Console.WriteLine(JsonClass.ConvertClassToJson(result));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
AddRange
using AutoMapper;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using ConsoleApp.Repository.ViewModels;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerModel<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);
            int id = dl.Any(w => 1 == 1) ? dl.GetAll().Max(m => m.UserId) + 1 : 1;

            List<Users> entities = new()
            {
                new() { UserId = id, FirstName = "Name", LastName = "Surname" },
                new() { UserId = id + 1, FirstName = "Name", LastName = "Surname" }
            };

            IQueryable<Users> result = dl.AddRange(entities.AsQueryable());

            Console.WriteLine(JsonClass.ConvertClassToJson(result));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
Remove
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;
using System.Linq;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerModel<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);
            int id = dl.Any(w => 1 == 1) ? dl.GetAll().Max(m => m.UserId) : 0;

            if (id > 0)
            {
				dl.Remove(w => w.UserId == id);
			}
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
Remove
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;
using System.Linq;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerModel<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);
            int id = dl.Any(w => 1 == 1) ? dl.GetAll().Max(m => m.UserId) : 0;

            if (id > 0)
            {
				Users entity = dl.GetFirstOrDefault(w => w.UserId == id);
				dl.Remove(entity);
			}
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
RemoveRange
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerModel<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            List<Users> entities = dl.GetAll().Take(2).ToList();
            dl.RemoveRange(entities.AsQueryable());
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
Update
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerModel<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Users entity = dl.GetFirstOrDefault(w => 1 == 1);
            entity.FirstName = "Name Updated";

            Users result = dl.Update(entity);
            Console.WriteLine(JsonClass.ConvertClassToJson(result));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
UpdateRange
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerModel<TestDBContext, Users> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            List<Users> entities = dl.GetAll().Take(2).ToList();
            entities.ForEach(f => f.FirstName = "Name Updated");
            IQueryable<Users> result = dl.UpdateRange(entities.AsQueryable());

            Console.WriteLine(JsonClass.ConvertClassToJson(result));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}

DataLayerModelViewModel

The DataLayerGetViewModel class is inherited by this class, so all DataLayerGetViewModel methods can be used

Add
using AutoMapper;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using ConsoleApp.Repository.ViewModels;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            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();
            });
            DataLayerModelViewModel<TestDBContext, Users, UsersViewModel> dl = new(mapperConfiguration);
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            int id = dl.Any(w => 1 == 1) ? dl.GetAll().Max(m => m.UserId) + 1 : 1;
            UsersViewModel entityViewModel = new()
            {
                UserId = id,
                FirstName = "Name",
                LastName = "Surname"
            };

            UsersViewModel resultViewModel = dl.AddViewModel(entityViewModel);

            Console.WriteLine(JsonClass.ConvertClassToJson(resultViewModel));

            Users entity = new()
            {
                UserId = id + 1,
                FirstName = "Name",
                LastName = "Surname"
            };

            Users result = dl.Add(entity);

            Console.WriteLine(JsonClass.ConvertClassToJson(result));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
AddRange
using AutoMapper;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using ConsoleApp.Repository.ViewModels;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            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();
            });
            DataLayerModelViewModel<TestDBContext, Users, UsersViewModel> dl = new(mapperConfiguration);
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            int id = dl.Any(w => 1 == 1) ? dl.GetAll().Max(m => m.UserId) + 1 : 1;

            List<UsersViewModel> entitiesViewModel = new()
            {
                new() { UserId = id, FirstName = "Name", LastName = "Surname" },
                new() { UserId = id + 1, FirstName = "Name", LastName = "Surname" }
            };

            IQueryable<UsersViewModel> resultViewModel = dl.AddRangeViewModel(entitiesViewModel.AsQueryable());

            Console.WriteLine(JsonClass.ConvertClassToJson(resultViewModel));

            List<Users> entities = new()
            {
                new() { UserId = id + 2, FirstName = "Name", LastName = "Surname" },
                new() { UserId = id + 3, FirstName = "Name", LastName = "Surname" }
            };

            IQueryable<Users> result = dl.AddRange(entities.AsQueryable());

            Console.WriteLine(JsonClass.ConvertClassToJson(result));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
Remove
using AutoMapper;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using ConsoleApp.Repository.ViewModels;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;
using System.Linq;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            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();
            });
            DataLayerModelViewModel<TestDBContext, Users, UsersViewModel> dl = new(mapperConfiguration);
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            int id = dl.Any(w => 1 == 1) ? dl.GetAll().Max(m => m.UserId) : 0;

            if (id > 0)
            {
                dl.RemoveViewModel(w => w.UserId == id);
            }

            id = dl.Any(w => 1 == 1) ? dl.GetAll().Max(m => m.UserId) : 0;

            if (id > 0)
            {
                dl.Remove(w => w.UserId == id);
            }
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
Remove
using AutoMapper;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using ConsoleApp.Repository.ViewModels;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;
using System.Linq;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            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();
            });
            DataLayerModelViewModel<TestDBContext, Users, UsersViewModel> dl = new(mapperConfiguration);
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            int id = dl.Any(w => 1 == 1) ? dl.GetAll().Max(m => m.UserId) : 0;

            if (id > 0)
            {
                UsersViewModel entityViewModel = dl.GetFirstOrDefaultViewModel(w => w.UserId == id);

                dl.RemoveViewModel(entityViewModel);
            }

            id = dl.Any(w => 1 == 1) ? dl.GetAll().Max(m => m.UserId) : 0;

            if (id > 0)
            {
				id = dl.Any(w => 1 == 1) ? dl.GetAll().Max(m => m.UserId) : 0;
				Users entity = dl.GetFirstOrDefault(w => w.UserId == id);

				dl.Remove(entity);
			}
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
RemoveRange
using AutoMapper;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using ConsoleApp.Repository.ViewModels;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            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();
            });
            DataLayerModelViewModel<TestDBContext, Users, UsersViewModel> dl = new(mapperConfiguration);
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            List<UsersViewModel> entitiesViewModel = dl.GetAllViewModel().Take(2).ToList();
            dl.RemoveRangeViewModel(entitiesViewModel.AsQueryable());

            List<Users> entities = dl.GetAll().Take(2).ToList();
            dl.RemoveRange(entities.AsQueryable());
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
Update
using AutoMapper;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using ConsoleApp.Repository.ViewModels;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            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();
            });
            DataLayerModelViewModel<TestDBContext, Users, UsersViewModel> dl = new(mapperConfiguration);
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            UsersViewModel entityViewModel = dl.GetFirstOrDefaultViewModel(w => 1 == 1);
            entityViewModel.FirstName = "Name Updated";
            UsersViewModel resultViewModel = dl.UpdateViewModel(entityViewModel);

            Console.WriteLine(JsonClass.ConvertClassToJson(resultViewModel));

            Users entity = dl.GetFirstOrDefault(w => 1 == 1);
            entity.FirstName = "Name Updated";
            Users result = dl.Update(entity);

            Console.WriteLine(JsonClass.ConvertClassToJson(result));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
UpdateRange
using AutoMapper;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using ConsoleApp.Repository.EntityFrameworks.TestDB.Models;
using ConsoleApp.Repository.ViewModels;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            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();
            });
            DataLayerModelViewModel<TestDBContext, Users, UsersViewModel> dl = new(mapperConfiguration);
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);
            
            List<UsersViewModel> entitiesViewModel = dl.GetAllViewModel().Take(2).ToList();
            entitiesViewModel.ForEach(f => f.FirstName = "Name Updated");
            IQueryable<UsersViewModel> resultViewModel = dl.UpdateRangeViewModel(entitiesViewModel.AsQueryable());

            Console.WriteLine(JsonClass.ConvertClassToJson(resultViewModel));

            List<Users> entities = dl.GetAll().Take(2).ToList();
            entities.ForEach(f => f.FirstName = "Name Updated");
            IQueryable<Users> result = dl.UpdateRange(entities.AsQueryable());

            Console.WriteLine(JsonClass.ConvertClassToJson(result));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}

DapperContext

Execute
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContext<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            int affected = dl.Execute("Insert Into Users (UserId, FirstName, LastName) Values (1, 'Name', 'Surname');");
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
Query
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContext<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            IQueryable<Users> entities = dl.Query<Users>("Select * From dbo.Users");
			Console.WriteLine(JsonClass.ConvertClassToJson(entities));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
QueryFirstOrDefault
using ConsoleApp.Repository.EntityFrameworks.TestDB.Contexts;
using Microsoft.Extensions.Configuration;
using Solution.Framework.Json;
using Solution.Framework.Logger.Enums;
using Solution.Framework.Repository.DataLayers.Classes;
using Solution.Framework.Repository.Models;
using System;
using System.IO;

namespace ConsoleApp.Repository
{
    class Program
    {
        static void Main(string[] args)
        {
            DataLayerContext<TestDBContext> dl = new();
            ConnectionData connectionData = new(connectionString: "Server=.; Database=TestDB;Trusted_Connection=True;Application Name=Repository.Test;", "SqlServer");
            DataLayerConfiguration dataLayerConfiguration = new(connectionData, GetConfiguration(), LogTypeEnum.Application, Environment.UserName);
            dl.Init(dataLayerConfiguration);

            Users entity = dl.QueryFirstOrDefault<Users>("Select * From dbo.Users");
			Console.WriteLine(JsonClass.ConvertClassToJson(entity));
        }

        private static IConfiguration GetConfiguration()
        {
            string path = "appsettings.json";
            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json"))
            {
                path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\") + "appsettings.json";
            }
            return new ConfigurationBuilder().AddJsonFile(path).Build();
        }
    }
}
Product 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 124 2/18/2024
7.0.8 179 11/23/2023
7.0.7 140 11/22/2023
7.0.6 106 11/20/2023
7.0.5 120 11/15/2023
7.0.4 110 11/15/2023
7.0.3 145 11/12/2023
7.0.2 151 9/25/2023
7.0.1 264 2/8/2023
7.0.0 279 1/24/2023
6.0.3 451 8/9/2022
6.0.2 425 8/9/2022
6.0.1 444 8/8/2022
6.0.0 422 8/8/2022
5.0.4 886 12/15/2021
5.0.3 689 10/25/2021
5.0.2 678 10/25/2021
5.0.1 505 10/11/2021
5.0.0 821 10/5/2021