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.
精彩评论