fluent-nhibernate

Mapping of interconnection with nhibernate

I have to describe interconnection between objects. public class Entity { public string Name {get;set;} public IList<Entity> Connections {get;set;} } How can i persist this? I add another layer of complexity: querying on a specific date a connection between two entities can't be already defined. So probably I need a support t...

nhibernate many to many deletes

I have 2 classes that have a many to many relationship. What i'd like to happen is that whenever i delete one side ONLY the association records will be deleted with no concern which side i delete. simplified model: classes: class Qualification { IList<ProfessionalListing> ProfessionalListings } class ProfessionalListing { ...

Prevent mapping all public members of a class in Fluent NHibernate

I have a class generated from a WSDL that has a bunch of public properties and a public event. I'm extending this class with my own and adding some properties to it. All of my own properties are declared virtual, but the base class properties are not virtual. I'm using Fluent NHibernate's ClassMap to map only the properties from my exte...

Get existing entity if it exists or create a new one.

I'm importing data that may or may not exist already in my database. I'd like NHibernate to associate any entities with the existing db one if it exists (probably just setting the primary key/id), or create a new one if it doesn't. I'm using S#arp architecture for my framework (MVC 2, NHibernate, Fluent). I've added the [HasUniqueDoma...

Using Fluent NHibernate in commercial application

I want to use Fluent NHibernate in commercial desktop application, and I'm little concerned about the licensing. I've downloaded Fluent NHibernate precompiled binaries, and it contains this list of files: Antlr3.Runtime.dll Castle.Core.dll Castle.DynamicProxy2.dll FluentNHibernate.dll Iesi.Collections.dll log...

Does it matter which side of a bidirectional many-to-many relationship you set as inverse in NHibernate?

Simple question: does it matter which side of a bidirectional many-to-many relationship you set as the inverse in NHibernate? And if so, what are the implications of setting it on one end vs. the other? Some more clarification: I'm setting both sides of the relationship: Parent.Children.Add(child); Child.Parents.Add(parent); In a cas...

SQLite connection pooling with Fluent NHibernate

Is there a way to setup SQLite connection pooling using Fluent NHibernate configuration? E.g. equivalent of DataSource=:memory: would be: var sessionFactory = Fluently .Configure() .Database(SQLiteConfiguration.Standard.InMemory) (etc.) Is there something eqivalent to "Pooling=True;Max Pool Size=1;"? ...

Fluent NHibernate mapping IList<Point> as value to single column

I have this class: public class MyEntity { public virtual int Id { get; set; } public virtual IList<Point> Vectors { get; set; } } How can I map the Vectors in Fluent NHibernate to a single column (as value)? I was thinking of this: public class Vectors : ISerializable { public IList<Point> Vectors { get; set; } /* H...

how to map SubclassMap and HasManyToMany in Fluent NHibernate

Hi everyone. My problem is fluent nhibernate mapping a many to many relationship, they end up referencing a non existent Id. public UserMap() { Id(x => x.Id); Map(x => x.Name); Map(x => x.Password); Map(x => x.Confirmed); HasMany(x => x.Nodes).Cascade.SaveUpdate(); HasManyToMany<Node>(...

Many to Many mapping problem - Child Collection always empty

I have the following situation. I have a Movie object which contains a list of characters, and the characters each have an person (actor). Additionally, I want the actor objects to contain a list of characters. I've set up my mappings in fluent-nhibernate, and everything seems to be working perfectly, except that the Person.Characters...

Extending fluent nhibernate mappings in another assembly

Hi, I'm using NHibernate with my ASP.Net MVC application. I'm writing some extensions (plugins) for my application. And I'm loading those plugin dynamically (from different assemblies). In my base application I have many entities and mappings defined (User, Group, etc...) I need to create new entities in my extensions, so i.e. I'm crea...

Insert problem with Oracle using Nhibernate

There is a CLOB field we are trying to insert html content and sometimes we are getting an error as: ORA-01461: can bind a LONG value only for insert into a LONG column When i used nhibernate profiler and copy the query to Toad, it asked me to enter values for variables called "NBSP"! Is this means that nhibernate doesnt escape spe...

Mapping child objects in fluent nhibernate to a read-only view

Given that I am implementing a read-only UI, how do I create a ClassMap for Shop: public class Shop { public int Id { get; set; } public City City { get; set; } } public class City { public string Name { get; set; } public string CountryCode { get; set; } } The DB interface for Shops is a View containing 3 columns (Sh...

In NHibernate (Fluent), How do you map a property on referenced object into parent object?

I want to map the Name column from the Child table into the Parent object. How do you do this (using Fluent NHibernate)? public class Parent { public int Key { get; set; } public string ChildName { get; set; } } Tables +--------------+ +------------------+ | Parent | | Child | +--------------+...

nhibernate mapping attributes vs fluent nhibernate

Do mapping attributes offer the same versatility as nhib hbm's do? Can you use them together with FNH to handle things FNH doesn't yet do as well as hbm's can? Cheers, Berryl By mapping attributes, I don't mean hbm files; there are apparently attributes that come with NHib (or maybe NHib contrib these days) that you use to decorate you...

FluentNhibernate many-to-many mapping - resolving record is not inserted

Hi, I have a many-to-many mapping defined (only relevant fields included) with FluentNHibernate (v1.0.0.637): // MODEL: public class User : IPersistentObject { public User() { Permissions = new HashedSet<Permission>(); } public virtual int Id { get; protected set; } public virtual ISet<Permission> Permissions { ...

NHibernate IQueryable collection as property of root

I have a root object that has a property that is a collection. For example: I have a Shelf object that has Books. // Now public class Shelf { public ICollection<Book> Books {get; set;} } // Want public class Shelf { public IQueryable<Book> Books {get;set;} } What I want to accomplish is to return a collection that is IQu...

FluentNHibernate: multiple one-to-many relationships between the same entities.

Hi, I'm working on a bug tracking application. There are tickets, and each ticket has an opener user and an assigned user. So, basically, I have two entities, which have two many-to-one relationships with each other. Their schematic is this: User: public class User { public virtual int Id { get; protected set; } ... publi...

Fluent Nhibernate and hbms

As an FNH user, do you find you sometimes need to supplement FNH with an hbm file? Any relatively common edge cases where you do, if so? Cheers, Berryl ...

NHibernate LINQ query throws error "Could not resolve property"

I'm testing out using LINQ with NHibernate but have run into some problems with resolving string.length. I have the following public class DC_Control { public virtual int ID { get; private set; } public virtual string Name { get; set; } public virtual bool IsEnabled { get; set; } public virtual string Url { get; set; } ...