Note that there are some explanatory texts on larger screens.

plurals
  1. PONewbie view model issue.. to subclass or not to subclass
    primarykey
    data
    text
    <p>Ok dead basic question, I'm a self taught developer so often I seem to have gaps where I can't decide which was is the right way... and this is one of them!! Simple I have a view model which has a collection of child items. But where these classes are defined I can't decide if the child object should be a subclass of the parent...</p> <p>For example this:</p> <pre><code>public class ActionChartViewModel { public IEnumerable&lt;ActionChartItemViewModel&gt; Items { get; set; } public TextPagingInfo TextPagingInfo { get; set; } } public class ActionChartItemViewModel { public int Id { get; set; } public string Name { get; set; } public string Rating { get; set; } public string Comment { get; set; } public string AssignedToUserName { get; set; } public string ContactRequested { get; set; } public bool Resolved { get; set; } public int NoteCount { get; set; } public string ContactDetails { get; set; } public int ResponseId { get; set; } } </code></pre> <p>Or this:</p> <pre><code>public class ActionChartViewModel { public IEnumerable&lt;Item&gt; Items { get; set; } public TextPagingInfo TextPagingInfo { get; set; } public class Item { public int Id { get; set; } public string Name { get; set; } public string Rating { get; set; } public string Comment { get; set; } public string AssignedToUserName { get; set; } public string ContactRequested { get; set; } public bool Resolved { get; set; } public int NoteCount { get; set; } public string ContactDetails { get; set; } public int ResponseId { get; set; } } } </code></pre> <p>I prefer the second one for a code readability and simplicity front, but I don't know the pros and cons of subclasses. What would you guys think??</p> <p>Thanks in advance!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload