public UsersController(IUserLogic logic, UserManager <ApplicationUser> userManager, IPhotoLogic photoLogic, ILikeLogic likeLogic) { _logic = logic; _userManager = userManager; _photoLogic = photoLogic; _likeLogic = likeLogic; }
public PhotosController() : base() { DbContext context = ContextFactory.GetNewContext(ContextType.SQL); UserRepository repository = new UserRepository(context); PhotoRepository photos = new PhotoRepository(context); IGoogleServices googleServices = new GoogleServices(); Users = new UserLogic(repository, googleServices); Photos = new PhotoLogic(repository, photos, googleServices); }
public void Initialize() { //context = InitializeSQL(); context = InitializeMemory(); IRepository <User> repository = new UserRepository(context); IRepository <Photo> photos = new PhotoRepository(context); GoogleServices = new Mock <IGoogleServices>(MockBehavior.Strict); UserLogic = new UserLogic(repository, GoogleServices.Object); SessionLogic = new SessionLogic(repository); PhotoLogic = new PhotoLogic(repository, photos, GoogleServices.Object); }
static DependencyResolver() { CfgDto config = new CfgDto(); if (File.Exists(_path)) { var openCfgStream = File.Open(_path, FileMode.Open); XmlSerializer xCfg = new XmlSerializer(typeof(CfgDto)); config = (CfgDto)xCfg.Deserialize(openCfgStream); } else { var openCfgStream = File.Open(_path, FileMode.Create); XmlSerializer xCfg = new XmlSerializer(typeof(CfgDto)); config.UserDAO = "default"; config.UserLogic = "default"; config.PhotoDAO = "default"; config.PhotoLogic = "default"; xCfg.Serialize(openCfgStream, config); openCfgStream.Close(); } switch (config.UserDAO) { default: _uDao = _uDao ?? (_uDao = new UserDAO()); break; } switch (config.UserLogic) { default: _uLogic = _uLogic ?? (_uLogic = new UserLogic(_uDao)); break; } switch (config.PhotoDAO) { default: _pDao = _pDao ?? (_pDao = new PhotoDAO()); break; } switch (config.PhotoLogic) { default: _pLogic = _pLogic ?? (_pLogic = new PhotoLogic(_pDao)); break; } }
public PhotosController(IPhotoLogic photoLogic) { this.photoLogic = photoLogic; }