Im trying to get Unity to work with my console application, however.. all the properties that I try to dependency inject are still set to null.
This is my code:
Program.cs
namespace .Presentation.Console
{
class Program
{
static void Main(string[] args)
{
var mainThread = new MainThread();
}
}
}
MainThread.cs
namespace xxxx.Presentation.Console
{
public class MainThread
{
public IUnitOfWork UnitOfWork { get; set; }
public IMapper Mapper { get; set; }
public MainThread()
{
Mapper.RegisterMappings();
}
}
}
App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
<alias alias="IDataAccess" type="UnityFramework.IDataAccess, UnityFramework" />
<namespace name="UnityFramework" />
<assembly name="UnityFramework" />
<container>
<types>
<type type="IMapper" mapTo="xxxx.Core.Parse.ParseMapper" />
</types>
</container>
</unity>
</configuration>
App.config is set to Copy Always
Where Mapper is returned as null in this case (and I assume UnitOfWork is as well)
Do I need to do anything else? Add something to the app.config? Am I missing something?
Thanks in advance!
Br, Inx