fluent-nhibernate

Fluent-Nhibernate Generic Entities

I have two entities like this Entity<Student> Entity<Lesson> Is there a usage for mapping on fluent-nhibernate like that? class StudentEntityMap : ClassMap<Entity<Student>> {} ...

What is the "Entity" refering to in fluent Nhibernate Mapping Configuration?

I am trying to learn fluent nhibernate better so am doing a basic sample application from scratch, instead of using someone elses framework. However, I am finding I really don't understand what is going on in assigning mapping files. I have seen a lot of code examples which are all showing the same code, but nothing that spells it out. N...

Fluent NHibernate - Cascade delete a child object when no explicit parent->child relationship exists in the model

I've got an application that keeps track of (for the sake of an example) what drinks are available at a given restaurant. My domain model looks like: class Restaurant { public IEnumerable<RestaurantDrink> GetRestaurantDrinks() { ... } //other various properties } class RestaurantDrink { public Restaurant Restaurant { get; ...

Map derived class as an independent one with FNH's Automap

Hi! Basically, I have an ImageMetadata class and an Image class, which derives from ImageMetadata. Image adds one property: byte[] Content, which actually contains binary data. What I want to do is to map these two classes onto one table, but I absolutely do not need NHibernates' inheritance support to kick in. I want to tailor FNH Aut...

Problems using FluentNHibernate + SQLite with .NET4?

I have a WPF application running with VS2010 .Net3.5 using Nhibernate with FluentNHibernate + SQLite, and all works fine. Now I want to change to use .Net4, but this has turned into a more painful experience then I expected.. When setting up the connection I do this: var cfg = Fluently.Configure(). Database(SQLiteConfiguration.St...

How to identify a particular entity's Session Factory with Fluent NHibernate and Multiple Databases

Question follows on from http://stackoverflow.com/questions/2655861/fluent-nhibernate-multiple-databases (no need to follow this link,there should be enough background here). My problem is this: I'm using Fluent NHibernate. My application uses multiple databases. Each database has its own entities registered (mapped) against it. The re...

FluentNHibernate Auto Mappings and ISet in .NET 4.0

How to set up auto mapping to map System.Collections.Generics.ISet<T> correctly? I tried implementing IHasManyConvention, but in intellisense it seems that IOneToManyCollectionInstance does not have anything for that(?) ...

Fluent NHibernate Map to private/protected Field that has no exposing Property

I have the following Person and Gender classes (I don't really, but the example is simplified to get my point across), using NHibernate (Fluent NHibernate) I want to map the Database Column "GenderId" [INT] value to the protected int _genderId field in my Person class. How do I do this? FYI, the mappings and the domain objects are in se...

Fluent NHibernate SqlDateTime overflow exception

Hey, I'm mapping a very simple Users table, and i have a column named 'LastLoginDate' which is defined as nullable in sql server. My mapping looks like this : public Users { Id(x => x.UserId); Map(x => x.UserName); ... ... Map(x => x.LastLoginDate).Nullable(); } But everytime I try to save this entity programatic...

FluentNHibernate - ClassMap vs IAutoMappingOverride

In FluentNHibernate when should I use ClassMap and when IAutoMappingOverride<Entity> for my EntityMap classes. public class PostMap : ClassMap<Post> { public PostMap() { ... } } vs public class PostMap : IAutoMappingOverride<Post> { public void Override(AutoMapping<Post> mapping) { ... } } ...

When using Dependency Injection with StructureMap how do I chooose among multiple constructors?

I'm trying to get structuremap to build Fluent Nhibernate's SessionSource object for some of my intregration tests. The only problem is that Fluent's concrete implementation of ISessionSource (SessionSource) has 3 constructors: public SessionSource(PersistenceModel model) { Initialize(new Configuration().Configure(), m...

Fluent many-to-many: Deleting one end does not remove the entry in the relation table

I have two classes (Parent, Child) that have a many-to-many relationship that only one end (Parent) knows about. My problem is that when I delete a "relation unaware" object (Child), the record in the many-to-many table is left. I want the relationship to be removed regardless of which end of it is deleted. How can I do that with Fluent...

How to fine tune FluentNHibernate's auto mapper?

Okay, so yesterday I managed to get the latest trunk builds of NHibernate and FluentNHibernate to work with my latest little project. (I'm working on a bug tracking application.) I created a nice data access layer using the Repository pattern. I decided that my entities are nothing special, and also that with the current maturity of ORM...

versioning in Fluent NHibernate

In my NHibernate mapping files I used: <version name="Version" column="Version" /> to implement versioning. How do I achieve this using fnhibernate? What should go in here? public class blaMap : IAutoMappingOverride<bla> { public void Override(AutoMapping<bla> mapping) { ???? } } thanks....

Nhibernate: building a List<string> through <component>

If I have a field in the db which stores a set of comma separated strings (says tags), how can I instruct fluent Nhibernate to pick it up at List<string>() e.g. Public IList<string> Tags {get; set;} Db field values: Mvc, .net, FNH ...

Fluent NHibernate Repository with subclasses

Having some difficulty understanding the best way to implement subclasses with a generic repository using Fluent NHibernate. I have a base class and two subclasses, say: public abstract class Person { public virtual int PersonId { get; set; } public virtual string FirstName { get; set; } public virtual string LastName { get...

Fluent Nhibernate napping to existing database with primary key in joining table of a many to many relationship

I have an existing database with a many to many relationship however the joining table has a primary key ID and 2 foreign keys to do the join. Is it possible to configure the mapping files to handle this? at the moment i am stuck. Thanks ...

Nested SubClasses with Fluent Nhibernate

I've seen examples of how to do this with the old subclass syntax, but none with the newer : SubclassMap syntax. Basically, I have multiple discriminators in a table and need to figure out how to do this with FNH. Thanks, Sam ...

Nhibernate 3.0 and FluentNHibernate

is anyone building the truck NHibernate and FluentNhibernate together? How's it working? are you using it for production systems? How is the Linq support? Is it nearly ready for release? Is there a nice and concise way to keep up to date with what is going on in the world of NHibernate? (ie, without having to read lots of blogs, and...

Nhibernate: One-To-Many mapping problem - Cannot cascade delete without inverse. Set NULL error

Hi, I have the current scenario whereby an Article has only 1 Outcome each. Each Article may or may not have an Outcome. In theory, this is a one-to-one mapping, but since NHibernate does not really support one-to-one, I used a One-To-Many to substitute. My Primary Key on the child table is actually the ArticleID (FK). So I have the f...