using System.Security.Principal;
using Microsoft.Practices.Unity;
public static void Main()
using (var container = new UnityContainer())
container.RegisterType<IAuthoringRepository>(
new InjectionFactory(c => CreateAuthoringRepository()));
Console.WriteLine("debug - resolving model");
var model = container.Resolve<Model>();
public static IAuthoringRepository CreateAuthoringRepository()
Console.WriteLine("debug - calling factory");
return new AuthoringRepository
{ Identity = WindowsIdentity.GetCurrent() };
public Model(IAuthoringRepository repository)
"Constructing model with repository identity of "
public interface IAuthoringRepository
IIdentity Identity { get; }
public class AuthoringRepository : IAuthoringRepository
public IIdentity Identity { get; set; }