Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Builder options

autobuild

By default, you must register each type with the Builder before you can build it. If you turn on autobuild, you do not need to register concrete types; they will be built automatically. You can turn on autobuild by calling builder.autobuild = true, and turn it off similarly.

defaultLifecycle

For more details on lifecycles, see LifeCycles. This specifies which lifecycle will be used for newly registered types. This property replaces the defaultSingleton property from previous versions.

This applies to types as they are registered. It will not affect types that have already been registered.

Since these options might not come into effect for types that are registered before the options are set, it's recommended that you ensure that options are set properly using this snippet:

module mypackage.Builder;
public import dconstructor.api;

public Builder builder;
static this ()
{
    builder = new Builder;
    // set any options you want here
}