Questions tagged [fluent-nhibernate]

Fluent NHibernate lets you write NHibernate mappings in strongly typed C# code. This allows for easy refactoring, improved readability and more concise code.

Fluent NHibernate offers an alternative to NHibernate's standard XML mapping files. Rather than writing XML documents (.hbm.xml files), Fluent NHibernate lets you write mappings in strongly typed C# code. This allows for easy refactoring, improved readability and more concise code.

Installation Fluent NHibernate can most easily be installed through its NuGet package.

Install-Package FluentNHibernate

Resources

5486 questions
2
votes
3 answers

(Fluent) NHibernate : One entity composed of fields from different tables

Is there a way of writing an NHibernate mapping so that you can have an entity that is composed of fields from different DB tables? For Example is I have a Person and Address table, I want address fields to appear in my person object. I want an…
Dan
  • 29,100
  • 43
  • 148
  • 207
2
votes
1 answer

Emulate AFTER UPDATE ... FROM DELETED Trigger with NHibernate Event Listener

Using an NHibernate Event Listener, how do I access the previous entity state when an update occurs, so I can insert the replaced entity into my revisions table? In SQL Server, I use the following trigger: CREATE TRIGGER Trg_PostChange ON…
Petrus Theron
  • 27,855
  • 36
  • 153
  • 287
2
votes
2 answers

NHibernate Configuration Problem

Can anybody help me. My aim is, to use always the same database. By me it overrides all my data. I get this error: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException…
user721654
  • 21
  • 1
2
votes
1 answer

How do i connect from FluentNhibernate to postgres using ssl authentication

We were able to establish a connection with regular (username and password) now we want to connect via ssl. I'm trying to connect to postgresql server with nhibernate (v4.0) using ssl certificate. I'm getting error message "connection requires a…
2
votes
1 answer

How to take this sql query and turn it into nhibernate query

I am trying take this sql query and make it into an nhibernate HQL query. I am using nhibernate 3 and Fluent Nhibernate 1.2 SELECT dbo.Tasks.CourseId, dbo.CoursePermissions.BackgroundColor, dbo.Tasks.DueDate, dbo.Tasks.TaskName,…
chobo2
  • 83,322
  • 195
  • 530
  • 832
2
votes
4 answers

Problem mapping composite key with NHibernate (column already been added)

new to NHibernate (and Hibernate for that matter), and I'm struggling with a composite key problem. Here's a simplified version of part of the database design. table_a +---------------------+ | * a_id varcha (10) | table_z …
Eric Boisvert
  • 135
  • 3
  • 9
2
votes
1 answer

Cascade.All() not delete cascade, why?

I need to delete EndPoint members which are mapped on SlotTransceivers and Ports. In Past, EndPoint didn't has own table, this cklass was part of SlotTransceiver and Port. Problem is that because creating Connection, rhitch has reference to…
Zdenek
  • 21
  • 3
2
votes
2 answers

Access multiple databases using fluent nhibernate in .netcore

I'm new to nHibernate and trying to use it with .Net core for multiple sql server databases. I've gone through the docs and created Isessionfactoty and configured it in startup but when I try to access the session object in repository method, I'm…
2
votes
2 answers

Preventing delete/insert when modifying many-to-many relationship with NHibernate

In my domain model a User is associated with many Places - the relationship is modelled via a UserPlace class and a mapping (with FluentNHibernate) as follows (the User has a collection of UserPlace called Neighbourhood: public class UserMap :…
Øyvind
  • 1,600
  • 1
  • 14
  • 33
2
votes
2 answers

Database per tenant with Fluent NHibernate & StructureMap

I'm currently using StructureMap to inject an NHibernateRegistry instance into my DAL, which configures NHibernate for a single connection string and bootstraps a Singleton FluentConfiguration for my single-user app. How should I modify my Fluent…
2
votes
2 answers

How does one map multiple classes to one table through NHibernate?

I have an Employee class with a Name property of class Name and a Contact property of type Contact. The Name class has two string properties: FirstName and LastName and the Contact class has properties like PhoneNumber and EmailAddress. All of the…
Lance Harper
2
votes
1 answer

Data access : Fluent Nhibernate vs ADO.NET vs Linq to Sql?

Creating My Windows Form Application and using ADO.Net as Data Access layer and SQL server as my Back End with lots of SP's. Do i still stick to ADO.NET or go to studying FnH or Linq to SQL? Which shall i choose? Or i still stick in ADO.NET? Can…
2
votes
1 answer

Composite keys fluent nhibernate

Can one do this on a fluent nhibernate ? When I try to save, I am profiding the profile and the scenario objects and the id's are not null. Nhibernate complains that it can't insurt NULL for ProfileID column. Fluent Nhibernate doesn't know how to…
Erion
  • 644
  • 1
  • 6
  • 19
2
votes
1 answer

Fluent NHibernate 3.1 error on all queries

Since upgrading to Fluent NHibernate 3.1, I keep getting errors on all my queries. For example I have some simple code, like this: public bool isUsernameFree(string username) { return _session.Query() .Where(u => u.username ==…
Leon
  • 542
  • 1
  • 6
  • 15
2
votes
1 answer

Storing images in database results in partial image

I'm trying to store images in a sql server database. I've got a column in an Image table which stores the data and is of type varbinary(max). I'm using NHibernate to access the database. The loading of the image into the code and converting it to a…
VARAK
  • 835
  • 10
  • 27