2012-04-27 57 views
0

我創建了一個使用asp.net和Model View Presenter模式的購物網站,並且架構是分層的。我知道我應該有驗證器類負責驗證業務層中的用戶輸入,並且我還應該在UI層中有驗證器來跟蹤DEEP和快速用戶響應。所以我如何在BL中驗證器類來驗證數據類型,如int,long和decimal,還遵循DRY和SOLID?我是否也需要抽象? 這裏是我的模型:我應該如何驗證數據

public class Category 
{ 
    public int Id {get;set;} 
    public string Name {get;set;} 
    public int? ParentCategory {get;set;} 
} 
public class Item 
{ 
    public int Id {get;set;} 
    public int Category {get;set;} 
    public string Model {get;set;} 
    public string Color {get;set;} 
    public string Brand {get;set;} 
    public decimal Price {get;set;} 
} 

回答

相關問題