Questions tagged [nhibernate-mapping-by-code]

Mapping-by-code is NHibernate's own API by which mappings can be configured by code. Introduced in NHibernate version 3.2.

Mapping-by-code is NHibernate's own API by which mappings can be configured by code. It was introduced in NHibernate version 3.2. In a strict sense this applies to the namespace NHibernate.Mapping.ByCode. It may als pertain to NHibernate.Cfg.Loquacious, but not FluentNhibernate, which has its own tag.

158 questions
1
vote
1 answer

NHibernate 3.2 many to any mapping by code and inheritance

I have a many-to-any mapping and an inheritance conflict when trying to map my domain like this: public class Member { public virtual int Id { get; set; } // many: public virtual IList IssuedTokens { get; set; } } public…
amiry jd
  • 27,021
  • 30
  • 116
  • 215
1
vote
1 answer

How to map a sql function as named query with Nhibernate's loquacious mapping?

I have replaced all my NHibernate xml mapping files by loquacious mappings (mapping by code). The only thing I can't figure out is if it is possible to define this named query using loquacious mappings:
TedOnTheNet
  • 1,082
  • 1
  • 8
  • 23
1
vote
3 answers

Ignore column using mapping by code in HNibernate

I'm using mapping by code in NHibernate. I got a class with several properties. One of them is not related to any columns in DB but still has getter and setter. I use ConventionModelMapper not ModelMapper. The first one assumes that all properties…
Vasiliy Shiryaev
  • 600
  • 4
  • 12
1
vote
2 answers

Nhibernate Mapping in code ( how to get started)

I'm trying to get started with mapping by code in NH 3.2 and I more then a little lost. I need pointers back to basic documentation so I can understand what the examples I can find mean, for example... public class CustomerMap :…
andrew
  • 11
  • 2
1
vote
1 answer

Mapping all entities by convention

I'm playing with NH 3.2.0 mapping by code. Since I've a scenario in which I can map everithing by convention I would like to add raw entities to the mapper, and then customize them by a custom ModelInspector plus the event generated by the…
Felice Pollano
  • 32,832
  • 9
  • 75
  • 115
1
vote
2 answers

NHibernate: How to insert C# [Guid] into MySQL [BINARY(16) DEFAULT (uuid_to_bin(uuid(),1))] column?

Environment: MySQL Server 8.0, .NET Core 3.1, MySql.Data 8.0.28, NHibernate 5.3.11 I have following table: CREATE TABLE `Master` ( `Row_Id` char(36) NOT NULL DEFAULT (uuid()), `Path` varchar(1000) NOT NULL, PRIMARY KEY (`Row_Id`) )…
1
vote
1 answer

What are benifits of FluentNHibernate / NH Mapping by Code?

I tested with both FNH and NH mapping by code, they worked fine too but that's just my simple test, I still not identify pros & cons for each one. Any master there, could you show me some information ?
fred
  • 693
  • 1
  • 7
  • 19
1
vote
1 answer

NHibernate 5.1 ManyToOne - delete orphan not working as expected

I have following entities: public class Person { public int Id {get;set;} public String Name {get;set;} public Passport Passport {get;set;} } public class Passport { public int Id {get;set;} public String PassportNo {get;set;} …
1
vote
1 answer

I cannot turn off lazy loading in NHibernate

I'm aware that lazy-loading 'on' is the default setting in NHibernate. I switched lazy-loading off, using mapping-by-code, for the entity (Student) and the collection (Comments) contained within an entity. However a test including the use of…
Len
  • 63
  • 7
1
vote
1 answer

Nhibernate mapping class component of interface type

Last week I received the assignment to look for an alternative to the NHibernate hbm mapping, and decided to give the NHibernate mapping-by-code a try (seen that the fluent NHibernate project hasn't been updated in the last couple of years). Thank…
Century
  • 285
  • 6
  • 20
1
vote
1 answer

NHibernate component mapping: Operand type clash: bigint is incompatible with time

I am writing an application which uses NHibernate mapping by code. When I have a TimeSpan mapped as a property of an entity, the TimeSpan is mapped correctly. However, if I put the TimeSpan within a component mapping (value object), I get an en…
1
vote
1 answer

Formula property update

good day everyone i have some trouble with formula property, update and nhibernate suppose, i have next model: public class Model { public virtual Guid Id { get; set; } public virtual string Name { get; set; } public virtual State…
anatoly.kryzhanosky
  • 185
  • 1
  • 1
  • 18
1
vote
2 answers

Nhibernate Remove child collection without having property in the parent object

Suppose I have the following model public class Customer { public virtual Guid Id { get; set; } public virtual string Name { get; set; } } public class ActivityLog { public virtual Guid Id { get; set; } public virtual Guid…
petrov.alex
  • 1,089
  • 2
  • 12
  • 20
1
vote
1 answer

NHibernate mapping by code ManyToMany

Problem I'm using NHibernate mapping by code to map relationships. In this case I map users to roles to privileges. Users and roles are in a n:m relationship, same for roles and privileges. The SQL DB is SQL Server. If I remove the n:m relationshop…
1
vote
1 answer

NHibernate mapping by code error message could not execute query

I am new to c# and NHibernate so please forgive me if this question is out of line. I am working on mapping a table in Nhibernate by code i keep getting this error: could not execute query I have creates following classes class PoliceData { …