Simplify.FluentNHibernate
2.6.0
.NET 6.0
.NET Standard 2.0
.NET Framework 4.8
dotnet add package Simplify.FluentNHibernate --version 2.6.0
NuGet\Install-Package Simplify.FluentNHibernate -Version 2.6.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="2.6.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Simplify.FluentNHibernate --version 2.6.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Simplify.FluentNHibernate, 2.6.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=2.6.0
// Install Simplify.FluentNHibernate as a Cake Tool
#tool nuget:?package=Simplify.FluentNHibernate&version=2.6.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Simplify.FluentNHibernate Documentation
Provides:
FluentConfiguration
class extensions which allows you to easy configure your data-base connection- NHibernate
ISession
extensions which allows you to write queries with lambda expressions SchemaExporter
Available at NuGet as binary package
Quck Start Example
Session factory configuration and creation
namespace MyApp.Database
{
public class MyDbFactoryManager
{
private readonly ISessionFactory _instance;
public ISessionFactory Instance
{
get { return _instance; }
}
public MyDbFactoryManager(string configSectionName = "MyDatabaseConnectionSettings")
{
var configuration = Fluently.Configure();
configuration.InitializeFromConfigMsSql(configSectionName);
configuration.AddMappingsFromAssemblyOf<UserMap>();
_instance = configuration.BuildSessionFactory();
}
}
}
App.config or Web.config data-base configuration
<?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>
A port number can be specified via Port parameter:
<add key="Port" value="1234" />
Configuration with the Microsoft.Extensions.Configuration
IConfiguration
implementation with ability to specify settings section name
namespace MyApp.Database
{
public class MyDbFactoryManager
{
private readonly ISessionFactory _instance;
public ISessionFactory Instance
{
get { return _instance; }
}
public MyDbFactoryManager(IConfiguration cfg, string configSectionName = "MyDatabaseConnectionSettings")
{
var configuration = Fluently.Configure();
configuration.InitializeFromConfigMsSql(cfg, configSectionName);
configuration.AddMappingsFromAssemblyOf<UserMap>();
_instance = configuration.BuildSessionFactory();
}
}
}
IConfiguration settings based on appsettings.json example:
{
"MyDatabaseConnectionSettings":
{
"ServerName": "Server name",
"DataBaseName": "data-base name",
"UserName": "user name",
"UserPassword": "password",
}
}
Additional NHibernate configuration can be specified, for example, a custom dialect
configuration.InitializeFromConfigMsSql(configSectionName, c => c.Dialect<MsSql2012Dialect>());
Session lambda extensions example
var user = session.GetObject(x => x.Name == "FooName");
var users = session.GetList(x => x.Name.StartWith("A"));
More examples here
Tracing SQL queries
Executed SQL queries can be displayed in console/(VS output window) by setting ShowSql
option in settings:
<?xml version="1.0" encoding="utf-8"?>
<MyDatabaseConnectionSettings>
...
<add key="ShowSql" value="true" />
...
</MyDatabaseConnectionSettings>
</configuration>
Product | Versions 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. |
.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)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.8
- FluentNHibernate (>= 3.2.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 7.0.0)
-
.NETStandard 2.0
- FluentNHibernate (>= 3.2.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 7.0.0)
-
.NETStandard 2.1
- FluentNHibernate (>= 3.2.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 7.0.0)
-
net6.0
- FluentNHibernate (>= 3.2.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 7.0.0)
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 |
---|---|---|
2.6.0 | 156 | 8/7/2023 |
2.5.3 | 718 | 4/15/2023 |
2.5.2 | 207 | 2/27/2023 |
2.5.1 | 1,815 | 10/27/2021 |
2.5.0 | 1,983 | 1/21/2021 |
2.4.0 | 1,040 | 11/17/2020 |
2.3.0 | 917 | 10/7/2020 |
2.2.0 | 2,567 | 4/17/2020 |
2.2.0-pre01 | 391 | 4/17/2020 |
2.1.0 | 1,045 | 3/4/2020 |
2.0.0 | 1,494 | 10/28/2019 |
1.9.0 | 7,187 | 12/13/2018 |
1.8.0 | 1,631 | 5/6/2018 |
1.7.0 | 1,003 | 3/5/2018 |
1.6.0 | 1,551 | 2/9/2017 |
1.5.1 | 1,116 | 1/23/2017 |
1.5.0 | 935 | 8/29/2016 |
1.4.0 | 976 | 8/18/2016 |
1.3.0 | 1,311 | 1/24/2016 |
1.2.1 | 1,412 | 10/7/2015 |
1.2.0 | 1,655 | 12/22/2014 |
1.1.0 | 1,416 | 11/12/2014 |
1.0.2-alpha | 858 | 9/8/2014 |
1.0.1 | 1,501 | 4/23/2014 |
1.0.0 | 1,165 | 2/25/2014 |