Обновить
2
0
Dmitry Pavlov @dmitry_pavlov

ASP.NET Core, Blazor, .NET Core, .NET, C#

Отправить сообщение

Tree Structure in EF Core: How to configure a self-referencing table and use it

Время на прочтение4 мин
Количество просмотров30K

One of the very common questions I am getting from .NET community is how to configure and use the tree structures in EF Core. This story is one of the possible ways to do it.


The common tree structures are file tree, categories hierarchy, and so on. Let it be folders tree for example. The entity class will be a Folder:


public class Folder
{
    public Guid Id { get; set; }
    public string Name { get; set; }      
    public Folder Parent { get; set; }
    public Guid? ParentId { get; set; }
    public ICollection<Folder> SubFolders { get; } = new List<Folder>();
}
Read more →

Информация

В рейтинге
Не участвует
Откуда
Санкт-Петербург, Санкт-Петербург и область, Россия
Дата рождения
Зарегистрирован
Активность