Questions tagged [fluent-nhibernate-mapping]

Fluent, XML-less, compile safe, automated, convention-based mappings for NHibernate

Fluent NHibernate offers an alternative to NHibernate's standard XML mapping files. Rather than writing XML documents (.hbm.xml files), Fluent NHibernate lets you write mappings in strongly typed C# code. This allows for easy refactoring, improved readability and more concise code.

Resources

626 questions
0
votes
1 answer

Automapping custom types

I am in the process of setting up nhibernate using fluent nhibernate for a relatively simple setup. Automapping is able to do everything currently fine except for one property on my objects. I have properties of type MongoDB.Bson.ObjectId. This is…
Chris
  • 27,210
  • 6
  • 71
  • 92
0
votes
1 answer

Two References to the same table using FluentNHibernate

I have one table which is, for example, User. Now, In my table Books, I need to map two user fields public User Wants {get; set;} public User Read {get; set;} How to map this? (Older version of fluentnhibernate and automapping doesn't work in this…
0
votes
1 answer

Map Two Tables With Third Table Fluent Nhibernate

I am working on Nhibernate and I have two classes name Customer and CusotmerRole with their mapping(CustomerMap and CustomerRoleMap). Now I want to map these two tables with the Third Table we have in Database named As Customer_CustomerRole_Mapping.…
0
votes
1 answer

Remove Proxy Classes Generated During Mapping in Fluent Nhibernate

I am working on Fluent Nhibernate and getting the following error: No persister for: System.Data.Entity.DynamicProxies.Customer_3FF392FD8867C34D66C0BEB65D29B9B13BAFD2651E0DD73A797E67ADE1455B21 Please tell me that how can I remove the proxy that are…
0
votes
1 answer

Fluent NHibernate One-To-Many Cascade Delete if Many-Side is not referenced anywhere else

I have a working solution but would be interested to know if there is a way to achieve this through fluent mapping.. For simplicity, I will use a illustrative example: class Tag { string name; IList books; } class Book { string…
0
votes
2 answers

How to change Existing Database Table Name using NHibernate in c#

I am a biginner in NHibernate. I have already created Database tables using NHibernate mapping. Now I want change one of my Table Name and Column Name. I am unable to found the way to change the Table Name. Please help me to resolve this issue.…
0
votes
2 answers

Fluent NHibernate Inheritance

In my database I have a table for 'User' who has a foreign key constraint to a 'Servant', who has again a foreign key constraint to a 'Person'. The relationship between 'Servant' and 'Person' is now changed to an inheritance, so that 'Person' is the…
0
votes
1 answer

Flunet Nhibernate all-delete-orphan not working like expected

I have following domain classes: public class News: EntityBase { public virtual DateTime CreationDate { get; set; } public virtual IList DomainNameToNews { get; set; } public News() { …
Nic
  • 1,088
  • 3
  • 19
  • 43
0
votes
1 answer

Specifiying Default Value for Datetime property in FluenNhibernate mapping class

imagine we have an object have a property: //the date which app has been added to the system public virtual DateTime SubmitionDate { get; set; } how can I set default value (current date) for SubmutionDate in the sqlServer 2008 using mapping…
Hashem Aboonajmi
  • 13,077
  • 8
  • 66
  • 75
0
votes
1 answer

Single row constraint in Fluent NHibernate

Basically I'm trying to figure out how to make a Fluent NHibernate mapping restrict itself to only hold one record for holding the application's configuration. Here's the map in question: class ConfigurationMap : ClassMap { …
Craig
  • 259
  • 1
  • 5
  • 14
0
votes
1 answer

FluentNHibernate HasManyToMany Convention overrides

I'm working with FluentNhibernate. I'm trying to make my Map files are light weight as possible by relying on Convention files for things like table names, foreign key columns etc. I'm having a bit of a problem with my HasManyToManyConvention. I…
0
votes
1 answer

NHibernate - Mapping abstract immutable value object

I have following domain model that I need to persist in database with help of Fluent NHibernate: public class Entity { public Guid Id { get; set; } public IValueObject AnyValueObject { get; set; } } public interface IValueObject { …
0
votes
1 answer

Nhibernate self join read join field value

I intend to read the referencing field (ParentMenu) value for my self join mapping. The class and mappings are as follows; public class MenuSetup { public virtual int MenuId { get; set; } public virtual string DisplayText { get; set; } …
0
votes
1 answer

Deleted object resaved by cascade - self referencing table

I'm getting the following error: "deleted object would be re-saved by cascade (remove deleted object from associations)" I have trimmed the entirety of the ajax call to the following: [HttpPost] [UnitOfWork(Scope = FilterScope.Result)] …
Seth
  • 954
  • 1
  • 15
  • 42
0
votes
1 answer

How can do I use fluent nhibernate to map this relationship?

I have the following database tables: Project table Dependency table with columns (Id, ProjectId, DependentProjectId) on my Project domain object i have the following mapping to be able to take a project and read its dependencies public virtual…
leora
  • 188,729
  • 360
  • 878
  • 1,366