fluent-nhibernate

FluentNHibernate: mapping a Version property

How do I map a Version property using conventions (e.g. IClassConvention, AutomapperConfiguration)? public abstract class Entity { ... public virtual int? Version { get; protected set; } ... } <class ...> <version name="Version" column="version" generated="never" type="Int32" unsaved-value="0" /> </class> ...

Should i care/have knowledge about nHibernate before choosing Fluent nHibernate?

I was going through Fluent nhibernate wiki and i know that Fluent nhibernate is built on top of nHibernate... Should i care/have knowledge about nHibernate before choosing Fluent nHibernate? Any suggestion... ...

Fluent NHibernate - good complete working Helper class for managing SessionFactory/Session?

I was going through nHibernate Helper Class question on SO... I would like to get a helper class for fluent nHibernate... can anyone provide/refer a proper OO type helper class for managing a singleton of the SessionFactory and then also for managing Sessions? ...

FluentNHibernate AutoMapping: two References to the same table and constraint problem

I am using trunk version of FluentNHibernate (AutoMapping) with SQL Server 2008. In my code the class User references two instances of class PublicationsList, it looks like this: public class User : EntityBase { public virtual PublicationsList Booklog { get; private set; } public virtual PublicationsList Library { get; private s...

Inner or Right Outer Join in Nhibernate and Fluent Nhibernate on Many to Many collection

How can I force NHibernate to do a RIGHT outer join or an INNER join instead of a LEFT outer join on a many to many collection? The reason I would want to do this is because of filtering applied to the collection elements. With a left join, you get the same number of rows returned as an unfiltered query, but the elements that are filter...

Foreign Keys with SchemaExport in Fluent NHibernate using SQLite

I am attempting to create a simple database application which keeps track of loans of various types of equipment using Fluent NHibernate and SQLite. However, when I try to generate the database structure with SchemaExport for use in unit testing, foreign keys for one-to-many relationships aren't created. Here is my Equipment entity: pu...

In Fluent NHibernate, how would I map the following domain models?

I have a user class that looks something like this public class User { public virtual int Id { get; set; } public virtual long ValueA { get; set; } public virtual int? ValueB { get; set; } } ValueA is automatically assigned by the system. It is used in a lookup that would map to UserClass. However, if a value for ValueB ...

Retrive all data from mysql table using fluent nhibernate step by step process..

As i am a newbie to fluent nhibernate i would like to get step by step tutorial that explains configuring mysql with fluent nhibernate and retriving a table data from it... Any suggestion.... ...

good/simple asp.net mvc application with fluent nhibernate..

Where can i find a good/simple asp.net mvc application with fluent nhibernate? Any suggestion.. ...

NHibernate Event when data loaded using CreateCriteria

what event is fired when data loaded using CreateCriteria? i want to modify the data behavior before it is returned by CreateCriteria. im not lucky to find any documentation about Event system. i have tried IPostCollectionRecreateEventListener but i found that the OnPostRecreateCollection is never called. please anyone can provide me a...

Fluent Nhibernate Connect to Firebird

I'm having trouble getting a connection to a Firebird database. I can't seem to find too much information on Fluent NHibernate and Firebird on the Internet which lead me to here. Can anyone provide any insight on how to connect Fluent NHibernate to a Firebird database in C#? I'm specifically writing a WPF application. ...

Using fluent-nhibernate is it possible to automap a Value Object(s) inside an Entity?

I'm using Sharp Architecture and have a number of situations where Value Objects are used in an Entity. Here is an obvious simple example: public class Person : Entity { protected Person(){} public Person(string personName) { this.PersonName = personName; } public virtual string PersonName { get; protected ...

How to map these classes the correct way with Fluent NHibernate?

Hello all, I have the 2 following classes: public class Player : BaseEntity<int, Player> { public string FirstName { get; set; } public string LastName { get; set; } public int Number { get; set; } public IList<Team> Teams { get; set; } public void AddTeam(Team team) { ...

Fluent Nhibernate - Specify foreign key constraint name between class and joined subclass

Hi, I think this should be simple, but I can't figure out how to do it. Suppose I have the following maps: public class AnimalMap : ClassMap<Animal> { Id( x => x.Id); } public class CatMap: SubclassMap<Cat> { Extends<AnimalMap>(); Map(x => x.IsDomestic); } Which creates tables as I expect: Animal ------ Id Cat ---- Animal...

Can anyone provide a C# example of SQLite "SetTimeout"?

I'm using SQLite (system.data.sqlite v. 1.0.60.0) on a Fluent NHibernate project. I have one program that writes to the DB, and another that reads from it. Occasionally, I get SQLITE_BUSY exceptions, and I need to fix this. I found several Google references to sqlite_busy_timeout, which (if I understand correctly) will cause SQLite to...

Can NHibernate be configured fluently to delete children when their references are set to null?

I've heard this can also be accomplished with triggers, but I'd rather not go that road if I can. Right now it seems like nulling references to child objects just leaves them orphaned in the database, which isn't ideal to say the least. Thanks! ...

FluentNHibernate IDctionary with manytomany

I have a mapping structured in this way: public class Person { public IDictionary<bool, Action> Actions { get; set; } } public class Action { public string Name { get; set; } } // Map for Person public class PersonMap : ClassMap<Person> { public PersonMap() { Id(x => x.Id) ... Map(x => x.Name) ... Table(...

Maintaining Referential Integrity on Insert with NHibernate

I have figured out a lot about nhibernate, but this seems to be my final hurdle of not understanding what is going on. So here is the problem. I have a basic databas structure: Shows: ID [Pk] CountryID [Fk] Name Countries: ID [Pk] Name CountryID has a foriegn key reference from shows to countries table primary key, and countries is ...

How do I map a property with no setter and no backing property fluently with NHibernate?

Let's say I have the following entity: public class CalculationInfo { public virtual Int64 Id { get; set; } public virtual decimal Amount { get; set; } public virtual decimal SomeVariable { get; set; } public virtual decimal SomeOtherVariable { get; set; } public virtual decimal CalculatedAmount { ge...

S#arp Architecture Repository.DbContext.CommitTransaction() unusual behaviour

Hi guys, I am facing an unusual behaviour with the Repository and Transactions and its making me mad. I have two simple POCO classes Action and Version as follows. There is a one to many relationship from Action->Version. public class Action : Entity { public virtual string Name { get; set; } public vi...