fluent-nhibernate

How to create a Multi-Column Index or Unique Constraint with NHibernate

How to create a Multi-Column Index and/or Unique Constraint using NHibernate Mapping or Fluent NHibernate. ...

VIEWS and Fluent NHibernate?

It's possible to map a VIEW using Fluent NHibernate? If so, how? ...

How can I map a nullable enum in NHibernate?

I have been unable to persist a nullable enum using NHibernate with Fluent NHibernate configuration. NHibernate attempts to save a string representation of the enum and I get the error System.Data.SqlClient.SqlException: Conversion failed when converting the nvarchar value 'VGS' to data type tinyint. The property is defined as publi...

Fluent NHibernate Classes as code behind for Domain classes

Ok, so I want to create a code behind for non-aspx classes. I have mapping files (classes) that I want to show in project as a code behind for entites. Is there a way to do that in VS2008. ...

Fluent NHibernate mapping a joined sub class without the original class file.

I have a library with a class called Recipient which has it's own fluent mapping setup within the library. Now in another project I have created a new class called SentEmail which inherits from Recipient, I want to be able to create a new mapping class file based on the original Recipient map. If I could update the original ClassMap fi...

Updating one-to-many with Fluent NHibernate

I'm trying to build a modified role system that has the following class/relationship structure: Project ProjectRole Employee where ProjectEmployee maps the three entities together. I have a one-to-many mapping from Project to ProjectEmployee and a reference mapping from ProjectEmployee to Project. I can add new ProjectEmployee's ju...

FluentNhibernate and SQLite

Hi, I can't get SQLite Driver working in my sessionfactory. I downloaded SQLite 1.0.48 from http://sqlite.phxsoftware.com/ I have added the references to System.Data.SQLite in my Tests project. public static IPersistenceConfigurer GetSqlLiteConfigurer() { try { return SQLiteConfiguratio...

Programming to interfaces while mapping with Fluent NHibernate

Hi, I have been whipped into submission and have started learning Fluent NHibernate (no previous NHibernate experience). In my project, I am programming to interfaces to reduce coupling etc. That means pretty much "everything" refers to the interface instead of the concrete type (IMessage instead of Message). The thought behind this is ...

Fluent NHibernate Mapping Issue.

Hey everyone. I am trying to map several tables using Fluent Nhibernate. My tests are giving me the following error: NHibernate.Exceptions.GenericADOException: could not initialize a collection: [FluentWeb.Domain.Employees.Orders#1] I am trying to map a one to many relationship between Employees and Orders. Orders then has a many to ma...

Fluent nhibernate: How do I map an entity with a property who's type is an interface?

I have an entity like: public class Employee { public int ID { get; set; } public IAccountManager AccountManager { get; set; } ... } I also have a mapping defined for "DefaultAccountManager" - a concrete implementation of IAccountManager. When mapping the above "Employee" entity, how do I tell NHibernate to persist/load th...

How do I output the HBMs that Fluent NHibernate Creates?

I am debugging my fluent application and would like to see what the generated files look like. Can someone help me out? -Nick ...

Fluent Nhibernate Generates Invalid column names in One-to-Many

Hello.. Fluent NHibernate Generates invalid columns names within a Many to one relationship. enter public EmployeeMap() { Id(x => x.EmployeeID); Map(x => x.FirstName); Map(x => x.LastName); Map(x => x.City); Map(x => x.HireDate); Map(x => x.Title); HasMany(x => x.Orders) ...

How do I create a table-per-class mapping with fluent nhibernate?

I'm trying to create a mapping similar to the following with fluent nhibernate: <class name="IAccountManager" abstract="true" table="IAccountManager"> <id name="Id"> <generator class="hilo"/> </id> <union-subclass table="DefaultAccountManager" name="DefaultAccountManager"> ...

NHibernate and a denormalised table

Working on a website that has Employee and Branch entities, using a database table "Employees" which also contains the branch id and branch name. I can't change the client's database so I need to map Employees and Branches from the same table. I guess I need some type of distinct clause in the mapping XML to get a distinct list or set o...

Mapping HQl Result Fluent NHibernate

hello, everyone i have two class Product and Supplier() like this: public class Product { public virtual int Id{get;set} pubic virtual string Name{get;set;} public virtual string SupplierId{get;set} } and public class Supplier { public virtual Id{get;set;} public virtual name{get;set;} } i want to create a HQL query using...

nHibernate ManyToManyToMany with Fluent

I have a structure here I have a ManyToManyToMany relationship. This is my (truncated) fluent mappings. public AgencyMap() { Id(x => x.AgencyId, "AgencyId"); Map(x => x.AgencyCode, "AgencyCode"); HasManyToMany<Personnel>(x => x.Personnel) .WithTableName("AgencyPersonnel") .WithParentKeyColumn("AgencyId") ...

Sql 2008 Filestream with NHibernate

I am attempting to use Filestream in sql server 2008 to store user uploaded images. My problem is that NHibernate will not error, but it also will not save the data into the database. No record is created. The Image class below is a custom class (not to be confused with System.Drawing.Image) public class ImageMap : ClassMap<Image> { ...

Fluent NHibernate - bind List<int>

Hi I have a Class which looks something like this: public class User { public virtual int ID; public virtual string Name; public virtual IList<int> userRights; } I want to make a UserMap : ClassMap<User> Mapping the name is no problem however i cant seem to figure out how to map the userRights. Table looks lik...

Fluent NHibernate - Map 2 tables to one class

Hi I have a table structure something like this table Employees EmployeeID EmployeeLogin EmployeeCustID table Customers CustomerID CustomerName What i would like is to map the structure above to one single class named: Class Employee EmployeeID EmployeeLogin EmployeeName How do i do that with fluent nhibernate ? ...

One-to-Zero-Or-One mapping - eager load results in multiple lazy load when zero

Iam trying to do some Eager loading with some entities that have a reference to one or zero elements. The problem arises when it refers to zero element. I have the following class Car { int id string name Driver driver } class Driver { int id string Name } The Driver gets loaded using References(x => x.Driver).ColumnName("driv...