Back to UsefulDB4O in ASP.NET

Examples of database element (UsefulDB4O in ASP.NET)

  • Simple configuration
<db4o>
 <databases>
  <database
     alias="ProductsDatabase"
     serverType="EmbeddedServer"
     fileDb4oPath="/App_Data/products.db4o"
  />
 </databases>
</db4o>

Line 4: call the database "ProductsDatabase. "
Line 5: using the server type EmbeddedServer in the web application.
Line 6: define the relative path of the database file

  • The same configuration but add custom db4o configuration
<db4o>
	<databases>
	  <database 
		alias="UsersAndRoles" 
		serverType="EmbeddedServer" 
		fileDb4oPath="/App_Data/usersAndRoles.db4o"
     assemblyWithDatabaseConfig="AssemblyTest" 
     staticMethodWithDatabaseConfig="AssemblyTest.DatabasesConfiguration.GetUsersAndRolesConfiguration"
		/>
	</databases>
<db4o>

Line 7: name of the assembly that contains the method that returns the configurationthat we will open the database
Line 8: full signature of the method that returns the configuration that we will open the database.

  • Several databases (Advanced)
<db4o>
  <databases>
    <database
      alias="UsersAndRoles"
      serverType="EmbeddedServer"
      openServerRetriesOnLock="10"
      fileDb4oPath="/App_Data/usersAndRoles.db4o"
  assemblyWithDatabaseConfig="WebApplicationTest"
  staticMethodWithDatabaseConfig="WebApplicationTest.DatabasesConfiguration.GetUsersAndRolesConfiguration"
      />
    <database
      alias="Products"
      serverType="EmbeddedServer"
      openServerRetriesOnLock="10"
      fileDb4oPath="/App_Data/products.db4o"
      openContainerOnBeginRequest="true"
      filldb4oentityinfo="true"
      fillmode ="FillVersion,FillGlobalID"
   assemblyWithDatabaseConfig="WebApplicationTest"
   staticMethodWithDatabaseConfig="WebApplicationTest.DatabasesConfiguration.GetProductsConfiguration"
      />
  </databases>
</db4o>

Back to UsefulDB4O in ASP.NET

Last edited Dec 28, 2010 at 11:25 PM by pacoweb, version 2

Comments

No comments yet.