fluent-nhibernate

In Fluent NHibernate how do I specify a dictionary mapping type size?

How can I specify the size of the type used in the following Dictionary mapping: HasMany(x => x.WidgetSettings) .AsMap<string>(idx => idx.Column("SettingKey"), elem => elem.Column("SettingValue")) .Not.LazyLoad() .Table("WidgetSettings"); The mapping defau...

In Fluent NHibernate how do you combine automapped types with non-automapped types?

Right now, I'm switching my project over from the classic fluent nhibernate style of manually defining a ClassMap for each domain entity, to having the auto-mapper auto-generate the mappings for me. But I'd like to keep using the classes I've already mapped in the classic style, until I can tweak the automappings to match the old classi...

Fluent NHibernate mapping: one table, many classes

How would I go about mapping three classes to one table with fluent NHibernate. A "Type" column should indicate which class should be mapped. Is it even possble? Kristoffer ...

How do I map class like Types<Type> in NHibernate ?

I have a need for specialize collection of custom types in my Domain Model. public class Foos : List<Foo> { } Is there a way to map this object in NHibernate and how could I use FluentNHibernate to do this as well ? ...

Fluent NHibernate Mapping a column against one of two columns

I'm dealing with some legacy vendor code that I can't modify. I'd like to wrap the database with an abstraction layer that is easier to use. Given the following two tables, I need to create a mapping for Process.Route that will find the matching Route for a given Process, but that can be either dbo.Route.SourceProcessID or dbo.Route.De...

Is it possible to map a composite key in fluent nhibernate where half of the key is an identity field in the database?

As the question states, is it possible to map a composite key in fluent nhibernate (or non fluent i suppose) where one of the two fields used in the composite is an identity field? I have a table where one part of the primary key is an identity field and the other is a tenant id. This is a legacy database where the composite key is used...

Fluent NHibernate Mapping Error (Id column)

I'm getting a mapping error in Fluent NHibernate. Why is it still looking for _id when I have specified the column explicitly? Invalid column name 'Account_id'. [GenericADOException: could not initialize a collection: [ProtoStack.Business.Entities.Account.LedgerEntries#1][SQL: SELECT ***ledgerentr0_.Account_id*** as Account5_1_, ledgere...

rhino.commons unit of work

Hi i'm trying to get multi tenancy working in my app - using nhibernate integration facility from castle and i think that the funky combination of using the nh facility combined with fluent is making the task of configuring more than one session factory a pain. i'm thinking about swapping it out to use the rhino.commons UoW implementat...

What are the differences between HasOne and References in nhibernate?

What are the differences between HasOne() and References() in nhibernate? ...

Fluent NHibernate auto mapping - how to create a many-to-many relationship table?

Hi, just wondered if anyone know if there is a way to crate a Many-to-Many relationship table automatically using some attribute? without creating the table, or mapping a class to become that relation table. If i add the attribute [ManyToMany(3,Class="DeploymentListUsers")] i get an error that this class isn't mapped to the DB. NH...

Is there any data on NHibernate vs Fluent NHibernate startup performance?

In short, what works faster: SessionFactory precompiling XML configuration, or Fluent NHibernate providing configuration programmatically ? ...

Using Fluent nHibernate with VS2005

I have not been able to find any definitive answers to this question: Can Fluent nHibernate be used with VS2005? All the examples on fluentnhibernate.org seem to use c# 3 syntax (lambdas). ...

Fluent NHibernate Inheritance Issue

I have a db setup with 3 tables t_DataItem pk id int auto isActive bit 0 dateCreated datetime getdate() parentId int null t_User pk id int firstName varchar(50) lastName varchar(50) t_Email pk id int address varchar(50) so now i have 3 classes, each one representing the respective item, however both User and Email inherit ...

NHibernate SaveOrUpdate, error: No persister for

I have a NHibernate mapping for a base class A class A { } class B : A { } public save(A a) { session.SaveOrUpdate(a); } Error: No persister for B As you can see B has been passed with the correct base type A, but i still get the error about the persister for type B Does NHibernate support inheritance like this... what can i do? ...

Creating reports with NHibernate

I have the following entities (simplified for this example) mapped using Fluent NHibernate: public class Stock : Security { public virtual string TickerName { get; set; } public override string GetName() { return TickerName; } } public class Fund : Security { public virtual string FullName { get; set; } public virtual string Ti...

Configuration SysCache2 With Fluent NHibernate

Hi, How can i configure SysCache2 2nd-Level Cache with Fluent NHibernate configuration ? private ISessionFactory CreateSessionFactory() { return Fluently.Configure() .Database(MsSqlConfiguration.MsSql2008.ConnectionString(_connectionString) .Cache(c => c.UseQueryCache()) .Dialect<Full...

Fluent NHibernate - exception occurred during configuration of persistence layer

Hello there, I am using Fluent NHibernate with an external 'hibernate.cfg.xml' file. Following is the configuration code where I am getting error: var configuration = new Configuration(); configuration.Configure(); _sessionFactory = Fluently.Configure(configuration) .Mappings(m => m.FluentMappings...

Passing an assembly reference in a custom MSBuild task

I'm trying to write an MSBuild task to build a database using FluentNhibernate mappings. The code for the task currently looks like this... public class CreateDatabase : Task { [Required] public string ConfigFile { get; set; } [Required] public string MappingAssemblyName { get; set; } public override bool ...

Fluent NHibernate and Stored Procedures

I have a basic Customer/Order/OrderItem/Product object graph. Customer has Many Orders, Order has Many Order Items, Product has many Order Items. These are successfully mapped using FNH. I've hit a snag with configuring a stored procedure & fluent-nhibernate. There is not a native way to map stored procedures in fluent-hibernate FNH ...

Unable to cast object of type NHibernate.Collection.Generic.PersistentGenericBag to List

Hello there, I have a class called ReportRequest as: public class ReportRequest { Int32 templateId; List<Int32> entityIds; public virtual Int32? Id { get; set; } public virtual Int32 TemplateId { get { return templateId; } set { templateId = value; } } public virtua...