fluent-nhibernate

Simple query to update a user entity for my DAO in nhibernate

Hi, can someone post how I should write code to perform an update on my User entity? I want to create a User DAO that will perform all queries related to this entity. ...

How do add NOLOCK with nHibernate?

Hi, How do you add NOLOCK when using nhibernate? (criteria query) ...

Generics with Fluent and NHibernate

I am trying to create a messaging system between users and organizations - that is, a user can send and recieve messages from users or organizations. So, to support this system, I started with an interface: public interface IPassableObject<F, T, O> where F : DomainObject where T : DomainObject { Guid PassedItemId { get; se...

Nhibernate - Generate schema without forign key

For our test fixtures we use NHibernate to generate a database schema. We have a slight strange case in which an entity references a another entity but we don't wish to have a foreign key constraint (it should be possible to delete the referenced entity so a foreign key cannot be used). Is it possible to specify that the generated schem...

Column Property AutoMapping

Hi There is o possibility to create a convention for Column naming: I have this peace of code: public AutoPersistenceModel Generate() { var result = AutoPersistenceModel.MapEntitiesFromAssemblyOf() .Where(GetAutoMappingFilter) .WithConvention(GetConventions); return result; ...

NHibernate Mapping a property to the existence of a row

I have the following entity and Fluent NHibernate mapping: public class Advertiser { public virtual int AdvertiserId { get; set; } public virtual string AdvertiserName { get; set; } public virtual bool IsPriorityEntity { get; set; } } public class AdvertiserMapping : ClassMap<Advertiser> { public AdvertiserMapping() ...

Problem with delete operation in many to many relation

Hi, I've got to classes Product and Store which have many to many relation I want deleting of store not to cause deleting of related product And deleting of product not to cause deleting of related store. Currently deleting of entity cause exception due to Foreign Key constraint. Here is this classes and their mapping in fluent hiber...

Checking existence of lazy loaded child without getting/loading in Fluent NHibernate

This should be easy, but I can't seem to figure it out... How can I check if a child on an entity exists without actually getting or fetching it? The child is lazy loaded right now.. so I have two entities: class A { public virtual int Id { get; set; } public virtual B Child { get; set; } } class B { public virtual int Id ...

compare entities before update in Nhibernate (audit implementation )

Hi, I need to log in to database every user update on any record and need to store old and new value of any record which was changed. This audit is implemented as interceptor in nhibernate so i have method: public override bool OnFlushDirty( object entity, object id, object[] currentState, ...

Fluent NHibernate mapping

Hello, I'm new to NHibernate and Fluent NHibernate. Assuming I have a situation like the following Table Activities (uniquidentier ID, varchar ActivityName) Table ActivityParameters(uniqueidentifier ID, varchar ParameterName, varbinary(8000) ParameterValue) and the following class public static Acivity { ....... public vi...

NHibernate and MySql is inserting and Selecting, not updating

Something strange is going on with NHibernate for me. I can select, and I can insert. But I can't do and update against MySql. Here is my domain class public class UserAccount { public virtual int Id { get; set; } public virtual string UserName { get; set; } public virtual string Password { get; set; } public virtual ...

Fluent NHibernate: subclasses inside subclasses

I have different kinds of products. Now, the AppProduct has different kinds of quantities - multiply of value, list of values, etc... public class Product : Entity { } public class Quantity: Entity { } public class ListQuantity : Quantity { public virtual IList<int> Quantities { get; set; } } public c...

(Fluent) NHibernate - mapping IList<MyClass> to a single column

Hello. I'm having some trouble to create a mapping. Let's say that persons read books: class Person : Entity { public virtual string Name { get; set; } public virtual IList<Book> Books { get; set; } /* ... */ } class Book : ValueObject { public virtual string Name { get; private set; } public virtual int Pages { ge...

(Fluent) NHibernate Mapping: Use IUserType to Map Custom Class foo - if boo.foo.Id is 0 then write to DB: boo.foo = NULL

Hi there, I have the following construct: class Person { int Id; Foo fooObject; } class Foo { int Id; //some more properties - doesn't matter } the Database is quite simple for this example; Table Person( int Id, int foo_Id) Table Foo( int Id, some more properties...) I often get a Person Object which contains an initialize...

NHibernate Domain Object Spans Multiple Tables

Assume I have this domain object... public class SpansMultipleTables { public int CommonID {get; set;} public string Table1Value {get; set;} public int Table2Value {get; set;} public float Table3Value {get; set;} } The CommonID property maps to the "ID" column on all tables. The Table1Value property maps to the...

Fluent NHibernate table per hierarchy mapping problem

Hello, I'm using Fluent NHibernate version 1.0.0.579 (latest version at this date). I have an abstract Activity class and several inheriting classes, eg. DummyActivity. All of them use the same table Activities, and all of them have a discriminator value based on an integral type which points to a mapping in the project (not a FK in dat...

NHibernate or Fluent NHibernate?

I would be interested in hearing op opinions from others regarding whether which they would choose (no 'neithers' please ;), and why. What are the downsides to using fluent? (version dependancy maybe?) Pros, Cons, Experiences etc. ...

Excluding some tables from Fluent Nhibernate schema Generation

I have some existing asp.net membership and roles tables in a legacy db and I am mapping them to new entities with Fluent Nhibernate. I also generate the schema directly from Fluent Nhibernate and I then manually tweak the generated sql script to exclude the existing tables. Is it possible to say to Fluent Nhibernate to exclude from ...

Fluent Nhibernate left join

I want to map a class that result in a left outer join and not in an innner join. My composite user entity is made by one table ("aspnet_users") and an some optional properties in a second table (like FullName in "users"). public class UserMap : ClassMap<User> { public UserMap() { Table("aspnet_Users"); Id(x => x....

Issues with Fluent Nhibernate Automapping in version 1.0RC

I am new to NHibernate and am running into some issues getting the Automap functionality to work properly. Here are a couple of issues I am having. The getting started wiki for Fluent NHibernate (http://wiki.fluentnhibernate.org/Getting_started) defines a sample with store, product, and employee classes--as well as the mapping for thos...