Skip to content

Usage of typeMappingSource in SqlServerPropertyExtensions.GetValueGenerationStrategy #26674

Closed

Description

EF6.0

At current time I adding in my provider the support of ValueGenerationStrategy and trying to understand the implementation in exists providers :)

SqlServerPropertyExtensions code

internal static SqlServerValueGenerationStrategy GetValueGenerationStrategy(
this IReadOnlyProperty property,
in StoreObjectIdentifier storeObject,
ITypeMappingSource? typeMappingSource)
{
var annotation = property.FindAnnotation(SqlServerAnnotationNames.ValueGenerationStrategy);
if (annotation != null)
{
return (SqlServerValueGenerationStrategy?)annotation.Value ?? SqlServerValueGenerationStrategy.None;
}
var sharedTableRootProperty = property.FindSharedStoreObjectRootProperty(storeObject);
if (sharedTableRootProperty != null)
{
return sharedTableRootProperty.GetValueGenerationStrategy(storeObject)
== SqlServerValueGenerationStrategy.IdentityColumn
&& !property.GetContainingForeignKeys().Any(fk => !fk.IsBaseLinking())
? SqlServerValueGenerationStrategy.IdentityColumn
: SqlServerValueGenerationStrategy.None;

As I understood, parameter typeMappingSource contains the hint for work.

This parameter was added in #23929

Why typeMappingSource does not passed in recursive call (line 424 )?

return sharedTableRootProperty.GetValueGenerationStrategy(storeObject) 

I think, my question is addressed to @AndriySvyryd.

Thanks for answers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions