fluent-nhibernate

NHibernate Many-to-many with Count

I have entities Post and Tag, where there is a many-to-many relationship between the two (e.g. each post can have one or more tags, and each tag can be associated with any number of posts). What I would like to achieve is to have the Tag entity to have a field providing the number of posts which are associated with that tag. However, I ...

S#arp Architecture Fluent mapping for self referencing entity (Tree structure)

I've come up against a problem in converting my Fluent NH mapping to Sharp Architecture. I like the platform for it's ease, however it seems to handle entity mappings slightly differently to pure Fluent NH. I have a Entity 'Category' that is a simple tree structure. I have to override the auto-mapping as there is a M:M property that I ...

Fluent NHibernate PersistenceSpecification Component and Reference Tests

Hi! I have two problems. 1 . FNH does not test my component correcty and I dont know why. System.ApplicationException: Expected 'DomainModel.Model.Publisher' but got 'DomainModel.Model.Publisher' for Property 'Publisher'. [TestMethod] public void CanCorrectlyMapBook() { new PersistenceSpecification<Book>(_session) ...

fluent nhibernate encoding settings

how can i set the encoding when i'm configure nhibernate with fluent configuration on mysql my problem is that i'm saving hebrew text on db and all i see in my app is ???? ...

Specifying select-before-update with Fluent NHibernate?

I'm trying to specify the "select-before-update" attribute in a ClassMap using Fluent NHibernate, but I'm not finding much on the web that shows what the right way to do it is. Does anyone know how to achieve this with Fluent NHibernate? Thanks! ...

Fluent NHibernate and Schema update/execute - indexes on foreign keys

Is there any way to specify that a foreign key should also be indexed using fluent nhibernate? MS Sql Server does not by default index foreign keys, and I would like the schema generated by the nhibernate schema generation/update tools to create these. When I just use the HasMany or HasManyToMany methods, no such indexes are created. Is ...

Fluent NHibernate enforce Not Nullable on Foreign Key Reference

Hello All, Just getting my feet wet with some Fluent NHibernate AutoMap conventions, and ran into something I couldn't figure out. I assume I'm just not looking in the right place... Basically trying to enforce NOT-NULL on the "many" side of the one to many relationship. It seems, using the automapping, it always makes the parent proper...

How to map and test a "Many to Many Relationship" in NHibernate using Fluent NHibernate

Hi! When I test my many to many classes an error occurs: System.ApplicationException: Actual count does not equal expected count. Entities: public interface IEntity { int Id { get; set; } } public abstract class Entity : IEntity { public virtual int Id { get; set; } public virtual bo...

Keeping nhibernate fluent mapping in sync with the database

We are currently using Fluent NHibernate and SQL Server 2008 in our c# development, however, the database schema has become too complex for Fluent to re-create the database when necessary so we are making changes to the database using scripts. This also means that the entity and mapping classes also need to be changed to remain in sync ...

How do I map composite-id with inverse and cascading?

I have a scenario where we have a lookup table with an additional column. Were it not for this column then a simple many-to-many would save the bacon but but now I have to create a third class which of course is fine too. The problem here though is that I can't make cascading work and have to resort to calling Session.SaveOrUpdate(object...

fluent nhibernate mapping as Bag List whats the differece ?

whats the best practice to map to a list of entities that need to be managed by their parent ...

Saving list of base classes in Fluent nHibernate

I'm a bit of a Fluent nHibernate newbie, so forgive me is this is easy and I'm just missing it. I have a class hierarchy with Customer and User which both inherit from Person. Customer and User each have their own table and mapping and everything is working great. My problem is that Customer and User need to have a list of Contacts, wh...

nhibernate hasmany when not using foreign key

Let say I have a request table, that looks as follows: RequestId INT ReferenceNumber VARCHAR Each request is logged in a requestlog table. There are no foreign keys between the tables: RequestLogId INT ReferenceNumber VARCHAR Content VARCHAR The requestlog contains the content of the request, and this content needs to be stor...

How to change schema with Fluent NHibernate AutoMapping

In my database every table belongs to a schema (Person for example.) I am using Fluent NHibernate with Automapping and my question is how I set the schema I want to use. ...

NHibernate Validator with Fluent

Hi I'm trying to get my schema export to work with Validators Expressed in my Domain Object. I have a [NotNull] attribute AND a ValidatioDef on a property but the column is still expressed as nullable by the schema export. Im sure its a config issue, but not sure where. Some wiring has gone haywire. Here is my config and gerneration cod...

How to have Fluent NHibernate automap a class inheriting from an abstract class inheriting from an interface?

I've just started using Fluent NHibernate and have run into the following problem trying to automap my entities: public interface IDataEntity {} public abstract class PhysicalEntity : IDataEntity { public virtual int Id { get; set; } public virtual string Name { get; set; } } public class Mine : PhysicalEntity { ...

where can i find SharedCache with fluent nhibernate getting started guid

where can i find SharedCache with fluent nhibernate getting started guid ...

Fluent nHibernate: Need help with ManyToMany Self-referencing mapping

Hi all, I have an entity called User which can have a list of other Users called Friends (kinda like Facebook). In my User entity, I've delcared a public virtual IList Friends { get; private set;} property, and an creating the list in the constructor. I also have an "AddFriends" method that adds Users to the Friends list. In my UserMa...

NHibernate Many To Many Relationship - Issue when deleting a part of the relationship

I have a many to many relationship between a Team and an Employee entity. I mapped them as following: public class EmployeeMap : ClassMap<Employee> { public EmployeeMap() { // identifier mapping Id(p => p.Id).Column("EmployeeID"); // column mapping Map(p => p.EMail); Map(p => p.LastName)...

S#arp Architecture many-to-many mapping overrides not working

I have tried pretty much everything to get M:M mappings working in S#arp Architecture. Unfortunately the Northwind example project does not have a M:M override. All worked fine in my project before converting to S#arp and its choice of Fluent NHibernate's Auto mapping. I like the auto-mapping, it's good, however the overrides do not se...