public static IUnityContainer Setup(out IDataAccessLayer dbContext) { var container = new UnityContainer(); const string databaseName = DatabasePath; dbContext = new Db4OContext(); dbContext.Setup(databaseName); //database registration container.RegisterInstance(typeof(IDataAccessLayer), dbContext); //service registrations container.RegisterType <IFileSystemService, FileSystemService>(); container.RegisterType <IDatabaseService, DatabaseService>(); container.RegisterType <IFileWatcherService, FileWatcherService>(); //registraions utils //only one instance from messenger can exists! (recipient problems..) var messenger = new Messenger(); container.RegisterInstance(typeof(IMessenger), messenger); return(container); }
public static IUnityContainer Setup(out IDataAccessLayer dbContext) { var container = new UnityContainer(); const string databaseName = DatabasePath; dbContext = new Db4OContext(); dbContext.Setup(databaseName); //database registration container.RegisterInstance(typeof (IDataAccessLayer), dbContext); //service registrations container.RegisterType<IFileSystemService, FileSystemService>(); container.RegisterType<IDatabaseService, DatabaseService>(); container.RegisterType<IFileWatcherService, FileWatcherService>(); //registraions utils //only one instance from messenger can exists! (recipient problems..) var messenger = new Messenger(); container.RegisterInstance(typeof (IMessenger), messenger); return container; }