Reform 1.0.0

dotnet add package Reform --version 1.0.0
NuGet\Install-Package Reform -Version 1.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="Reform" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Reform --version 1.0.0
#r "nuget: Reform, 1.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 Reform as a Cake Addin
#addin nuget:?package=Reform&version=1.0.0

// Install Reform as a Cake Tool
#tool nuget:?package=Reform&version=1.0.0

Reform

Reform is an ORM that's extremely easy to use and extend. Stop writing SQL! Use the IReform interface instead. It includes methods like Count, Exists, Select, Insert, Update, Delete, Merge, and even BulkInsert. It supports Symmetric Key entryption and it's fully customizable allowing it to be used even without SQL Server.

Reform puts the C# developer back in control of how data is shaped and manipulated. Define POCOs, add Reform code attributes, and you're done. It includes support for validation and transactions and it’s the perfect tool for ETL applications. Forget all about Martin Fowler’s silly IRepository pattern. Use IReform instead. You’ll be glad you did!

The IReform<T> interface includes the following methods:

  • SqlConnection GetConnection()
  • TransactionScope GetScope();
  • int Count();
  • int Count(SqlConnection connection);
  • int Count(List<Filter> filters);
  • int Count(SqlConnection connection, List<Filter> filters);
  • bool Exists(Filter filter);
  • bool Exists(List<Filter> filters);
  • bool Exists(SqlConnection connection, List<Filter> filters);
  • void Insert(T item);
  • void Insert(List<T> items);
  • void Insert(SqlConnection connection, T item);
  • void Insert(SqlConnection connection, List<T> items);
  • void Update(T item);
  • void Update(List<T> list);
  • void Update(SqlConnection connection, T item);
  • void Update(SqlConnection connection, List<T> list);
  • void Delete(T item);
  • void Delete(List<T> list);
  • void Delete(SqlConnection connection, T item);
  • void Delete(SqlConnection connection, List<T> list);
  • T SelectSingle(List<Filter> filters);
  • T SelectSingle(List<Filter> filters, T defaultObject);
  • T SelectSingle(SqlConnection connection, List<Filter> filters);
  • T SelectSingle(SqlConnection connection, List<Filter> filters, T defaultObject);
  • IEnumerable<T> Select();
  • IEnumerable<T> Select(Filter filter);
  • IEnumerable<T> Select(List<Filter> filters);
  • IEnumerable<T> Select(QueryCriteria queryCriteria);
  • IEnumerable<T> Select(QueryCriteria queryCriteria, out int totalCount);
  • IEnumerable<T> Select(SqlConnection connection, List<Filter> filters);
  • IEnumerable<T> Select(SqlConnection connection, QueryCriteria queryCriteria);
  • void Truncate();
  • void Truncate(SqlConnection connection);
  • void BulkInsert(List<T> list);
  • void BulkInsert(SqlConnection connection, List<T> list);
  • void Merge(List<T> list);
  • void Merge(List<T> list, Filter filter);
  • void Merge(List<T> list, List<Filter> filters);
  • void Merge(SqlConnection connection, List<T> list, List<Filter> filters);

In addition, the Reform<T> implementation supports the following overrides:

  • SqlConnection OnGetConnection()
  • TransactionScope OnGetScope()
  • void OnValidate(SqlConnection connection, T item)
  • int OnCount(SqlConnection connection, List<Filter> filters)
  • bool OnExists(SqlConnection connection, List<Filter> filters)
  • IEnumerable<T> OnSelect(SqlConnection connection, QueryCriteria queryCriteria)
  • void OnInsert(SqlConnection connection, T item)
  • void OnUpdate(SqlConnection connection, T item)
  • void OnDelete(SqlConnection connection, T item)
  • void OnBeforeInsert(SqlConnection connection, T item)
  • void OnBeforeUpdate(SqlConnection connection, T item)
  • void OnAfterInsert(SqlConnection connection, T item)
  • void OnAfterUpdate(SqlConnection connection, T item)
  • void OnBeforeDelete(SqlConnection connection, T item)
  • void OnAfterDelete(SqlConnection connection, T item)
  • void OnTruncate(SqlConnection connection)
  • void OnBulkInsert(SqlConnection connection, List<T> list)
  • void OnMerge(SqlConnection connection, List<T> list, List<Filter> filters)

The Reform implementation is also customizable. You can register your own types to replace portions of Reform functionality. Just use the Reformer.RegisterType method to register your own custom implementation of any of the Reform interfaces.

Sample usage

using System;
using System.Collections.Generic;
using Reform.Attributes;
using Reform.Enum;
using Reform.Interfaces;
using Reform.Logic;
using Reform.Objects;

namespace ReformSample
{
    class Program
    {
        static void Main(string[] args)
        {
            Reformer.RegisterType(typeof(IConnectionStringProvider), typeof(ConnectionStringProvider));

            IReform<SysObjects> logic = Reformer.Reform<SysObjects>();

            IEnumerable<SysObjects> list = logic.Select(new Filter(nameof(SysObjects.Name), Operator.Like, "SYS%"));

            foreach (var item in list)
                Console.WriteLine(item.Name);

            Console.ReadKey();
        }
    }

    [EntityMetadata(DatabaseName="master", TableName="sysobjects")]
    class SysObjects
    {
        [PropertyMetadata(ColumnName = "id")]
        public int Id { get; set; }

        [PropertyMetadata(ColumnName = "name")]
        public string Name { get; set; }
    }

    class ConnectionStringProvider : IConnectionStringProvider
    {
        public string GetConnectionString(string databaseName)
        {
            return $@"Server=.;Database={databaseName};Trusted_Connection=True;";
        }
    }
}

Would you like to see the SQL generated by Reform and performance statistics? Just register your own implementation of IDebugLogger.

   Reformer.RegisterType(typeof(IDebugLogger), typeof(MyDebugLogger));
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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework 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 tizen40 was computed.  tizen60 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
1.0.0 971 4/18/2020