开发者

db4o mvc index page to detail page

in a MVC application it is quite common to have a list of objects that you click to see de开发者_如何学Pythontail and / or edit. When using a relational db, this is achieved by using the primary key or id:

<%= Html.ActionLink(dinner.Title, "Details", new { id=dinner.DinnerID }) %>

How would you do this using an oodb such as db4o?

Thanks!


There are three possibilities:

  • Using the internal object-id. Db4o gives each object an internal id, which you could use. However this id changes as soon as you defragment the database. Therefore it’s not usable for permanent-links.

  • Using the Db4o-GUID: Db4o can generate a UUID for each object. You could use this as id. However this UUID is huge.

  • Use you’re own ID. You could assign some ID for your objects yourself. There are different possibilities. For example you could create a Guid for each object. Or use the HiLo-Algorithm.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜