Questions tagged [nhibernate-mapping]

XML mappings for the .NET framework object-relational mapper (ORM) NHibernate as created with .hbm.xml files.

NHibernate mappings done in XML files indicate how classes map to database objects. Refer to the relevant NHibernate reference section for details on how to create such mappings.

2300 questions
0
votes
1 answer

Is there some way to specify "where" dynamically on a map?

Lets consider the following simplified mapping:
Felice Pollano
  • 32,832
  • 9
  • 75
  • 115
0
votes
1 answer

How to Use Custom Dictionary Class for DynamicComponent Mapping

I Like to use a custom IDictionary class for my DynamicComponent mappings: class ObservableDictionary : Hashtable, INotifyCollectionChanged, INotifyPropertyChanged when mapping lists it's possible to use a custom collection type as…
doerig
  • 1,857
  • 1
  • 18
  • 26
0
votes
1 answer

Fluent-NHibernate, specify FK property in uni-directional relationship

Mapping a 1:n relation automatically creates a FK column, in below example, a column Author_id in the Book table. But how do I make this value available as a property of the Book entity? If I create a property int AuthorID, is it possible to make…
bretddog
  • 5,411
  • 11
  • 63
  • 111
0
votes
1 answer

Fluent Nhibernate composed entity, specify foreign key

I have a Fluent Nhibernate map like : public class UserMap : ClassMap { public UserMap() { WithTable("aspnet_Users"); Id(x => x.Id, "UserId") .GeneratedBy.Guid(); Map(x => x.Name,…
Ronnie
  • 4,959
  • 10
  • 51
  • 69
0
votes
1 answer

nHibernate: default value in a many-to-one mapping with composite keys

Im working on a legacy database, that cant be changed. I have a table (Table1) with a many-to-one relationship with another table (Table2) which has a composite key. If everything was strait forward the mapping for table1 could look like…
Vegard
  • 35
  • 1
  • 8
0
votes
2 answers

NHibernate, how solve the mapping with depending on a other column

I have the table A like below: Table A ----------------------- Id Desc ReferenceType TargetId ... Depend on the value of reference type, eg 'B' or 'C', target ID reference to table B or table C. Have anyone solve this problem with NHibernate.
Kieran Dang
  • 447
  • 2
  • 17
0
votes
1 answer

How to only get the Ids from a FluentNhibernate HasManyToMany mapping

Say I have two Entities. public class Category{ public virtual int Id{get;set;} public virtual IList Posts{get;set;} } public class Post{ public virtual int Id{get;set;} public virtual string Title{get;set;} } In the Db…
andy
  • 8,775
  • 13
  • 77
  • 122
0
votes
2 answers

In NHibernate how would I map an object to only retrieve it's children but ignore them when creating or updating?

How would one map this object to only retrieve the collection below and ignore it totally when creating or updating the object to the db?
user17510
  • 1,549
  • 5
  • 20
  • 37
0
votes
1 answer

NHibernate in the configuration can not see anything

I need help with configuring NHibernate. In my solution has several projects: first contains the code entity, second contains the mapping files "*.hbm.xml". I configure through code. Here it is: Configuration config = new Configuration(). …
Kovpaev Alexey
  • 1,725
  • 6
  • 19
  • 38
0
votes
1 answer

Upgrade to NHibernate 3.2

I have a project by NHibernate (version 2.1). For upgrade to NHibernate 3.2, what should I do? Do I need that upgrade following dll? Antlr3.Runtime Castle.Core Castle.DynamicProxy2 NHibernate.ByteCode.Castle I could not find those dll in…
0
votes
2 answers

How to make Property Mapping Defaults apply during inserts using Fluent NHibernate

I have this mapping: Map(x => x.FileAs).Length(200).Default("").Not.Nullable(); The database schema already exists and the column does not allow nulls and has no default value. Changing the live database isn't an option. Can NHibernate be…
Aaron
  • 579
  • 1
  • 4
  • 12
0
votes
1 answer

NHibernate Many-to-Many Relation: Quering the properties of the joining table

Sorry if the title is a little vague, I have the following sceneraio: I have three tables in my domain model as following: there is a many to many relation between the AddingOrder table and Product table in the Product entity i have public…
Mahmoud Gamal
  • 78,257
  • 17
  • 139
  • 164
0
votes
2 answers

Nhibernate one-to-many association

I have such a simple model: public abstract class Entity { public virtual Guid Id { get; protected set; } } public class Post : Entity { public String Title { get ; set; } public String Content { get; set; } public DateTime…
lexeme
  • 2,915
  • 10
  • 60
  • 125
0
votes
1 answer

joining 2 table with queryover

I have 3 table in a sample. i am going to join 2 table but i have problem the following is my code :
0
votes
2 answers

NHibernate Filters on Left Outer Joins

I am running into an issue with an NHibernate filter. It works great until I do a left outer join to the object. For example, Deal references PurchaseItem, but PurchaseItem has a CompanyId filter applied. If I want to query deal with a left join to…
awright
  • 1,224
  • 1
  • 13
  • 23
1 2 3
99
100