Fluent-Nhibernate Many-To-Many relationshiop issue -


Fluent while trying to remove many-to-many relationship using Nhibernate is I have to face a problem. I am following domain squares:

  public class organization {public virtual id id {get; Set;} Private IILIT & lt; Organization Relationships & gt; RelatedOrganisations; Public Virtual ILIT & lt; Organizational Relationships & gt; Related Organization {Back This Is Related organization; } Protected Set {this.relatedOrganisations = value; }} Public Virtual Zero Extraordinary Organizations (Organization Relations Organization Relationships) {This. Affiliate Organizations Remove (Organization Relations); }}  

Here is the association section of my organization which is representing many relationships between organizations.

  public class Sngtnsnyojn {get public virtual Inti ID (; set;} public virtual Organization {get; set;} public virtual organization Risekteep Organization Rilekt Type {get; set;} public virtual Organization related organization {get} set;}}  

The script for its table is:

Organization table:

  Create table [Dbo]. [Organization] ([ID] [int] identity (1,1) No NULL, [OrganisationName] [nvarchar] (200) No n ULL, barrier [PK_Organisation] primary key cluster ([ID] ASC) with (PAD_INDEX = off, STATISTICS_NORECOMPUTE = off, IGNORE_DUP_KEY = off, [primary] on [primary]) on ALLOW_ROW_LOCKS =, ALLOW_PAGE_LOCKS =)  

OrganisationRelationshop table:

  table [dbo]. [OrganisationRelationship] ([ID] [int] identified (1,1) nOT NULL, [OrganisationId] [int ] NULL, [OrganizingRelationshipTypeId] [int] No NULL, Obstacle [PK_OrganisationRelationship] Primary Key Cluster ([ID] ASC) (PAD_INDEX = closed, STATISTICS_NORECOMPUTE = closed, IGNORE_DUP_KEY = off, ALLOW_ROW_LOCKS = No, NULL, [RelatedOrganisationId] On, ALLOW_PAGE_LOCKS =) [primary]) H1> Organizational Type Table with: [Primary]  
  CREATE TABLE [dbo]. [OrganisationRelationshipType] ([ID] [int] identified (1,1) NOT NULL, [name] [nvarchar] (50) NOT NULL, constraint [PK_OrganisationRelationshipType] primary key packages ([ID] ASC) with (PAD_INDEX = off , working as STATISTICS_NORECOMPUTE = off, IGNORE_DUP_KEY = off, ALLOW_ROW_LOCKS =, ALLOW_PAGE_LOCKS [=) on the [primary]) primary]  

everything I expected, but when I try to remove the relationship, instead of removing the record from the fluently Nhibernate CompanyIrready table instead of the company ID for that particular record Rick Tries to be. The question in NHProf is:

  UPDATE CompanyRelationship SET CompanyId = null WHERE CompanyId = 3893 / * @ p0 * / and id = 487 / * @ p1 * /  

To delete the record, I am calling RemovedRelatedCompany function which removes specific CompanyRelationship from the list of related companies and then I have a session to save the company entity. Save () and session I'm calling Flush ().

Any idea what I am doing wrong here, due to this behavior?

I am using automation so I had to override mapping for the organization to solve the problem. Was:

Mapping Hashmani (c => c. Related organization) current (). Foreign Caucasian Canned OnDelat () Table ("organizational relationship");


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -