Back to Home

UsefulDB4O in ASP.NET

UsefulDB4O db4o allows you to easily use the ASP.NET environment

  1. You can define different databases in web.config
  2. Access them easily through a static class

Steps to start

  1. Add the required references to your web project:
    • Db4objects.Db4o.dll
    • UsefulDB4O.dll
  2. Add the DB4OHttpModule, inside system/web /httpmodules section on web.config file

    	<add name="DB4OHttpModule" type="UsefulDB4O.Web.DB4OHttpModule, UsefulDB4O"/>

  3. Add the configuration section “DB4OConfigSection” in the web.config

    	<section name="db4o" type="UsefulDB4O.ApplicationConfig.DB4OConfigSection"/>

  4. Sets your databases on db4o section, customizing via attributes 


    For more information about attributes of the database element, go to this page.
    For more examples, go to this page.
    To see how to control the configuration that opens the database db4o, go to this page.

  5. Get a IObjectContainer instance of the db4o database using the “alias” name. To do this, use the static class UsefulDB4O.Web.DB4ODatabases

    protected void Page_Load(object sender, EventArgs e)
       var productsContainer = UsefulDB4O.Web.DB4ODatabases.GetCurrentContextContainer("ProductsDatabase");
       var category = new Category
            CategoryID = Guid.NewGuid(),
            Name = "Cars",
            Products = new Collection<Product>()

Index of UsefulDB4O in ASP.NET

Last edited Dec 28, 2010 at 11:58 AM by pacoweb, version 6


No comments yet.