Class AppBootstrapper
- Namespace
- Gemini
- Assembly
- Gemini.dll
Represents the bootstrapper for the application.
public class AppBootstrapper : BootstrapperBase
- Inheritance
-
BootstrapperBaseAppBootstrapper
- Derived
- Inherited Members
-
BootstrapperBase.Initialize()BootstrapperBase.StartDesignTime()BootstrapperBase.StartRuntime()BootstrapperBase.PrepareApplication()BootstrapperBase.Application
Remarks
This bootstrapper uses the Managed Extensibility Framework to compose the objects.
Constructors
AppBootstrapper()
public AppBootstrapper()
Properties
Container
Gets or sets the MEF composition container. Set by Configure().
public CompositionContainer Container { get; protected set; }
Property Value
Methods
BindServices(CompositionBatch)
Adds additional exports to the MEF composition.
protected virtual void BindServices(CompositionBatch batch)
Parameters
batch
CompositionBatchBatch where the exports should be add.
Exceptions
- ArgumentNullException
Thrown if
batch
is null.
BuildUp(object)
Defines the Caliburn.Micro.IoC.BuildUp method. Injects dependencies to instance
that are exported.
protected override void BuildUp(object instance)
Parameters
instance
objectThe instance to perform injection on.
Examples
private class ItemWithDependecies
{
[Import]
private IMainWindow _window;
}
var instance = new ItemWithDependecies();
// the IoC injects now the exported IMainWindow instance to the object.
IoC.BuildUp(instance)
Remarks
This method calls the SatisfyImportsOnce(ICompositionService, object) method.
Exceptions
- InvalidOperationException
Thrown if Container is not set.
- See Also
Configure()
Configures and sets up the MEF containers.
protected override void Configure()
Remarks
The MEF exports are prioritized depending on its containing assembly:
- Assemblies provided by SelectAssemblies() (high priority)
- Assemblies provided by neither 1 nor 3 (medium priority)
- The Gemini assembly (low priority)
GetAllInstances(Type)
Gets all instances of a particular type.
protected override IEnumerable<object> GetAllInstances(Type serviceType)
Parameters
serviceType
TypeContract type.
Returns
- IEnumerable<object>
All instances exported with the
serviceType
as contract.
GetInstance(Type, string)
Gets a instance by contract type and key.
protected override object GetInstance(Type serviceType, string key)
Parameters
Returns
- object
The instance exported with the contracts.
Exceptions
- KeyNotFoundException
Thrown if no instance could be located.
OnStartup(object, StartupEventArgs)
Executed after the application starts.
protected override void OnStartup(object sender, StartupEventArgs e)
Parameters
sender
objectThe sender.
e
StartupEventArgsStartup event arguments.
Remarks
Displays the imported IMainWindow instance.
PreInitialize()
Preinitializes the framework. This method is called before the Caliburn.Micro.BootstrapperBase.Initialize() method is called.
protected virtual void PreInitialize()
SelectAssemblies()
Selects the priority assemblies.
protected override IEnumerable<Assembly> SelectAssemblies()
Returns
- IEnumerable<Assembly>
The high priority assemblies.
Remarks
This method returns by default the entry assembly. Override this method to prioritize other assemblies.