I have a connection table in which the source table is a numeric type and the key column of the connection table is a row type. An hereditary solution that I am trying to avoid in order to minimize the risk to the amount of work.
HasManyToMany<Attachment>(x => x.Attachments)
.Table("ObjectAttachments")
.ParentKeyColumn("ObjectId")
.ChildKeyColumn("AttachmentId")
.Fetch.Select()
.LazyLoad()
.AsBag();
A native class uses a long (numeric) type for an identifier, while a join table uses a row type for an identifier for an object. How can I match this in order to change the data type on the fly? Is there something I can use to intercept and transform?
Perhaps I can open the discussion by providing a little more background. The relation of the table can be considered as such:
Hardware - (r1) - ObjectAttachments - (r2) - Attachments
- r1 .Id = ObjectAttachments.Object_Id ObjectAttachments.class= 'Equipment'
- r2 ObjectAttachments. Attachment_Id = .Attachment_Id
, , .Id - ObjectAttachments.Object_Id - .
UPDATE. : , . , . , , . :
Table("Attachments");
Id(x => x.Id);
Map(x => x.Name);
Map(x => x.Description);
Map(x => x.MimeType);
Map(x => x.Size);
Map(x => x.Date);
Map(x => x.Content).LazyLoad();
Join("ObjectAttachments", join =>
{
join.KeyColumn("Id");
join.Map(x => x.ObjectId);
});