@@ -168,11 +168,11 @@ public virtual ComplexTypePropertyBuilder Property(string propertyName)
168
168
/// If no property with the given name exists, then a new property will be added.
169
169
/// </summary>
170
170
/// <remarks>
171
- /// When adding a new property, if a property with the same name exists in the entity class
172
- /// then it will be added to the model. If no property exists in the entity class, then
171
+ /// When adding a new property, if a property with the same name exists in the complex class
172
+ /// then it will be added to the model. If no property exists in the complex class, then
173
173
/// a new shadow state property will be added. A shadow state property is one that does not have a
174
- /// corresponding property in the entity class. The current value for the property is stored in
175
- /// the <see cref="ChangeTracker" /> rather than being stored in instances of the entity class.
174
+ /// corresponding property in the complex class. The current value for the property is stored in
175
+ /// the <see cref="ChangeTracker" /> rather than being stored in instances of the complex class.
176
176
/// </remarks>
177
177
/// <typeparam name="TProperty">The type of the property to be configured.</typeparam>
178
178
/// <param name="propertyName">The name of the property to be configured.</param>
@@ -188,11 +188,11 @@ public virtual ComplexTypePropertyBuilder<TProperty> Property<TProperty>(string
188
188
/// If no property with the given name exists, then a new property will be added.
189
189
/// </summary>
190
190
/// <remarks>
191
- /// When adding a new property, if a property with the same name exists in the entity class
192
- /// then it will be added to the model. If no property exists in the entity class, then
191
+ /// When adding a new property, if a property with the same name exists in the complex class
192
+ /// then it will be added to the model. If no property exists in the complex class, then
193
193
/// a new shadow state property will be added. A shadow state property is one that does not have a
194
- /// corresponding property in the entity class. The current value for the property is stored in
195
- /// the <see cref="ChangeTracker" /> rather than being stored in instances of the entity class.
194
+ /// corresponding property in the complex class. The current value for the property is stored in
195
+ /// the <see cref="ChangeTracker" /> rather than being stored in instances of the complex class.
196
196
/// </remarks>
197
197
/// <param name="propertyType">The type of the property to be configured.</param>
198
198
/// <param name="propertyName">The name of the property to be configured.</param>
@@ -225,11 +225,11 @@ public virtual ComplexTypePrimitiveCollectionBuilder PrimitiveCollection(string
225
225
/// If no property with the given name exists, then a new property will be added.
226
226
/// </summary>
227
227
/// <remarks>
228
- /// When adding a new property, if a property with the same name exists in the entity class
229
- /// then it will be added to the model. If no property exists in the entity class, then
228
+ /// When adding a new property, if a property with the same name exists in the complex class
229
+ /// then it will be added to the model. If no property exists in the complex class, then
230
230
/// a new shadow state property will be added. A shadow state property is one that does not have a
231
- /// corresponding property in the entity class. The current value for the property is stored in
232
- /// the <see cref="ChangeTracker" /> rather than being stored in instances of the entity class.
231
+ /// corresponding property in the complex class. The current value for the property is stored in
232
+ /// the <see cref="ChangeTracker" /> rather than being stored in instances of the complex class.
233
233
/// </remarks>
234
234
/// <typeparam name="TProperty">The type of the property to be configured.</typeparam>
235
235
/// <param name="propertyName">The name of the property to be configured.</param>
@@ -245,11 +245,11 @@ public virtual ComplexTypePrimitiveCollectionBuilder<TProperty> PrimitiveCollect
245
245
/// If no property with the given name exists, then a new property will be added.
246
246
/// </summary>
247
247
/// <remarks>
248
- /// When adding a new property, if a property with the same name exists in the entity class
249
- /// then it will be added to the model. If no property exists in the entity class, then
248
+ /// When adding a new property, if a property with the same name exists in the complex class
249
+ /// then it will be added to the model. If no property exists in the complex class, then
250
250
/// a new shadow state property will be added. A shadow state property is one that does not have a
251
- /// corresponding property in the entity class. The current value for the property is stored in
252
- /// the <see cref="ChangeTracker" /> rather than being stored in instances of the entity class.
251
+ /// corresponding property in the complex class. The current value for the property is stored in
252
+ /// the <see cref="ChangeTracker" /> rather than being stored in instances of the complex class.
253
253
/// </remarks>
254
254
/// <param name="propertyType">The type of the property to be configured.</param>
255
255
/// <param name="propertyName">The name of the property to be configured.</param>
@@ -265,7 +265,7 @@ public virtual ComplexTypePrimitiveCollectionBuilder PrimitiveCollection(Type pr
265
265
/// If no property with the given name exists, then a new property will be added.
266
266
/// </summary>
267
267
/// <remarks>
268
- /// Indexer properties are stored in the entity using
268
+ /// Indexer properties are stored in the complex type using
269
269
/// <see href="https://docs.microsoft.com/dotnet/csharp/programming-guide/indexers/">an indexer</see>
270
270
/// supplying the provided property name.
271
271
/// </remarks>
@@ -284,7 +284,7 @@ public virtual ComplexTypePropertyBuilder<TProperty> IndexerProperty
284
284
/// If no property with the given name exists, then a new property will be added.
285
285
/// </summary>
286
286
/// <remarks>
287
- /// Indexer properties are stored in the entity using
287
+ /// Indexer properties are stored in the complex type using
288
288
/// <see href="https://docs.microsoft.com/dotnet/csharp/programming-guide/indexers/">an indexer</see>
289
289
/// supplying the provided property name.
290
290
/// </remarks>
@@ -563,8 +563,8 @@ public virtual ComplexPropertyBuilder Ignore(string propertyName)
563
563
}
564
564
565
565
/// <summary>
566
- /// Configures the <see cref="ChangeTrackingStrategy" /> to be used for this entity type.
567
- /// This strategy indicates how the context detects changes to properties for an instance of the entity type.
566
+ /// Configures the <see cref="ChangeTrackingStrategy" /> to be used for this complex type.
567
+ /// This strategy indicates how the context detects changes to properties for an instance of the complex type.
568
568
/// </summary>
569
569
/// <param name="changeTrackingStrategy">The change tracking strategy to be used.</param>
570
570
/// <returns>The same builder instance so that multiple configuration calls can be chained.</returns>
@@ -623,6 +623,53 @@ public virtual ComplexPropertyBuilder UseDefaultPropertyAccessMode(PropertyAcces
623
623
return this ;
624
624
}
625
625
626
+ /// <summary>
627
+ /// Configures the discriminator property used to identify the complex type in the store.
628
+ /// </summary>
629
+ /// <returns>A builder that allows the discriminator property to be configured.</returns>
630
+ public virtual ComplexTypeDiscriminatorBuilder HasDiscriminator ( )
631
+ => TypeBuilder . HasDiscriminator ( ConfigurationSource . Explicit ) ! ;
632
+
633
+ /// <summary>
634
+ /// Configures the discriminator property used to identify the complex type in the store.
635
+ /// </summary>
636
+ /// <param name="name">The name of the discriminator property.</param>
637
+ /// <param name="type">The type of values stored in the discriminator property.</param>
638
+ /// <returns>A builder that allows the discriminator property to be configured.</returns>
639
+ public virtual ComplexTypeDiscriminatorBuilder HasDiscriminator (
640
+ string name ,
641
+ Type type )
642
+ {
643
+ Check . NotEmpty ( name , nameof ( name ) ) ;
644
+ Check . NotNull ( type , nameof ( type ) ) ;
645
+
646
+ return TypeBuilder . HasDiscriminator ( name , type , ConfigurationSource . Explicit ) ! ;
647
+ }
648
+
649
+ /// <summary>
650
+ /// Configures the discriminator property used to identify the complex type in the store.
651
+ /// </summary>
652
+ /// <typeparam name="TDiscriminator">The type of values stored in the discriminator property.</typeparam>
653
+ /// <param name="name">The name of the discriminator property.</param>
654
+ /// <returns>A builder that allows the discriminator property to be configured.</returns>
655
+ public virtual ComplexTypeDiscriminatorBuilder < TDiscriminator > HasDiscriminator < TDiscriminator > ( string name )
656
+ {
657
+ Check . NotEmpty ( name , nameof ( name ) ) ;
658
+
659
+ return new ComplexTypeDiscriminatorBuilder < TDiscriminator > (
660
+ TypeBuilder . HasDiscriminator ( name , typeof ( TDiscriminator ) , ConfigurationSource . Explicit ) ! ) ;
661
+ }
662
+
663
+ /// <summary>
664
+ /// Configures the complex type as having no discriminator property.
665
+ /// </summary>
666
+ /// <returns>The same builder instance so that multiple configuration calls can be chained.</returns>
667
+ public virtual ComplexPropertyBuilder HasNoDiscriminator ( )
668
+ {
669
+ TypeBuilder . HasNoDiscriminator ( ConfigurationSource . Explicit ) ;
670
+ return this ;
671
+ }
672
+
626
673
#region Hidden System.Object members
627
674
628
675
/// <summary>
0 commit comments