Я строю приложение со следующей архитектурой:
Пользовательский интерфейс - Приложение - Домен - Инфраструктура
У меня есть уровень приложений, для которого требуются пользовательские исключения. Где я храню эти особые исключения? На уровне инфраструктуры? Проблема в том, что мой уровень приложений не имеет ссылки на уровень инфраструктуры.
Каков правильный способ?
Update:
Вот мой код, который создает исключение в Application Layer:
public void InsertNewImage(ImagemDTO imagemDTO)
{
if (isValidContentType(imagemDTO.ImageStreamContentType))
{
string nameOfFile = String.Format("{0}{1}", Guid.NewGuid().ToString(), ContentTypeHelper.GetExtension(imagemDTO.ImageStreamContentType));
string path = String.Format("{0}{1}", ImageSettings.PathToSave, nameOfFile);
_fileService.SaveFile(imagemDTO.ImageStream, path);
Imagem imagem = new Imagem()
{
Titulo = imagemDTO.Titulo,
Descricao = imagemDTO.Descricao,
NomeArquivo = nameOfFile
};
_imagemRepository.Add(imagem);
_dbContext.SaveChanges();
} else
{
throw new WrongFileTypeException(String.Format("{0} is not allowed.", ContentTypeHelper.GetExtension(imagemDTO.ImageStreamContentType)));
}
}
Even ImageSettings is a StartSection is in my Application Layer, потому что он использует его. Я не вижу другого способа, как я могу перенести мои ImageSettings (которые должны оставаться в Infrastructure Layer) в Infrastructure Layer, кто-то может помочь?
public class ImageSettings : ConfigurationSection
{
/// <summary>
/// Caminha onde será salvo as imagens
/// </summary>
[ConfigurationProperty("pathToSave", IsRequired = true)]
public string PathToSave
{
get { return (string)this["pathToSave"]; }
set { this["pathToSave"] = value; }
}
/// <summary>
/// Extensões permitidas pra upload
/// </summary>
[ConfigurationProperty("allowedExtensions", IsRequired = true)]
public string AllowedExtensions
{
get { return (string)this["allowedExtensions"]; }
set { this["allowedExtensions"] = value; }
}
/// <summary>
/// Tamanho das imagens
/// </summary>
[ConfigurationProperty("imageSize")]
public ImageSizeCollection ImageSize
{
get
{
return (ImageSizeCollection)this["imageSize"];
}
}
}
-121--1282212- В приложении я изменяю положение standardWindowButtons close/miniturize/expand так:
//Create the buttons
NSButton *minitButton = [NSWindow standardWindowButton:NSWindowMiniaturizeButton forStyleMask:window.styleMask];
NSButton *closeButton = [NSWindow standardWindowButton:NSWindowCloseButton forStyleMask:window.styleMask];
NSButton *fullScreenButton = [NSWindow standardWindowButton:NSWindowZoomButton forStyleMask:window.styleMask];
//set their location
[closeButton setFrame:CGRectMake(7+70, window.frame.size.height - 22 - 52, closeButton.frame.size.width, closeButton.frame.size.height)];
[fullScreenButton setFrame:CGRectMake(47+70, window.frame.size.height - 22 -52, fullScreenButton.frame.size.width, fullScreenButton.frame.size.height)];
[minitButton setFrame:CGRectMake(27+70, window.frame.size.height - 22 - 52, minitButton.frame.size.width, minitButton.frame.size.height)];
//add them to the window
[window.contentView addSubview:closeButton];
[window.contentView addSubview:fullScreenButton];
[window.contentView addSubview:minitButton];
Теперь, когда появляется окно с кнопками, возникают две проблемы: 1. Они серые и неправильный цвет 2. когда мышь над ними, они не показывают знак + - или x
может кто-либо сказать мне, что я делаю неправильно. Спасибо.