For my models for a certain section I thought it would be better to have a base class model for both "view" and "edit" models, like so:
public abstract class Setting
{
[Required]
public int SettingId { get; set; }
public string Name { get; set; }
[Required]
[MaxLength(255)]
public string Value { get; set; }
public string ModifiedBy { get; set; }
public DateTime ModifiedDt { get; set; }
}
public class ViewSetting : Setting
{
}
public class EditSetting : Setting
{
}
So in my Service
or Views
I use the appropriate ViewSetting
or EditSetting
. Right now I don't have anything that would be different - but should I follow a pattern like this to maintain a separation of concerns here? Or should I just stick to using one Setting
class? (as an aside, I'm using Entity Frameworks but in my Service layer is where I convert to/from the models for the ORM)
Setting
as an object in bothViewSetting
andEditSetting
? – Doctor Oreo May 16 '13 at 0:17