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
1 answer

Nhibernate one to many delete not working

Hi I have a one to many ComplianceSet -> ComplianceItem. ComplianceItem has a one to many ComplianceItem -> ComplianceItemInstance. I have ComplianceSet HasMany(x =>…
Raif
  • 8,641
  • 13
  • 45
  • 56
2
votes
1 answer

Fluent nHibernate Startup still slow even with persistent configuration optimization

We're trying to reduce the Fluent nHibernate startup overhead. All the articles we've seen on this subject (including this one) make the following two suggestions: Persist the configuration on the first run and restore that subsequently, instead of…
bright
  • 4,700
  • 1
  • 34
  • 59
2
votes
3 answers

Select N Random Rows with Fluent NHibernate

How do I retrieve N random entities using Fluent NHibernate? Desired query: SELECT TOP 5 * FROM MyTable ORDER BY newid() I'd like to be able to use the Linq repo's for this, but I'm not sure if the result will be optimal. I am not familiar with…
Petrus Theron
  • 27,855
  • 36
  • 153
  • 287
2
votes
3 answers

How to resolve poor nHibernate collection initialization

nHibernate3; retrieving 4xxx records out of an EAV data schema. When nHibernate, or .NET, goes to initialize those collections for the first time, we're seeing a severe penalty. Subsequent calls appear to perform more efficiently. Running the same…
andrewbadera
  • 1,372
  • 9
  • 19
2
votes
1 answer

NHibernate, NHibernate.Linq, and FluentNHibernate? Throwing error

I had the following error at previous question: Fluent NHibernate? Am I doing this correctly? But, now, when I call the function: LoginRepository login = new LoginRepository(); var allLogins = login.GetAllLogins().ToList(); It throws an error…
Sean
  • 2,496
  • 7
  • 32
  • 60
2
votes
1 answer

How do I turn off Identifiergeneration in fluent nhibernate when using automapping

I use NHibernate 3.0 with fluent configuration. I automap my persistent model like this: AutoMap .AssemblyOf() .Where(type => type.Namespace != null && type.Namespace.Contains("PersistendModel")) This works fine, but I don't…
k.c.
  • 1,755
  • 1
  • 29
  • 53
2
votes
1 answer

how can I use multiple databases in an web application leveraging orchard CMS?How should I specify the same in settings.txt file?

I am working on a web application which uses Orchard CMS framework to leverage the modular,multi-tenant feature .I have multiple modules and all are working fine with the current SQL server DB(say DB1) which I have mentioned in the settings.txt…
2
votes
1 answer

Connecting to Postgres using Fluent NHibernate throws Exception

Here is my Hibernate settings: FluentConfiguration configuration = Fluently.Configure() .Database(PostgreSQLConfiguration.Standard.ConnectionString(c => c .Host("localhost") .Port(5432) …
Edwin Bautista
  • 463
  • 3
  • 17
2
votes
1 answer

Fluent NHibernate: how to specify column name for reference in component using conventions?

It is possible to create ComponentConvention, but this code does not work because References collection is collection of IManyToOneInspector and not IManyToOneInstace. Is there any other way to specify column? public class ComponentConvention :…
xelibrion
  • 2,220
  • 1
  • 19
  • 24
2
votes
4 answers

How can I prevent a SQL incorrect syntax error when mapping a one-to-many relationship in Fluent NHibernate when using a custom collection class?

I am trying to map a one-to-many relationship in Fluent NHibernate where the collection property is an custom collection class. I am using a protected InnerList property on the collection class to expose the collection but am getting a SQL error…
Val M
  • 899
  • 6
  • 16
  • 26
2
votes
2 answers

Fluent NHibernate not auto-mapping one-to-many property in base class

Let's say I have an abstract base class defined as follows: public abstract class CompanyBase : EntityBase { public virtual string Name { get; set; } public virtual StreetAddress Address { get; set; } public virtual…
Josh Anderson
  • 5,975
  • 2
  • 35
  • 48
2
votes
2 answers

NHibernate MappingException: no persister for byte[]

I'm using NHibernate to store downloads in my MySQL database for an ASP.NET MVC website. I am using to classes. One called Download for the download itself and one called DownloadContent for the file itself (so I can load it easier when I just want…
Teo Klestrup Röijezon
  • 5,097
  • 3
  • 29
  • 37
2
votes
2 answers

NHibernate : unexpected session trouble when persisting object

I'm having trouble with some NHibernate Code.Basically I'm trying to keep session lifetime as short as possible to minimize state information in the application. I find it rather hard to describe my problem without being specific, so I'll just go…
Sebastian Edelmeier
  • 4,095
  • 3
  • 39
  • 60
2
votes
1 answer

Fluent NHibernate automap configuration throwing vague error

I'm trying out the automapping capability of Fluent NHibernate, and the same code that worked with explicit ClassMap configurations is failing when building the SessionFactory when I try to move it to automapping. Here's the code: public static…
Josh Anderson
  • 5,975
  • 2
  • 35
  • 48
2
votes
2 answers

Need help with NHibernate assembly version issue. Error with loading the correct assembly version

NOTE I closed my other ticket that was to localized. So I am having a problem like I see other posters have had after using NuGet to install FluentNhibernate: ERROR Could not load file or assembly 'NHibernate, Version=3.0.0.2001,…
pghtech
  • 3,642
  • 11
  • 48
  • 73