当前位置: 动力学知识库 > 问答 > 编程问答 >

.net - Creating foreign key objects in Castle Active Record

问题描述:

I have a project which I've used Castle Active Record as the DAL technology.

My object relationships are like this...

A Route contains many Waypoints.

What I want to do is add a waypoint to a route without retrieving the route from the database but I can't quite work out how to do it.

I already know the route ID so thats not a problem. Will initialising a route with the correct ID and assigning it to the waypoints Route property before I save achieve this result?

Thanks

Ben

网友答案:

Okay, since someone favourited this question I'm gonna answer it myself since I now know the answer. If anyone has a problem with that then they can do any flagging or whatever needs to happen.

Initialising a Route with the correct ID and assigning it to the waypoints Route property before you save is enough to link the waypoint to the existing route.

I guess I didn't find any documentation for it because it's just such a simple solution.

分享给朋友:
您可能感兴趣的文章:
随机阅读: