You must Sign In to post a response.
  • Category: .NET

    Developing menu items

    Hi All,

    I have to create a class with sub class again in sub class there is another subclass like three levels with same structure same below

    public class Menu
    {
    public int MenuId { get; set; }
    public int? ParentId { get; set; }
    public string MenuName { get; set; }
    public bool Active { get; set; }
    public bool Delete { get; set; }
    public string FileName { get; set; }
    public string Path { get; set; }
    public int? Order { get; set; }
    public List<SubMenu> SubMenu { get; set; }

    }

    public class SubMenu
    {
    public int MenuId { get; set; }
    public int ParentId { get; set; }
    public string MenuName { get; set; }
    public bool Active { get; set; }
    public bool Delete { get; set; }
    public string FileName { get; set; }
    public string Path { get; set; }
    public int? Order { get; set; }
    public List<SubSubMenu> SubSubMenu { get; set; }
    }

    public class SubSubMenu
    {
    public int MenuId { get; set; }
    public int ParentId { get; set; }
    public string MenuName { get; set; }
    public bool Active { get; set; }
    public bool Delete { get; set; }
    public string FileName { get; set; }
    public string Path { get; set; }
    public int? Order { get; set; }

    }

    I am creating this class for generate menus.. using LINQ i am adding subclass content

    Is there any other better way to develop this?

    Thanks in advance

    Regards,
    Swarna.
  • #764325
    Hai Swarna,
    You can use the simple objects insertion for the child and grand child records into the parent records object.
    I think its good to go with the Linq if you can manage them correctly.
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com


Sign In to post your comments