@@ -14,25 +14,32 @@ public class YdbValueGenerationConvention(
1414{
1515 protected override ValueGenerated ? GetValueGenerated ( IConventionProperty property )
1616 {
17- if ( property . DeclaringType . IsMappedToJson ( )
18- #pragma warning disable EF1001 // Internal EF Core API usage.
19- && property . IsOrdinalKeyProperty ( )
20- #pragma warning restore EF1001 // Internal EF Core API usage.
21- && ( property . DeclaringType as IReadOnlyEntityType ) ? . FindOwnership ( ) ! . IsUnique == false )
22- {
23- return ValueGenerated . OnAdd ;
24- }
17+ var table = property . GetMappedStoreObjects ( StoreObjectType . Table ) . FirstOrDefault ( ) ;
2518
26- var declaringTable = property . GetMappedStoreObjects ( StoreObjectType . Table ) . FirstOrDefault ( ) ;
27- if ( declaringTable . Name == null )
28- {
29- return null ;
30- }
19+ return ! MappingStrategyAllowsValueGeneration ( property , property . DeclaringType . GetMappingStrategy ( ) )
20+ ? null
21+ : table . Name != null
22+ ? GetValueGenerated ( property , table )
23+ : property . DeclaringType . IsMappedToJson ( )
24+ && property . IsOrdinalKeyProperty ( )
25+ && ( property . DeclaringType as IReadOnlyEntityType ) ? . FindOwnership ( ) ! . IsUnique == false
26+ ? ValueGenerated . OnAddOrUpdate
27+ : property . GetMappedStoreObjects ( StoreObjectType . InsertStoredProcedure ) . Any ( )
28+ ? GetValueGenerated ( ( IReadOnlyProperty ) property )
29+ : null ;
30+ }
3131
32- return property . GetComputedColumnSql ( declaringTable ) != null
33- ? ValueGenerated . OnAddOrUpdate
34- : property . GetDefaultValueSql ( declaringTable ) != null
35- ? ValueGenerated . OnAdd
36- : null ;
32+ private new static ValueGenerated ? GetValueGenerated (
33+ IReadOnlyProperty property ,
34+ in StoreObjectIdentifier storeObject
35+ )
36+ {
37+ var valueGenerated = GetValueGenerated ( property ) ;
38+ return valueGenerated
39+ ?? ( property . GetComputedColumnSql ( storeObject ) != null
40+ ? ValueGenerated . OnAddOrUpdate
41+ : property . GetDefaultValueSql ( storeObject ) != null
42+ ? ValueGenerated . OnAdd
43+ : null ) ;
3744 }
3845}
0 commit comments