@@ -549,6 +549,17 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con
549
549
modelBuilder . Entity < Bayaz > ( ) ;
550
550
modelBuilder . Entity < SecondLaw > ( ) ;
551
551
modelBuilder . Entity < ThirdLaw > ( ) ;
552
+
553
+ modelBuilder . Entity < Beetroot2 > ( ) . HasData (
554
+ new { Id = 1 , Key = "root-1" , Name = "Root One" } ) ;
555
+
556
+ modelBuilder . Entity < Lettuce2 > ( ) . HasData (
557
+ new { Id = 4 , Key = "root-1/leaf-1" , Name = "Leaf One-One" , RootId = 1 } ) ;
558
+
559
+ modelBuilder . Entity < Radish2 > ( )
560
+ . HasMany ( entity => entity . Entities )
561
+ . WithMany ( )
562
+ . UsingEntity < RootStructure > ( ) ;
552
563
}
553
564
554
565
protected virtual object CreateFullGraph ( )
@@ -3984,6 +3995,68 @@ public virtual SecondLaw SecondLaw
3984
3995
}
3985
3996
}
3986
3997
3998
+ protected abstract class Parsnip2 : NotifyingEntity
3999
+ {
4000
+ private int _id ;
4001
+
4002
+ public int Id
4003
+ {
4004
+ get => _id ;
4005
+ set => SetWithNotify ( value , ref _id ) ;
4006
+ }
4007
+ }
4008
+
4009
+ protected class Lettuce2 : Parsnip2
4010
+ {
4011
+ private Beetroot2 _root ;
4012
+
4013
+ public Beetroot2 Root
4014
+ {
4015
+ get => _root ;
4016
+ set => SetWithNotify ( value , ref _root ) ;
4017
+ }
4018
+ }
4019
+
4020
+ protected class RootStructure : NotifyingEntity
4021
+ {
4022
+ private Guid _radish2Id ;
4023
+ private int _parsnip2Id ;
4024
+
4025
+ public Guid Radish2Id
4026
+ {
4027
+ get => _radish2Id ;
4028
+ set => SetWithNotify ( value , ref _radish2Id ) ;
4029
+ }
4030
+
4031
+ public int Parsnip2Id
4032
+ {
4033
+ get => _parsnip2Id ;
4034
+ set => SetWithNotify ( value , ref _parsnip2Id ) ;
4035
+ }
4036
+ }
4037
+
4038
+ protected class Radish2 : NotifyingEntity
4039
+ {
4040
+ private Guid _id ;
4041
+ private ICollection < Parsnip2 > _entities = new ObservableHashSet < Parsnip2 > ( ) ;
4042
+
4043
+ public Guid Id
4044
+ {
4045
+ get => _id ;
4046
+ set => SetWithNotify ( value , ref _id ) ;
4047
+ }
4048
+
4049
+ public ICollection < Parsnip2 > Entities
4050
+ {
4051
+ get => _entities ;
4052
+ set => SetWithNotify ( value , ref _entities ) ;
4053
+ }
4054
+ }
4055
+
4056
+ protected class Beetroot2 : Parsnip2
4057
+ {
4058
+ }
4059
+
3987
4060
protected class NotifyingEntity : INotifyPropertyChanging , INotifyPropertyChanged
3988
4061
{
3989
4062
protected void SetWithNotify < T > ( T value , ref T field , [ CallerMemberName ] string propertyName = "" )
0 commit comments