Basic Unity configuration file. (I've taken the Helper version from the unity samples and expanded on it a little)
You can download Unity here

I've kept the helper object purley as a placeholder for a sample bindable object which we will replace with a proper data object as we go along.
For now the Helper and the Interfaces are in the WpfBitsLib library.
And the usercontrols are stored in the WpfBitsControls library.

As we go along we will start costomising the configuration file and the constructors on the controls to allow for injection of the business rule object and the data layer object.
This way we can swap out the busines logic, and or the data layer of a view, simple by giving the configuration file a little change.

<?xml version="1.0"?>
    <section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration" />

      <typeAlias alias="string" type="System.String, mscorlib" />
      <typeAlias alias="singleton"  type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager, Microsoft.Practices.Unity" />
      <typeAlias alias="IHelper"    type="WpfBitsLib.IHelper, WpfBitsLib" />
      <typeAlias alias="Helper"     type="WpfBitsLib.Helper, WpfBitsLib" />
      <typeAlias alias="IPage"      type="WpfBitsLib.IPage, WpfBitsLib" />

      <typeAlias alias="pageHomePage"   type="WpfBitsControls.HomePage, WpfBitsControls" />
      <typeAlias alias="pageStatistics" type="WpfBitsControls.Statistics, WpfBitsControls" />

      <container name="container">
          <type type="IHelper" mapTo="Helper" >
            <lifetime type="singleton" />
          <type type="IPage" mapTo="pageHomePage" name="HomePage" />
          <type type="IPage" mapTo="pageStatistics" name="Statistics" />

Last edited Jan 22, 2010 at 12:13 PM by AndrewvanDijk, version 9


No comments yet.