I have these classes:
MenuComponent
MenuContainer
A MenuContainer can be seen as a menu. A menu has many elements. But a menu can be contained by another menu.
I want to persist this but I'm not getting how would be best:
namespace menu_builder_rbac {
public abstract class MenuComponent {
[Key]
public int MenuComponentId { get; set; }
public string DisplayName { get; set; }
public string Name { get; set; }
public string HtmlId { get; set; }
public string HtmlCssClass { get; set; }
public string Url { get; set; }
public string IconUrl { get; set; }
public bool Equals(MenuComponent menuComponent) {
return (this.MenuComponentId == menuComponent.MenuComponentId) || (this.Name == menuComponent.Name);
}
}
public class MenuContainer : MenuComponent {
public ICollection<MenuComponent> MenuComponentMenuContainer { get; set; }
}
}