当前位置:网站首页>EF core: self referencing organizational structure tree
EF core: self referencing organizational structure tree
2022-07-24 23:58:00 【Director Dong】
Describe such a situation : A tree formed by organizational units

Parent node and Child node It's also OrgUnit Properties of type
class OrgUnit
{
public long Id { get; set; }
public string Name { get; set; }
public OrgUnit Parent { get; set; }
public List<OrgUnit> Children { get; set; } = new List<OrgUnit>();
}
EF core Configuration of
builder.ToTable("T_OrgUnits");
builder.Property(o => o.Name).IsRequired().IsUnicode().HasMaxLength(100);
builder.HasOne<OrgUnit>(u => u.Parent).WithMany(p => p.Children);
Review the , Need to inherit from IEntityTypeConfiguration<T> Interface . And realize Configure Method .



边栏推荐
- Analysis of WPF multi finger application development
- Use of serial queues
- SQLite database operation
- Exception, import package and file operation
- SQL result export function. If you click the work order but don't enter it, the interface is always blank and there is no response. What should you do?
- Where are MySQL version numbers 6 and 7?
- Notes of Teacher Li Hongyi's 2020 in-depth learning series 3
- Coding builds an image, inherits the self built basic image, and reports an error unauthorized: invalid credential Please confirm that you have entered the correct user name and password.
- Redis6.2 SYSTEMd startup prompt redis service: Failed with result ‘protocol‘.
- NVIDIA inspector detailed instructions
猜你喜欢

How to put long links into Excel

2022 the most NB JVM foundation to tuning notes, thoroughly understand Alibaba P6 small case

Power consumption of chip

采坑记录:TypeError: 'module' object is not callable

数组中只出现一次的两个数字

Architecture design of multi live shopping mall

Only by learning these JMeter plug-ins can we design complex performance test scenarios

ROS manipulator movelt learning notes 3 | kinect360 camera (V1) related configuration

@Mapkey usage instructions

What are the meanings and application scenarios of the three giants of cloud computing: IAAs, PAAS and SaaS?
随机推荐
Let me introduce you to the partition automatic management of data warehouse
2022 the most NB JVM foundation to tuning notes, thoroughly understand Alibaba P6 small case
代码覆盖率
Coding builds an image, inherits the self built basic image, and reports an error unauthorized: invalid credential Please confirm that you have entered the correct user name and password.
每周小结(*66):下一个五年
C language: deep analysis function stack frame
SQL result export function. If you click the work order but don't enter it, the interface is always blank and there is no response. What should you do?
Js----- Chapter 4 array
JS ------ Chapter 5 functions and events
Entity service is an anti pattern
云计算三类巨头:IaaS、PaaS、SaaS,分别是什么意思,应用场景是什么?
Technical operation
In pgplsql: = and=
你还在使用System.currentTimeMillis()?来看看StopWatch吧
Google Earth engine - the use of the neighborhood tobands function
剖析kubernetes集群内部DNS解析原理
Video chat source code - one-to-one live broadcast system source code
Power consumption of chip
.net redis client newlife.redis.core library usage
Vite3.0 has been released, can you still roll it (list of new features)