MKTS.DWrapperFramework 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MKTS.DWrapperFramework --version 1.1.0                
NuGet\Install-Package MKTS.DWrapperFramework -Version 1.1.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="MKTS.DWrapperFramework" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MKTS.DWrapperFramework --version 1.1.0                
#r "nuget: MKTS.DWrapperFramework, 1.1.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 MKTS.DWrapperFramework as a Cake Addin
#addin nuget:?package=MKTS.DWrapperFramework&version=1.1.0

// Install MKTS.DWrapperFramework as a Cake Tool
#tool nuget:?package=MKTS.DWrapperFramework&version=1.1.0                

using DWrapperFramework; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace TestDWrapperFramework { public class Program { static void Main(string[] args) { string connectionString = "Data Source=.\SqlExpress;Initial Catalog=TestMKWrapper;Integrated Security=True;Pooling=False"; Program p = new Program(); //Test1 //p.Insert(connectionString);

        //Test5
        //p.SelectSingle(connectionString);

       
        //Test8
        //p.Update(connectionString);

        //Test11
        //p.DeleteConnectionOriented(connectionString);

        //Test12
        //p.DWrapperMapSP(connectionString);

        //Test13
        p.GetItems(connectionString);

        //Test14
        //p.Execute(connectionString);
    }

    #region Insert Test
    public void Insert(string connectionString)
    {
        DWrapper wrapper = new DWrapper(connectionString);

        Employee emp = new Employee();
        emp.Name = "Test";
        emp.City = "Roorkee";
        emp.Salary = 10000;
        wrapper.Insert<Employee>(emp);

        Console.WriteLine("Id " + emp.Id);
        Console.WriteLine("Name " + emp.Name);
        Console.WriteLine("City " + emp.City);
    }
    #endregion

    #region Select Test
    public void SelectSingle(string connectionString)
    {
        DWrapper wrapper = new DWrapper(connectionString);
        Employee emp = wrapper.SelectSingle<Employee>(new { Id=1});
        Console.WriteLine("Id " + emp.Id);
        Console.WriteLine("Name " + emp.Name);
        Console.WriteLine("City " + emp.City);
    }
    #endregion

    #region Update Test
    public void Update(string connectionString)
    {
        DWrapper wrapper = new DWrapper(connectionString);

        Employee emp = new Employee();
        emp.Name = "UpdateTest";
        emp.City = "Roorkee";
        emp.Salary = 10000;
        emp.Id = 1;
        wrapper.Update<Employee>(emp);

        Console.WriteLine("Id " + emp.Id);
        Console.WriteLine("Name " + emp.Name);
        Console.WriteLine("City " + emp.City);
    }
    #endregion

    #region Delete Test
    
    public void DeleteConnectionOriented(string connectionString)
    {
        DWrapper wrapper = new DWrapper(connectionString);
        using (wrapper.GetOpenConnection())
        {
            using (var transaction = wrapper.BeginTransaction())
            {
                try
                {
                    Employee emp = new Employee();
                    emp.Name = "Test";
                    emp.City = "Roorkee";
                    emp.Salary = 10000;
                    emp.Id = 2;
                    wrapper.DeleteConnectionOriented<Employee>(emp);
                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                }
            }
        }
    }
    #endregion

    #region Stored Procedure Test
    public void DWrapperMapSP(string connectionString)
    {
        DWrapper wrapper = new DWrapper(connectionString);
        var dynamicData=wrapper.DWrapperMapSP<dynamic>("sp_ReadEmployeeById", new { Id = 3 });
        //string objectString = JsonConvert.SerializeObject(dynamicData);
        if(dynamicData.Count>0)
        {
            foreach(var emp in dynamicData)
            {
                Console.WriteLine("Name " + emp.Name);
                Console.WriteLine("Salary " + emp.Salary);
            }
        }
        else
        {
            Console.WriteLine("Name " + dynamicData.Name);
            Console.WriteLine("Salary " + dynamicData.Salary);
        }
    }

    #endregion

    #region Direct Query Test
    public void GetItems(string connectionString)
    {
        DWrapper wrapper = new DWrapper(connectionString);
        using (wrapper.GetOpenConnection())
        {
            var empList = wrapper.GetItems<dynamic>(System.Data.CommandType.Text, "Select * from Employee where id=@Id", new { Id = 4 });

        }
    }

    public void Execute(string connectionString)
    {
        DWrapper wrapper = new DWrapper(connectionString);
        using (wrapper.GetOpenConnection())
        {
            var empList = wrapper.Execute<dynamic>(System.Data.CommandType.Text, "Update Employee set name=@Name where id=@Id", new { Id = 8, Name = "Mukammil" });
        }
    }
    #endregion 
}

public class Employee
{
    public int Id { get; set; }

    public string Name { get; set; }

    public string City { get; set; }

    public decimal Salary { get; set; }
}

}

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 is compatible.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.4 is compatible.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 was computed.  netstandard2.1 was computed. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
2.0.0 2,163 8/22/2019
1.1.0 985 7/9/2018

DWrapper Framework is now available for dot net core and standard