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
2 answers

Formula Mapping in NHibernate to Functions in SQLite or Override Mapping

i found the following article http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx to help me unit test my NHibernate application. Most of my tests are working fine but a strange error has been thrown. From looking at the SQL…
nfplee
  • 7,643
  • 12
  • 63
  • 124
2
votes
1 answer

How to Map a ValueObject Collection with Foreign Keys in FluentNHibernate

I've been looking all over for an example of this, but it seems pretty uncommon. Hopefully some NHibernate guru will know. I have the following class which, by my understanding of Value Objects, is a Value Object. Assume every user has the…
sydneyos
  • 4,527
  • 6
  • 36
  • 53
2
votes
1 answer

Child objects not being populated only when using SQLite (Works in SQL Server)

I have a Fluent NHibernate mapping that works as expected when I run it against the actual SQL Server database but that is not populting a collection of child objects when run against SQLite. The structure that is being queried is a self-referential…
Hamman359
  • 1,052
  • 2
  • 14
  • 27
2
votes
1 answer

Nhibernate Concurrency between multiple session

I have a table that consists of a column of pre-populated numbers. My API using Nhibernate grabs the first 10 rows where 'Used' flag is set as false. What would be the best possible way to avoid concurrency issue when multiple session try to grab…
Sabby62
  • 1,707
  • 3
  • 24
  • 37
2
votes
3 answers

NHibernate delete problem in one-to-many relationship

I have mapping for A and B classes, where 'one' side is A and 'many' side is B. B references A where foreign key is not nullable. Mapping of A set as Cascade.Delete() for B with FluentNH. When I try to delete A, NHibernate tries to update B and set…
rovsen
  • 4,932
  • 5
  • 38
  • 60
2
votes
2 answers

nHibernate to Json

I'm aware there are lots of questions around this topic but I really can't seen to nail down a solution so would appreciate some help. I've just started with S#arp Architecture, and haven't used nHibernate much before either (and not even that…
Ben
  • 1,767
  • 16
  • 32
2
votes
1 answer

Fluent NHibernate- ClassMap inheritance?

In an earlier question (unrelated to Fluent NHibernate- I've switched as a result of my problem) I outlined a table layout issue I'm having where I need to split my Listing entities across a number of tables depending on what country they're from.…
Alastair
  • 5,894
  • 7
  • 34
  • 61
2
votes
1 answer

Refreshing collections filtered in the mapping

I have a collection which is filtered at the mapping level to enable soft deletion using an "isDeleted" column in the database. The mapping looks like this: HasMany(x => x.UploadedFiles).Where("IsDeleted = 0") When I set the isDeleted property for…
Variant
  • 17,279
  • 4
  • 40
  • 65
2
votes
1 answer

How does nhibernate store TimeSpan in Mysql?

I have a TimeSpan field stored by NHibernate in a MySQL database. The fluent mapping looks like this: Map(x => x.StartTime); Map(x => x.EndTime); Nothing special, no special types set. In the DB, 13:00 and 14:00 show up respectively 468000000000…
Matthew Goulart
  • 2,873
  • 4
  • 28
  • 63
2
votes
2 answers

F#: Lookup on object of indeterminate type When using FluntNHibernate

I try to configure NHibernate in F# project by FluentNHibernate. static member GetNHibernateConfig = Fluently.Configure() .Database(MsSqlConfiguration.MsSql2008 .ConnectionString(fun c ->…
Shakirov Ruslan
  • 323
  • 3
  • 8
2
votes
1 answer

NHibernate: Custom Property Accessor's Get and Set methods not being called

I'm attempting to map a database field ("LS_RECNUM") possible values of NULL, 'M' and 'F' to a property with a Gender enumeration type. The mapping looks like this: Map(x =>…
David
  • 15,750
  • 22
  • 90
  • 150
2
votes
1 answer

Full Linq Query Instead of Lambdas with Fluent-NHibernate?

I'm trying to use Fluent-NHibernate's Query method which looks like this: public T[] Query(Expression> where) { return _session.Linq().Where(where).ToArray(); } I'm using VB, so to send it a…
Josh Pollard
  • 105
  • 2
  • 4
2
votes
1 answer

Serialize nHibernate query to JSON

In delving into Fluent nHibernate, I discovered a potential breaker for using it... Given the following POCO code. public class Customer { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual Details…
Ciel
  • 17,312
  • 21
  • 104
  • 199
2
votes
2 answers

How to test generate tables with fluent nhibernate (schemaexport)? in asp.net context

well this is my very very first project with fluent hibernate.i've had small experience in hibernate and nhibernate. This context is completely new to me since this is a web app project. So i have my webapp project with most of the fluent nhibernate…
black sensei
  • 6,528
  • 22
  • 109
  • 188
2
votes
2 answers

NHibernate Linq Query Where(x => x is Base Class) doesn't get derived objects

Let's say I have the following structure, mapped with a discriminator (Table per hierarchy): Entity (abstract, no discriminator) | Animal (abstract, no discriminator) / \ Dog (1) Cat(2) If I query on this using Linq to…
AlexDev
  • 4,049
  • 31
  • 36
1 2 3
99
100