fluent-nhibernate

NHibernate will save, but won´t load an entity

Hi! I´m receiving a very strange error with NHibernate 2.1.2.4000 GA and latest version of FluentNHibernate. I can save an entity but can´t load it back after a call to Flush() and Clear(). This is my entity: public class Application { public int Id { get; set; } public string Name { get; set; } public string KeyName { get; set; }...

Fluent NHibernate is trying to convert my GUID primary keys to numbers when querying.

Hi, I'm observing some strange behavior whilst trying to perform a query on an NHibernate entity. The primary key of my object is a string (guid), but when I pass in the guid string I wish to query by, I get an exception, NHibernate.ADOException: could not execute query System.FormatException: Input string '6eaa591f-bb75-4c0b-8acb-...

How to set default access to field.camelcase-underscore using Fluent NHibernate?

would like to set this convention up globally if possible. ...

I want generate INSERT which include my Primary Key (not generated) by NHibernate. How to map Id column for this?

I have table CUSTOMER where CUSTOMER_ID is primary key. Table CREATE TABLE [CUSTOMER]( [CUSTOMER_ID] [int] NOT NULL, [START_DATE] [varchar(30)] NOT NULL, CONSTRAINT [PK_CUSTOMER] PRIMARY KEY CLUSTERED ( [CUSTOMER_ID] ASC ..... Mapping public class CustomerMap : ClassMap<Customer> { public CustomerMap() { With...

Fluent NHibernate delegate mapping Func

Given this (HORRIBLE) object graph that I can't change public class Email { public Email(string email) { ... } //DO a bunch of worthless stuff } public interface IPerson { Email Email{get;set;} } Does something like this exist? Map(p => p.EmailAddress).Use(s => new EmailAddress(s)); Essentially the Person interface won...

Fluent NHibernate Mapping not on PK Field

I have the following tables and cannot edit their structure... Person ------ Id PK Code Name Order ----- Id PK Person_Code OrderDetails Now in my Person class I want to have a list of Orders for that person, but I'm not entirely sure how to go about setting up the mapping in fluent nhibernate to match on the Code column rather than t...

NHibernate property access strategy, How to set it up so that field.camelcase-underscore is preferred but autoproperty is fall back.

I want to set up the access strategy so that if a field.camelcase-underscore property backing is present then use that else use the automatic property. is this the default behavior (since auto props have back fields essentially)? or how to I enforce this? ...

NHibernate: How to map a column on a referenced table to a primitive in my object?

If I have the following existing table schema +-------------------+ +-------------------+ | Address | | Country | +-------------------+ +-------------------+ | Line1 | +--->| CountryId | | Line2 | | | Name | | City | | +-------...

Fluent NHibernate - How to use an enumerator to identify subclass?

Hi, Im trying to map the following classes: public abstract class ScheduleType { public virtual int Id { get; set; } public virtual TypeDiscriminatorEnum Discriminator { get; set; } } public class DerivedScheduleType : ScehduleType { public virtual bool MyProperty { get; set; } } public class ScheduleTypeMap : ClassMap...

(Fluent)NHibernate: Mapping an IDictionary<MappedClass, MyEnum>

I've found a number of posts about this but none seem to help me directly. Also there seems to be confusion about solutions working or not working during different stages of FluentNHibernate's development. I have the following classes: public class MappedClass { ... } public enum MyEnum { One, Two } public class Foo { ...

MS Entity Framework VS NHibernate and its derived contribs (FluentNHibernate, Linq for NHibernate)

I just read this article about the Entity Framework 4 (actually version 2). Entity Framework seems to offer a huge improvement over its first release. Thus, I have never ever used EF in any project, since I think EF is not mature enough in comparison to NHibernate. NHibernate and its current contributions of FluentNHibernate and Linq f...

What would be the equivalent VB.NET code for this C# FluentNHibernate component mapping?

I'm a C# programmer constrained to write VB.NET code. While exploring NHibernate further for my current client, I encountered FluentNHibernate, which I find real attractive. But now, I wonder how to "translate" this C# code for component mapping into VB.NET code: Component(x => x.Address, m => { m.Map(x => x.Number); m.Map(x =...

NHibernate With SQL Server Full Text

How-tu use NHibernate (with Fluent NHibernate) with SQL Server Full Text Search ? Thanks ...

Fluent NHibernate - subclasses with shared reference

Edit: changed class names. I'm using Fluent NHibernate (v 1.0.0.614) automapping on the following set of classes (where Entity is the base class provided in the S#arp Architecture framework): public class Car : Entity { public virtual int ModelYear { get; set; } public virtual Company Manufacturer { get; set; } } public class ...

Nhibernate: Component with HasMany

I have this mapping: public sealed class EntityMap : ClassMap<Entity> { public EntityMap () { ... Component(entity => entity.StateHistory, m => m.HasMany<HistoryItem<EntityState>> (Reveal.Property<EntityStateHistory>("Items")) .Table("EntityStateHistory") ...

Fluent NHibernate - Intercepting/Injecting DDL

This would be a great feature - to dress my Domain objects with class and property attributes, such as [Description("The 'Cat' entity holds information about Cats")] public class Cat { [Description("The Cat.Name property holds the real name of the Cat such as 'Fluffy'")] public virtual string Name { get; set; ...

Map collection of timespan with fluent nhibernate

Hi I have an object that contains a collection of TimeSpan like Note.Reminders, where reminders is List. How to I map this using fluent nhibernate? Currently I have mapped it as m.HasMany(c=>c.Reminders).Access.CamelCaseField() But i complains that it can not find a mapping for type TimeSpan. ...

Fluent NHibernate Self Referencing Many To Many

I have an entity called Books that can have a list of more books called RelatedBooks. The abbreviated Book entity looks something likes this: public class Book { public virtual long Id { get; private set; } public virtual IList<Book> RelatedBooks { get; set; } } Here is what the mapping looks like for this relationship ...

Mapping a DateTime property to a timestamp mysq+fluentnhibernate

I have a little problem with fluentNhibernate and MySQL. I would like to map my entity: public class Topic { public Topic() { ParentTopic = null; } public virtual Guid Id { get; set; } public virtual string Name { get; set; } public virtual DateTime CreatedAt { get; private set; } public virtual Gui...

Fluent nhibernate + nhibernate.serach + lucene.net

Hi, can someone tell me how to use nhibernate serach and lucene with fluent nhibernate. I have my application writen with fluent nhibernate but now i need full text serach but do not know how to implmenet nhibernate search with lucene to fluent nhibernate. i found this but it is not much and do not know how to use it: http://stackoverf...