Question

in a MVC application it is quite common to have a list of objects that you click to see detail 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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top