FluentFramework 2.2.1
.NET Core 2.0
.NET Standard 2.0
.NET Framework 4.6.1
dotnet add package FluentFramework --version 2.2.1
NuGet\Install-Package FluentFramework -Version 2.2.1
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="FluentFramework" Version="2.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FluentFramework --version 2.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: FluentFramework, 2.2.1"
#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 FluentFramework as a Cake Addin
#addin nuget:?package=FluentFramework&version=2.2.1
// Install FluentFramework as a Cake Tool
#tool nuget:?package=FluentFramework&version=2.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Implementation
- Create an implementation as like below and configure your connection. You can use different database connections instead of SQLite of course! Others are in FluentNHibernate.Cfg.Db namespace.
public class DefaultConnection : IConnectionConfigurer
{
public IPersistenceConfigurer Configuration()
{
return SQLiteConfiguration.Standard.ConnectionString("Data Source=Database.db;Version=3;");
}
}
- Adding configuration to service example.
public partial class App : Application
{
public App()
{
ConnectionDescriptors.Add<DefaultConnection>(true, false, false);
}
}
- Entity example;
public class Book : Entity<DefaultConnection>
{
public virtual string Name { get; set; }
public virtual User User { get; set; }
public override bool OnPreInsert()
{
return Name != "maybe a banned word check?"; //cancel
}
public override bool OnPreUpdate()
{
return true;
}
public override bool OnPreDelete()
{
return true;
}
}
- Mapping example;
public class BookMap : EntityMap<Book, DefaultConnection>
{
public BookMap()
{
Map(x => x.Name).Not.Nullable();
References(x => x.User).Not.Nullable();
}
}
- Query example;
public User GetUser(string username)
{
using (var repository = new Repository<DefaultConnection>())
{
return repository.Query<User>().Where(x => x.Username == username).SingleOrDefault();
}
}
- Transaction example;
public void AddBook(string bookName, User user)
{
using (var repository = new Repository<DefaultConnection>())
{
repository.Transaction.Begin();
var book = new Book { Name = bookName, User = user };
repository.Add(book);
repository.SaveChanges();
if(!doSomethingWithBook(book))
{
repository.Transaction.Rollback();
}
}
}
Examine the project to see what you can do more.
Features
- Caching
- Multiple ways of ID generation such as Identity, Sequence, HiLo, GUID, Pooled, and the Native mechanism used in databases. Uses Native by default.
- Lazy Loading
- Generation and updating system like migration API in Entity framework.
- Cryptography helper for hashing and verifying passwords.
- JSON entity serialization
- Multiple database connections
- Multiple database providers
- SQL Server
- SQL Server Azure
- Oracle
- PostgreSQL
- MySQL
- SQLite
- DB2
- Sybase Adaptive Server
- Firebird
- Informix
- It can even support the use of OLE DB (Object Linking and Embedding) and ODBC (Open Database Connectivity).
Product | Versions 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. |
.NET Core | netcoreapp2.0 is compatible. 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 is compatible. 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)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 2.0
- CG.Pluralization (>= 0.3000.12)
- FluentNHibernate (>= 2.1.2)
- Newtonsoft.Json (>= 12.0.2)
-
.NETFramework 4.6.1
- CG.Pluralization (>= 0.3000.12)
- FluentNHibernate (>= 2.1.2)
- Newtonsoft.Json (>= 12.0.2)
-
.NETStandard 2.0
- CG.Pluralization (>= 0.3000.12)
- FluentNHibernate (>= 2.1.2)
- Newtonsoft.Json (>= 12.0.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on FluentFramework:
Package | Downloads |
---|---|
FluentFramework.Observing
FluentFramework.Observing is a helper tool to make database observing easy. |
GitHub repositories
This package is not used by any popular GitHub repositories.