-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
This page contains full information on using the Mimick framework.
The framework can be installed through the NuGet package manager by either running the following command lines, or by using the built-in Visual Studio interface:
PM> Install-Package Fody
PM> Install-Package Mimick.Fody
The framework must also be added to the Fody weavers document, such as below:
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<Mimick />
</Weavers>
Once the framework has been installed and the application is able to compile, the Mimick framework must be configured when the application launches. Depending on the application which is being developed, this will require new initialization code being inserted within the application Main()
method, or the relevant application start-up method. It's important to place the Mimick initialization early in the application start-up process so that components can be configured correctly.
IFrameworkContext context = FrameworkContext.Current;
First, retrieve the current instance of the Mimick framework context. The context will exist as a singleton within the application context, and must be configured and initialized before the application can begin leveraging the components and services.
IConfigurationContext configuration = context.ConfigurationContext;
The IConfigurationContext
interface instance provides methods for registering sources of configurations. A configuration source is used in attributes such as Value
to populate fields, properties and parameters within the framework. For more information on configuring the IConfigurationContext
, refer to the Configuration page.
IComponentContext components = context.ComponentContext;
The IComponentContext
interface instance provides methods for registering classes as components of the framework. If the containing assembly is not registered, any classes decorated with Component
will not be registered. For more information on configuring the IComponentContext
, refer to the Components page.
context.Initialize();
When the framework contexts have been configured the framework must be initialized by calling the Initialize()
method which will create all of the components required. This process will load configuration sources and classes, register components, and start the task context.
context.Dispose();
When the application is shutting down the framework should be released in order to terminate the task context, release configuration sources and destroy components. The framework can be released by calling the Dispose()
method.