mapping-by-code

Table Per Subclass Inheritance mapping by NHibernate Mapping-by-Code

人盡茶涼 提交于 2019-12-05 01:06:55
问题 How to write mappings in new NHibernate Mapping-By-Code in Table Per Subclass strategy for this classes: public class Person { public virtual int Id { get; set; } public virtual string Name { get; set; } } public class JuridicalPerson : Person { public virtual int Id { get; set; } public virtual string LegalName { get; set; } } public class PrivatePerson : Person { public virtual int Id { get; set; } public virtual bool Sex { get; set; } } 回答1: Here is a possible mapping in a slighly

Table Per Subclass Inheritance mapping by NHibernate Mapping-by-Code

折月煮酒 提交于 2019-12-03 17:27:42
How to write mappings in new NHibernate Mapping-By-Code in Table Per Subclass strategy for this classes: public class Person { public virtual int Id { get; set; } public virtual string Name { get; set; } } public class JuridicalPerson : Person { public virtual int Id { get; set; } public virtual string LegalName { get; set; } } public class PrivatePerson : Person { public virtual int Id { get; set; } public virtual bool Sex { get; set; } } Here is a possible mapping in a slighly abbreviated form public class PersonMapping : ClassMapping<Person> { public PersonMapping() { Table("person"); Id(x

Generating Wrong Columns on Queries

核能气质少年 提交于 2019-12-03 07:01:06
问题 We are having an intermittent problem with NHibernate where it will occasionally generate a query with a wrong column on the SQL. If we restart the application the problem ceases to happen (sometimes it requires more than one restart). When the problem occurs, during the lifetime of that process, it always produces the wrong SQL for the affected entity. It´s not always the same affected entity. It´s an ASP.NET application where the SessionFactory is created during the Application_Start event.

NHibernate 3.2 many to many mapping by code

房东的猫 提交于 2019-11-29 02:01:33
I'm trying to learn NHibernate 3.2 built-in mapping by code api ( NOT FluentNHibernate, nor xml). Can you help me to map a many-to-many relationship between these entities please? public class Post { public virtual Id { get; set; } public IList<Tag> Tags { get; set; } } public class Tag { public virtual Id { get; set; } public IList<Post> Posts { get; set; } } My primary key strategy is: Id( t => t.Id, t => { t.Generator(Generators.HighLow, g => g.Params(new { max_low = 100 })); t.Column(typeof(TEntity).Name + "Id"); }); and I try this: // TagMap : ClassMapping<Tag> Bag(t => t.Posts, bag => {

Getting started with NHibernate 3.2 Loquacious API

僤鯓⒐⒋嵵緔 提交于 2019-11-28 15:40:25
I'm starting a new project and I want to use NHibernate 3.2. I know that it can now do something similar to FluentNHibernate and I want to give it a try. But I am having a hard time finding documentation on the Loquacious API. I've seen blog posts on how to configure the ISessionFactory, but I'm getting lost after this. I know that the 3.2 API is moving fast and that article about 3 to 4 months old are already out of date, but I'm looking for the most recent information. Where can I find the resources concerning: How to setup NHibernate 3.2 without using XML, without using FluentNHibernate and

NHibernate 3.2 many to many mapping by code

对着背影说爱祢 提交于 2019-11-27 16:23:43
问题 I'm trying to learn NHibernate 3.2 built-in mapping by code api ( NOT FluentNHibernate, nor xml). Can you help me to map a many-to-many relationship between these entities please? public class Post { public virtual Id { get; set; } public IList<Tag> Tags { get; set; } } public class Tag { public virtual Id { get; set; } public IList<Post> Posts { get; set; } } My primary key strategy is: Id( t => t.Id, t => { t.Generator(Generators.HighLow, g => g.Params(new { max_low = 100 })); t.Column

Getting started with NHibernate 3.2 Loquacious API

北城余情 提交于 2019-11-27 09:19:46
问题 I'm starting a new project and I want to use NHibernate 3.2. I know that it can now do something similar to FluentNHibernate and I want to give it a try. But I am having a hard time finding documentation on the Loquacious API. I've seen blog posts on how to configure the ISessionFactory, but I'm getting lost after this. I know that the 3.2 API is moving fast and that article about 3 to 4 months old are already out of date, but I'm looking for the most recent information. Where can I find the