Simplify.FluentNHibernate
2.5.2
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.6.2
This package targets .NET Framework 4.6.2. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Simplify.FluentNHibernate --version 2.5.2
NuGet\Install-Package Simplify.FluentNHibernate -Version 2.5.2
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.5.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Simplify.FluentNHibernate --version 2.5.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Simplify.FluentNHibernate, 2.5.2"
#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.5.2 // Install Simplify.FluentNHibernate as a Cake Tool #tool nuget:?package=Simplify.FluentNHibernate&version=2.5.2
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. 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 is compatible. 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.
-
.NETFramework 4.6.2
- FluentNHibernate (>= 3.1.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 6.0.0)
-
.NETStandard 2.0
- FluentNHibernate (>= 3.1.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 6.0.0)
-
net6.0
- FluentNHibernate (>= 3.1.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 6.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 |
---|---|---|
3.2.0 | 229 | 4/26/2024 |
3.1.0 | 134 | 3/24/2024 |
3.0.0 | 491 | 1/14/2024 |
2.6.0 | 411 | 8/7/2023 |
2.5.3 | 2,297 | 4/15/2023 |
2.5.2 | 287 | 2/27/2023 |
2.5.1 | 1,933 | 10/27/2021 |
2.5.0 | 2,095 | 1/21/2021 |
2.4.0 | 1,112 | 11/17/2020 |
2.3.0 | 989 | 10/7/2020 |
2.2.0 | 2,685 | 4/17/2020 |
2.2.0-pre01 | 415 | 4/17/2020 |
2.1.0 | 1,118 | 3/4/2020 |
2.0.0 | 1,581 | 10/28/2019 |
1.9.0 | 8,048 | 12/13/2018 |
1.8.0 | 1,719 | 5/6/2018 |
1.7.0 | 1,072 | 3/5/2018 |
1.6.0 | 1,650 | 2/9/2017 |
1.5.1 | 1,200 | 1/23/2017 |
1.5.0 | 1,002 | 8/29/2016 |
1.4.0 | 1,040 | 8/18/2016 |
1.3.0 | 1,408 | 1/24/2016 |
1.2.1 | 1,502 | 10/7/2015 |
1.2.0 | 1,725 | 12/22/2014 |
1.1.0 | 1,476 | 11/12/2014 |
1.0.2-alpha | 914 | 9/8/2014 |
1.0.1 | 1,588 | 4/23/2014 |
1.0.0 | 1,246 | 2/25/2014 |