fluent-nhibernate

Map partitioned table with partition discriminator column

痞子三分冷 提交于 2020-01-03 05:26:07
问题 I have a legacy Oracle 10g database. This database has a table ITEMDELIVERY with a column DELIVERY_DATE . The table is partitioned by this column. Because of that, the primary key of this table is a compound one involving the columns ITEMDELIVERY_ID and DELIVERY_DATE . There is another table ITEMDELIVERYDETAIL having a FK to ITEMDELIVERY . To be able to benefit from the partitioning and to be able to be partitioned itself, this table has a column PARTITION_DATE . ITEMDELIVERY_ID and PARTITION

Specifying select-before-update with Fluent NHibernate?

半城伤御伤魂 提交于 2020-01-03 03:23:07
问题 I'm trying to specify the "select-before-update" attribute in a ClassMap using Fluent NHibernate, but I'm not finding much on the web that shows what the right way to do it is. Does anyone know how to achieve this with Fluent NHibernate? Thanks! 回答1: SelectBeforeUpdate() in your ClassMap . 来源: https://stackoverflow.com/questions/1784379/specifying-select-before-update-with-fluent-nhibernate

Fluent NHibernate Inheritance mapping type

£可爱£侵袭症+ 提交于 2020-01-03 01:58:07
问题 I'm new to Fluent NHibernate, thus far I managed to get my mapping working except for the inheritance part. Is there anybody who could help me finish the mapping? I have simplified the code as much as possible. Thank you! My database: CREATE TABLE [User] ( UserID INT NOT NULL IDENTITY(1,1), Type CHAR(1) NOT NULL, Email VARCHAR(255) NOT NULL, PRIMARY KEY(UserID) ); CREATE TABLE [Student] ( UserID INT NOT NULL, Firstname VARCHAR(255) NOT NULL, PRIMARY KEY(UserID), FOREIGN KEY(UserID) REFERENCES

FluentNHibernate: How to translate HasMany(x => x.Addresses).KeyColumn(“PersonId”) into automapping

偶尔善良 提交于 2020-01-03 01:43:26
问题 Say I have these models: public class Person { public virtual int Id { get; private set; } public virtual ICollection<Address> Addresses { get; private set; } } public class Address { public virtual int Id { get; private set; } public virtual Person Person { get; set; } } I want FluentNHibernate to create the following tables: Person PersonId Address AddressId PersonId This can be easily achieved by using fluent mapping: public class PersonMapping : ClassMap<Person> { public PersonMapping() {

Fluent NHibernate: Mapping HasManyToMany by convention

。_饼干妹妹 提交于 2020-01-02 10:18:25
问题 I'm using Fluent NHibernate's AutoMap feature to map my entities. Most of my entities inherit from a base class Entity which has a property public IList<Tag> Tags . The tags are in a separate table in the database, so I use a many-to-many relation. But Fluent NHibernate creates mappings for a one-to-many relation. I'd like to write a convention to override these mappings to use HasManyToMany(...) if the class inherits from Entity . Is this possible and how? The convention could either rely on

Fluent NHibernate: Mapping HasManyToMany by convention

杀马特。学长 韩版系。学妹 提交于 2020-01-02 10:16:07
问题 I'm using Fluent NHibernate's AutoMap feature to map my entities. Most of my entities inherit from a base class Entity which has a property public IList<Tag> Tags . The tags are in a separate table in the database, so I use a many-to-many relation. But Fluent NHibernate creates mappings for a one-to-many relation. I'd like to write a convention to override these mappings to use HasManyToMany(...) if the class inherits from Entity . Is this possible and how? The convention could either rely on

Fluent NHibernate: Mapping HasManyToMany by convention

江枫思渺然 提交于 2020-01-02 10:15:46
问题 I'm using Fluent NHibernate's AutoMap feature to map my entities. Most of my entities inherit from a base class Entity which has a property public IList<Tag> Tags . The tags are in a separate table in the database, so I use a many-to-many relation. But Fluent NHibernate creates mappings for a one-to-many relation. I'd like to write a convention to override these mappings to use HasManyToMany(...) if the class inherits from Entity . Is this possible and how? The convention could either rely on

Fluent Nhibernate - How to specify table name

 ̄綄美尐妖づ 提交于 2020-01-02 08:09:52
问题 I just started learning Nhibernate and Fluent Nhibernate. I want to specify table name when I create my mapping class. Entity name in application is "CustomerOrders" but in the oracle database, table name is "CUSTOMER_ORDERS". I learnt from googling that I can use "WithTable" to specify database table name. I am not sure how to use it and where as Vs2008 didn't find the method. Thanks 回答1: WithTable was renamed to Table for the 1.0 release. It was mentioned in the release notes (first bullet

Exposing HasMany and ManyToMany relationships as IEnumerable

橙三吉。 提交于 2020-01-02 07:35:53
问题 Currently in my entities I'm exposing my collections as an IList but I've been thinking about exposing them as a IEnumerable to prevent users from manually adding to the collections. I have specific adds for these operations so that I can make sure my bi-directional relationships stay intact. A couple questions come to mind in this scenario. If I expose them as IEnumberable does this mean I'll need an Add and Remove method for every collection that represents a relationship in my entities? Is

NHibernate exception: could not initialize a collection, Invalid column name. Fluent mapping. Maybe a many-to-one issue?

妖精的绣舞 提交于 2020-01-02 06:25:30
问题 I am puzzled and frustrated by an exception I'm getting via NHibernate. I apologize for the length of this post, but I've tried to include an appropriate level of detail to explain the issue well enough to get some help! Here's the facts: I have a Person class which contains a property BillingManager , which is also a Person type. I map this as an FNH "Reference". I have an ExpenseReport class which contains a property SubmittedBy , which is a Person type. I map this as an FNH "Reference". I