开发者

Problem with nhibernate join

I'm trying to do a join like this using fluent nhibernate:

Id(x => x.Id);
Map(x => x.SourceSystemRecordId,"sourceSystemRecord_id");

Then

Join("cat.tbl_SourceSystemRecords", SourceSystemRecords);

But, it seems I don't have a way to specify the开发者_C百科 column I want to join with from the first table, in this case I need to join on SourceSystemRecordId and not on Id

Is there any way I can specify this? I tried References() but that requires me to create an object for this relationship, what I need is to aggregate the columns in sourcesystem records to the ones in the main table.


I tried References() but that requires me to create an object for this relationship

Did you tried Expand method for references?

EDIT: Expand method joining columns which is referenced. and if you dont want to use lazy loading, this is how can you fix.

ps. still i cant understand it clearly. If this is not what you want, please give more details / examples.

eg.

Database:

Examples:
-Id

SourceSystemRecords:
-Id
-ExampleId

Entity:

Example:
Id / int
SourceSystemRecords / SourceSystemRecords - Referenced

Query:

Session.Linq<Example>().Expand("SourceSystemRecords")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜