@@ -376,177 +376,5 @@ private static bool IsCompatibleWithValueGeneration(
376
376
return ( type . IsInteger ( )
377
377
|| type == typeof ( decimal ) ) ;
378
378
}
379
-
380
- /// <summary>
381
- /// Returns the name to use for the key value generation sequence.
382
- /// </summary>
383
- /// <param name="property">The property.</param>
384
- /// <returns>The name to use for the key value generation sequence.</returns>
385
- public static string ? GetJetSequenceName ( this IReadOnlyProperty property )
386
- => ( string ? ) property [ JetAnnotationNames . SequenceName ] ;
387
-
388
- /// <summary>
389
- /// Returns the name to use for the key value generation sequence.
390
- /// </summary>
391
- /// <param name="property">The property.</param>
392
- /// <param name="storeObject">The identifier of the store object.</param>
393
- /// <returns>The name to use for the key value generation sequence.</returns>
394
- public static string ? GetJetSequenceName ( this IReadOnlyProperty property , in StoreObjectIdentifier storeObject )
395
- {
396
- var annotation = property . FindAnnotation ( JetAnnotationNames . SequenceName ) ;
397
- if ( annotation != null )
398
- {
399
- return ( string ? ) annotation . Value ;
400
- }
401
-
402
- return property . FindSharedStoreObjectRootProperty ( storeObject ) ? . GetJetSequenceName ( storeObject ) ;
403
- }
404
-
405
- /// <summary>
406
- /// Sets the name to use for the key value generation sequence.
407
- /// </summary>
408
- /// <param name="property">The property.</param>
409
- /// <param name="name">The sequence name to use.</param>
410
- public static void SetJetSequenceName ( this IMutableProperty property , string ? name )
411
- => property . SetOrRemoveAnnotation (
412
- JetAnnotationNames . SequenceName ,
413
- Check . NullButNotEmpty ( name , nameof ( name ) ) ) ;
414
-
415
- /// <summary>
416
- /// Sets the name to use for the key value generation sequence.
417
- /// </summary>
418
- /// <param name="property">The property.</param>
419
- /// <param name="name">The sequence name to use.</param>
420
- /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
421
- /// <returns>The configured value.</returns>
422
- public static string ? SetJetSequenceName (
423
- this IConventionProperty property ,
424
- string ? name ,
425
- bool fromDataAnnotation = false )
426
- => ( string ? ) property . SetOrRemoveAnnotation (
427
- JetAnnotationNames . SequenceName ,
428
- Check . NullButNotEmpty ( name , nameof ( name ) ) ,
429
- fromDataAnnotation ) ? . Value ;
430
-
431
- /// <summary>
432
- /// Returns the <see cref="ConfigurationSource" /> for the key value generation sequence name.
433
- /// </summary>
434
- /// <param name="property">The property.</param>
435
- /// <returns>The <see cref="ConfigurationSource" /> for the key value generation sequence name.</returns>
436
- public static ConfigurationSource ? GetJetSequenceNameConfigurationSource ( this IConventionProperty property )
437
- => property . FindAnnotation ( JetAnnotationNames . SequenceName ) ? . GetConfigurationSource ( ) ;
438
-
439
- /// <summary>
440
- /// Returns the schema to use for the key value generation sequence.
441
- /// </summary>
442
- /// <param name="property">The property.</param>
443
- /// <returns>The schema to use for the key value generation sequence.</returns>
444
- public static string ? GetJetSequenceSchema ( this IReadOnlyProperty property )
445
- => ( string ? ) property [ JetAnnotationNames . SequenceSchema ] ;
446
-
447
- /// <summary>
448
- /// Returns the schema to use for the key value generation sequence.
449
- /// </summary>
450
- /// <param name="property">The property.</param>
451
- /// <param name="storeObject">The identifier of the store object.</param>
452
- /// <returns>The schema to use for the key value generation sequence.</returns>
453
- public static string ? GetJetSequenceSchema ( this IReadOnlyProperty property , in StoreObjectIdentifier storeObject )
454
- {
455
- var annotation = property . FindAnnotation ( JetAnnotationNames . SequenceSchema ) ;
456
- if ( annotation != null )
457
- {
458
- return ( string ? ) annotation . Value ;
459
- }
460
-
461
- return property . FindSharedStoreObjectRootProperty ( storeObject ) ? . GetJetSequenceSchema ( storeObject ) ;
462
- }
463
-
464
- /// <summary>
465
- /// Sets the schema to use for the key value generation sequence.
466
- /// </summary>
467
- /// <param name="property">The property.</param>
468
- /// <param name="schema">The schema to use.</param>
469
- public static void SetJetSequenceSchema ( this IMutableProperty property , string ? schema )
470
- => property . SetOrRemoveAnnotation (
471
- JetAnnotationNames . SequenceSchema ,
472
- Check . NullButNotEmpty ( schema , nameof ( schema ) ) ) ;
473
-
474
- /// <summary>
475
- /// Sets the schema to use for the key value generation sequence.
476
- /// </summary>
477
- /// <param name="property">The property.</param>
478
- /// <param name="schema">The schema to use.</param>
479
- /// <param name="fromDataAnnotation">Indicates whether the configuration was specified using a data annotation.</param>
480
- /// <returns>The configured value.</returns>
481
- public static string ? SetJetSequenceSchema (
482
- this IConventionProperty property ,
483
- string ? schema ,
484
- bool fromDataAnnotation = false )
485
- => ( string ? ) property . SetOrRemoveAnnotation (
486
- JetAnnotationNames . SequenceSchema ,
487
- Check . NullButNotEmpty ( schema , nameof ( schema ) ) ,
488
- fromDataAnnotation ) ? . Value ;
489
-
490
- /// <summary>
491
- /// Returns the <see cref="ConfigurationSource" /> for the key value generation sequence schema.
492
- /// </summary>
493
- /// <param name="property">The property.</param>
494
- /// <returns>The <see cref="ConfigurationSource" /> for the key value generation sequence schema.</returns>
495
- public static ConfigurationSource ? GetGetSequenceSchemaConfigurationSource ( this IConventionProperty property )
496
- => property . FindAnnotation ( JetAnnotationNames . SequenceSchema ) ? . GetConfigurationSource ( ) ;
497
-
498
- /// <summary>
499
- /// Finds the <see cref="ISequence" /> in the model to use for the key value generation pattern.
500
- /// </summary>
501
- /// <param name="property">The property.</param>
502
- /// <returns>The sequence to use, or <see langword="null" /> if no sequence exists in the model.</returns>
503
- public static IReadOnlySequence ? FindJetSequence ( this IReadOnlyProperty property )
504
- {
505
- var model = property . DeclaringType . Model ;
506
-
507
- var sequenceName = property . GetJetSequenceName ( )
508
- ?? model . GetJetSequenceNameSuffix ( ) ;
509
-
510
- var sequenceSchema = property . GetJetSequenceSchema ( )
511
- ?? model . GetJetSequenceSchema ( ) ;
512
-
513
- return model . FindSequence ( sequenceName , sequenceSchema ) ;
514
- }
515
-
516
- /// <summary>
517
- /// Finds the <see cref="ISequence" /> in the model to use for the key value generation pattern.
518
- /// </summary>
519
- /// <param name="property">The property.</param>
520
- /// <param name="storeObject">The identifier of the store object.</param>
521
- /// <returns>The sequence to use, or <see langword="null" /> if no sequence exists in the model.</returns>
522
- public static IReadOnlySequence ? FindJetSequence ( this IReadOnlyProperty property , in StoreObjectIdentifier storeObject )
523
- {
524
- var model = property . DeclaringType . Model ;
525
-
526
- var sequenceName = property . GetJetSequenceName ( storeObject )
527
- ?? model . GetJetSequenceNameSuffix ( ) ;
528
-
529
- var sequenceSchema = property . GetJetSequenceSchema ( storeObject )
530
- ?? model . GetJetSequenceSchema ( ) ;
531
-
532
- return model . FindSequence ( sequenceName , sequenceSchema ) ;
533
- }
534
-
535
- /// <summary>
536
- /// Finds the <see cref="ISequence" /> in the model to use for the key value generation pattern.
537
- /// </summary>
538
- /// <param name="property">The property.</param>
539
- /// <returns>The sequence to use, or <see langword="null" /> if no sequence exists in the model.</returns>
540
- public static ISequence ? FindJetSequence ( this IProperty property )
541
- => ( ISequence ? ) ( ( IReadOnlyProperty ) property ) . FindJetSequence ( ) ;
542
-
543
- /// <summary>
544
- /// Finds the <see cref="ISequence" /> in the model to use for the key value generation pattern.
545
- /// </summary>
546
- /// <param name="property">The property.</param>
547
- /// <param name="storeObject">The identifier of the store object.</param>
548
- /// <returns>The sequence to use, or <see langword="null" /> if no sequence exists in the model.</returns>
549
- public static ISequence ? FindJetSequence ( this IProperty property , in StoreObjectIdentifier storeObject )
550
- => ( ISequence ? ) ( ( IReadOnlyProperty ) property ) . FindJetSequence ( storeObject ) ;
551
379
}
552
380
}
0 commit comments