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

Fluent NHibernate mapping to Oracle 11G and SQLite

On an already in place table in the database we are trying to Add a column for the CreationDate mapping.Map(x => x.CreationDate) .Not.Nullable() .Default("to_date('01-01-0001','dd-MM-yyyy')") This works perfectly fine with…
Jordy van Eijk
  • 2,718
  • 2
  • 19
  • 37
0
votes
1 answer

Nullable GUID (Guid?) as the ID for Domain Class (NHibernate)

I am using Guid.comb for my primary key in my tables. I never found any sample using nullable guid as the ID for the domain class; is this a bad practice with NHibernate? The reason: I am binding a list of POCO to combo box; without the nullable…
kite
  • 1,478
  • 1
  • 15
  • 27
0
votes
3 answers

Fluent NHibernate mapping class within the entity class

I'm studying Fluent NHibernate now, and have a question about mapping. It's not an issue, but a best practice question. I know that with Fluent NHibernate there is a new fluent mapping, and it requires a new Class for mapping fields that will be…
0
votes
1 answer

FluentNhibernate and HasMany

I try a simple Test Application with FluentNhibernate but it doesnt work as I expected. Here are my classes: public class Document : DataEntity { public virtual string Title { get; set; } public virtual string FileName { get; set; } …
Sebastian
  • 952
  • 1
  • 14
  • 41
0
votes
2 answers

Fluent nHibernate Mapping HasMany Composite Key with Fixed Value

I'm trying to implement nHibernate mapping for a large exisiting system. trying to map the relationship between two object. One object is "Attachments" which relate to a number of different objects across the system. So in the database it has two…
Steve
  • 2,971
  • 7
  • 38
  • 63
0
votes
1 answer

How will NHibernate update the parent and child tables

I am working on MVC app with NHibernate. I am having a screen with Customer information and Order objects. As guessed, customer entity is having List property and Order entity is having customer property. I attached the orders object by storing them…
Sunny
  • 4,765
  • 5
  • 37
  • 72
0
votes
1 answer

Fluent nhiberante mapping for legacy tables

How to define fluent nhibernate mapping for the Legacy tables. I have four table CTType(id GUID, Name varchar(100), DateOFbirth datetime) CTType_Legacy(id GUID, CTType_Legacy_id identity int) CTTypeMap(id GUID, createdOn datetime, CtType_id…
0
votes
1 answer

Map an Id from an Identity class with Fluent NHibernate

I'm trying to map an Id from an Identity class with Fluent NHibernate. Identity class: public interface IValueObject { bool SameValueAs(T other); } [Serializable] public class Identity : IValueObject> { public…
Dani
  • 971
  • 12
  • 31
0
votes
1 answer

Fluent Nhibernate will not save

I have the following classes: public class PhoneModel { public virtual ModelIdentifier SupportModels } public class ModelIdentifier { public virtual string Name public virtual IList Values } This is how i mapped it: …
0
votes
1 answer

Use Fluent nHibernate to join two tables with different column names

I am using fluent nhibernate 3.1 to map to a legacy database. I have two classes and would like to join B to A. The database structure does not have foreign keys. AModel.OccurrenceNumber and BModel.OccurrenceNumber have same data(i.e. claim # 1234…
MetRay
  • 423
  • 1
  • 4
  • 7
0
votes
1 answer

fluent nhibernate cascade for graph

To understand cascade better. Can someone please explain why in the situation below node C and D are not persisted? Thanks. public class Node : Entity { public virtual Node Previous { get; set; } public virtual Node Next { get; set; } …
cs0815
  • 16,751
  • 45
  • 136
  • 299
0
votes
1 answer

mixing bi/uni directional nodes - (fluent)nhibernate

I have this situation: public abstract class Node : Entity { public virtual Node Parent { get; set; } private ICollection _children = new HashSet(); public virtual ICollection Children { get { return…
cs0815
  • 16,751
  • 45
  • 136
  • 299
0
votes
1 answer

DynamicUpdate in Fluent NHibernate doesn't work

In my application there are many cases where I have to update one single property of an entity in the database. In the internet I've read that DynamicUpdate() should change the behaviour of Fluent NHibernate so it does only update the properties !=…
0
votes
2 answers

Why isn't my FluentNHibernate References properties updating?

I'm using FluentNHibernate to try and update a class with a very simple mapping (below). Language does NOT have to be selected. When I do an Insert and I've set the Language property, everything works as expected. If I then try and do an update,…
0
votes
1 answer

enum as string and number in the database

i have a table table Foo ( id, FooType, FooTypeName, ) FooType is an enum with fixed values hence i want to map it to public virtual FooType FooType { get; set; } How can i serialize the property in both columns but use only one to…
Firo
  • 30,626
  • 4
  • 55
  • 94