Simplify.FluentNHibernate 3.1.0

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

// Install Simplify.FluentNHibernate as a Cake Tool
#tool nuget:?package=Simplify.FluentNHibernate&version=3.1.0

Simplify.FluentNHibernate Documentation

Provides:

  • FluentConfiguration class extensions which allows you to easily configure your data-base connection.
  • NHibernate ISession extensions which allows you to write queries with lambda expressions.
  • SchemaExporter, SchemaUpdater

Available at NuGet as binary package

Quick Start Example

Configuration through Microsoft.Extensions.Configuration

Session factory setup
namespace MyApp.Database
{
        public class MyDbSessionFactoryBuilder
        {
                private readonly ISessionFactory _instance;

                public ISessionFactory Instance
                {
                        get { return _instance; }
                }

                public MyDbSessionFactoryBuilder(IConfiguration cfg, string configSectionName = "MyDatabaseConnectionSettings")
                {
                        var configuration = Fluently.Configure();
                        configuration.InitializeFromConfigMsSql(cfg, configSectionName);
                        configuration.AddMappingsFromAssemblyOf<MyDbSessionFactoryBuilder>();
                        _instance = configuration.BuildSessionFactory();
                }
        }
}
IConfiguration settings example based on appsettings.json
{
    "MyDatabaseConnectionSettings":
    {
        "ServerName": "Server name",
        "DataBaseName": "data-base name",
        "UserName": "user name",
        "UserPassword": "password",
    }
}

Configuration through *.config files

Session factory setup
namespace MyApp.Database
{
        public class MyDbSessionFactoryBuilder
        {
                private readonly ISessionFactory _instance;

                public ISessionFactory Instance
                {
                        get { return _instance; }
                }

                public MyDbSessionFactoryBuilder(string configSectionName = "MyDatabaseConnectionSettings")
                {
                        var configuration = Fluently.Configure();
                        configuration.InitializeFromConfigMsSql(configSectionName);
                        configuration.AddMappingsFromAssemblyOf<MyDbSessionFactoryBuilder>();
                        _instance = configuration.BuildSessionFactory();
                }
        }
}
Configuration file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
        <configSections>
                <section name="MyDatabaseConnectionSettings" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        </configSections>

        <MyDatabaseConnectionSettings>
                <add key="ServerName" value="Server name" />
                <add key="DataBaseName" value="data-base name" />

                <add key="UserName" value="user name" />
                <add key="UserPassword" value="password" />
        </MyDatabaseConnectionSettings>
</configuration>

FluentNHibernate quick setup variants

Database type Method Comment
Microsoft SQL Server InitializeFromConfigMsSql Connection using System.Data managed driver
MySQL InitializeFromConfigMySql Connection using MySql.Data managed driver
PostgreSQL InitializeFromConfigPostgreSql Connection using Npgsql managed driver
Oracle InitializeFromConfigOracleOdpNet Connection using Oracle.ManagedDataAccess managed driver (recommended for Oracle)
Oracle InitializeFromConfigOracleOdpNetNative Connection using odp.net.x86 or odp.net.x64 unmanaged drivers
Oracle InitializeFromConfigOracleClient Connection using Oracle.DataAccess.x86 or Oracle.DataAccess.x64 unmanaged drivers
SQLite InitializeFromConfigSqLite Connection using System.Data.SQLite managed driver
SQLite InitializeFromConfigSqLiteInMemory Connection using System.Data.SQLite managed driver using in-memory database

Additional configuration options

Option Name Type Description
Port int Database port number
ShowSql bool Executed SQL queries can be displayed (in the output specified in the ShowSqlOutputType parameter) by setting ShowSql option, default values is false
ShowSqlOutputType ShowSqlOutputType Sets the executed SQL commands output type. Possible values: Console, Trace. Default value is: Console

Custom NHibernate configuration

Can be specified via lambda extension, for example, a custom dialect

configuration.InitializeFromConfigMsSql(configSectionName, c => c.Dialect<MsSql2012Dialect>());

Session lambda extensions for data retrieval

Example

var user = session.GetSingleObject(x => x.Name == "FooName");
var users = session.GetList(x => x.Name.StartWith("A"));

More examples here

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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. 
.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 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on Simplify.FluentNHibernate:

Package Downloads
Simplify.Repository.FluentNHibernate

Simplify.Repository FluentNHibernate implementation

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.1.0 92 3/24/2024
3.0.0 209 1/14/2024
2.6.0 342 8/7/2023
2.5.3 2,028 4/15/2023
2.5.2 249 2/27/2023
2.5.1 1,874 10/27/2021
2.5.0 2,053 1/21/2021
2.4.0 1,062 11/17/2020
2.3.0 950 10/7/2020
2.2.0 2,633 4/17/2020
2.2.0-pre01 401 4/17/2020
2.1.0 1,078 3/4/2020
2.0.0 1,527 10/28/2019
1.9.0 8,009 12/13/2018
1.8.0 1,680 5/6/2018
1.7.0 1,044 3/5/2018
1.6.0 1,609 2/9/2017
1.5.1 1,159 1/23/2017
1.5.0 978 8/29/2016
1.4.0 1,016 8/18/2016
1.3.0 1,353 1/24/2016
1.2.1 1,455 10/7/2015
1.2.0 1,705 12/22/2014
1.1.0 1,445 11/12/2014
1.0.2-alpha 892 9/8/2014
1.0.1 1,550 4/23/2014
1.0.0 1,210 2/25/2014