IAlias Interface

Summary

Implement this interface when implementing special custom Aliases for classes, packages or namespaces.
graph BT Type["IAlias"] class Type type-node Implementing0["WildcardAlias"]-.->Type click Implementing0 "/db4o-gpl-doc/output/api/Db4objects.Db4o.Config/WildcardAlias" Implementing1["TypeAlias"]-.->Type click Implementing1 "/db4o-gpl-doc/output/api/Db4objects.Db4o.Config/TypeAlias"

Syntax

public interface IAlias

Remarks

Implement this interface when implementing special custom Aliases for classes, packages or namespaces.

Aliases can be used to persist classes in the running application to different persistent classes in a database file or on a db4o server.

Two simple Alias implementations are supplied along with db4o:
- Db4objects.Db4o.Config.TypeAlias provides an #equals() resolver to match names directly.
- Db4objects.Db4o.Config.WildcardAlias allows simple pattern matching with one single '*' wildcard character.

It is possible to create own complex Db4objects.Db4o.Config.IAlias constructs by creating own resolvers that implement the Db4objects.Db4o.Config.IAlias interface.

Examples of concrete usecases:

// Creating an Alias for a single class
ICommonConfiguration.AddAlias(
  new TypeAlias("Tutorial.Pilot", "Tutorial.Driver"));


// Accessing a Java package from a .NET assembly
ICommonConfiguration.AddAlias(
  new WildcardAlias(
    "com.f1.*",
    "Tutorial.F1.*, Tutorial"));


// Using a different local .NET assembly
ICommonConfiguration.AddAlias(
  new WildcardAlias(
    "Tutorial.F1.*, F1Race",
    "Tutorial.F1.*, Tutorial"));




Aliases that translate the persistent name of a class to a name that already exists as a persistent name in the database (or on the server) are not permitted and will throw an exception when the database file is opened.

Aliases should be configured before opening a database file or connecting to a server.

Methods

Name Value Summary
ResolveRuntimeName(string) string
return the stored name for a runtime name or null if not handled.
ResolveStoredName(string) string
return the runtime name for a stored name or null if not handled.