fluent-nhibernate

Generate Multiple Schemas using Fluent nHibernate

I'm a newbie to nHibernate, and Fluent nHibernate, and I'm having a great deal of trouble with some simple setup on something. private static ISessionFactory CreateSessionFactory() { return FluentNHibernate.Cfg.Fluently.Configure() .Database( FluentNHibernate.Cfg.Db.MsSqlConfiguration.MsSql2008 ...

Is there any Fluent NHibernate book?

Taking into consideration that Fluent NHibernate has been available for some time I thought that there would be a book available already so i search in amazon and in google but there is no books for fluent nhiberanet. Am i right or book already exist? ...

How do I map a has-many collection containing a composite key reference in Fluent NHibernate?

Hello. My schema looks like this: The Message.Id column is an identity(1,1), and the MessageHeader table uses a composite key consisting of the associated message ID, and a header name field that uniquely identifies a header within each message. Entities are represented in code as: public class Message { public virtual int Id {...

setting type and length on composite-key property in fluent nhibernate

In hbm mappings I can <composite-id> [..] <key-property name="someStringProperty" column="somefield" type="AnsiString" lenght="8"/> </composite-id> How do I do that (setting type and length) in Fluent? Edit: I posted this on support.fluentnhibernate.org. I included some modi...

NHibernate, one column two meanings, positiv/negative

Hi We have a large management application and we do alot of logging for every action, who did what and at what time. However we have more and more automatic systems which we would like to differentiate aswell. In all our tables we have a column called PerformedBy which is an int. This has always been a reference to a Table called Emplo...

Mapping to NameValueCollection using Fluent NHibernate

Hello, I have an attributes sub-element of a parent element, and I'd like to map it as a NameValueCollection. I cannot find an example of how to do this in Fluent NHibernate. Can somebody point me in the right direction? Thanks! ...

Fluent nHibernate , IDictionary Confusion

Using the following classes.. public class Trait { public virtual int Id { get; set; } public virtual string Name { get; set; } } public class Sheet { public virtual int Id { get; set; } public virtual IDictionary<Trait, int> Influences { get; set; } } I have tried to map them using Fluent nHibernate, as such. public ...

Fluent NHibernate Mapping Components, one indexed, one not indexed.

Am getting an error on VerifyTheMapping test: System.ApplicationException: For property 'ANonindexedComponent' expected 'Generic.TheDomain.NonindexedComponent' of type 'Generic.TheDomain.NonindexedComponent' but got '' of type 'Generic.TheDomain.NonindexedComponent' and System.ApplicationException: For property 'IndexedComponent' expecte...

FluentNhibernate HasManytoMany Relation - It doesnt add into the link table

Using fluentnhibernate i am having a problem with the link table insertion. Here is my entities public partial class Item { public virtual int Id { get; set; } public virtual string Description { get; set; } public virtual IList<Category> Categories { get; ...

nhibernate : Need to attach references before Update<T>(T entity) ???

Hi all, I'm, building an n-tier system using nHibernate i de back-end, and which is cummunicating using REST/json with the front-end. When i send an object to the back-end, I only send the data like : myAddress: [ { guid: "1", street: "MyHomeStreet", houseNumber: "34", city: "6" } ] So, I only send the referenced city entity's...

Is it possible to get NHibernate to auto-generate an ID if the entity does not have one, or use the ID of the entity if it already has one?

According to REST philosophy, a PUT operation should (taken from Wikipedia): PUT http://example.com/resources/142 Update the address member of the collection, or if it doesn't exist, create it. NHibernate seems to have two ways of dealing with entity IDs: Auto-generate an ID, regardless of what value the user set. Use the ID as...

Fluent NHibernate Joined References Ignoring Cascade Rule

I'm using Fluent NHibernate in an attempt to improve testability and maintainability on a web application that is using a legacy database and I'm having some trouble mapping this structure properly: I have two tables that really represent one entity in the domain, and so I'm using a join to map them as such, and a third table that repre...

Windows service and Nhibernate

I have a Windows service which has a timer and in the timer_Elapsed event handler a method from another component will be called which is supposed to look into db and get or update some records.This process will happen every 2 minutes.I used nhibernate for data access in the component. When I run the method from unit test it is working f...

How to use NHibernate ManyToMany with properties (columns) on Join Table (Fluent NHibernate)

I have the following classes that I need NHibernate to play nicely with. How do I do it? public class Customer { public int ID { get; set; } public string Name {get;set;} } public class Product { public int ID { get; set; } public string Name {get;set;} } public class CustomerPricing { public int ID { get; set; } pub...

FluentNHibernate mapping many-to-many to the same entity or how to map a graph?

Hello, I have a situation where I need to store a graph data structure in the database. This means an entity can have unlimited number of related entities of the same type (related entity can have unlimited related entities as well). I was thinking that many-to-many relationship would solve my problem. I'm trying to do mapping with F...

Return only the Parent using nHibernate

Hi, Im pretty new to nhibernate so this may be quite straightforward but i havent found an answer on the web yet. Lets say i have a Parent class and a Child class. The Parent Class can have many Child classes associated with it. Now when i try to load a specific Parent nhibernate also populates its Child collection for me. There ar...

How to set up SysCache on Fluent NHibernate?

Using this, I can tell Fluent NHibernate to use SysCache as a 2nd Level Cache Provider: MsSqlConfiguration.MsSql2008.ShowSql().ConnectionString(x => { x.Server(@"localhost\ANDREPC"); x.Database("mydb"); x.TrustedConnection(); }).Cache(c => c.ProviderClass<SysCachePr...

NHibernate not deleting child object

I can't get NHibernate to delete this child object, it completes without throwing any exceptions and without deleting anything: public void DeleteW9(int vendorId, int vendorW9Id) { var vendor = vendorRepository.Get(vendorId); var W9 = vendor.W9.Where(x => x.Id == vendorW9Id).First(); vendor.W9.Remove(W9);...

Fluent Nhibernate, Subclass, ManyToMany. An association from the table refers to an unmapped class

I'm using Fluent(1.1.0) NHibernate(2.1.2) and I've got a (sub)subclass with a many-to-many reference to another class: (Sub)Sub Class --< Cross Table >-- Other Class or FloorplanObject (base class) Geometry (Subclass) Stand (SubSubclass) --< ExhibitorStand >-- Exhibitor Base Class: public class FloorplanObject { public int Id ...

Mapping a one-way ManyToMany?

I want to map the following company to the below address. I want it to be a one way relationship since the address class is being used by several other classes. When I generate the schema the junction table is created successfully but when I try to save an entity nothing is persisted in the junction table. Only in address and company ta...