Skip to content

Support for EF Core 6 #46

@N-Olbert

Description

@N-Olbert

Hello,

are there any plans to support EF Core 6?

Currently it seems that only EF Core 5 is fully supported, f. e. on EF Core 6 we get the following error message:

System.MissingMethodException: Method not found: 'Boolean Microsoft.EntityFrameworkCore.Metadata.IForeignKey.get_IsUnique()'.
at TrackableEntities.EF.Core.NavigationExtensions.GetRelationshipType(INavigationBase navigation)
at TrackableEntities.EF.Core.DbContextExtensions.<>c.<ApplyChanges>b__0_0(EntityEntryGraphNode node)
at Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.<>c.<TrackGraph>b__30_0(EntityEntryGraphNode`1 n)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph[TState](EntityEntryGraphNode`1 node, Func`2 handleNode)
at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.EntityEntryGraphIterator.TraverseGraph[TState](EntityEntryGraphNode`1 node, Func`2 handleNode)
at Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.TrackGraph[TState](Object rootEntity, TState state, Func`2 callback)
at Microsoft.EntityFrameworkCore.ChangeTracking.ChangeTracker.TrackGraph(Object rootEntity, Action`1 callback)
at TrackableEntities.EF.Core.DbContextExtensions.ApplyChanges(DbContext context, ITrackable item)
at EntitiesEFCore6.DataAdapterEfCore6.SaveEntities(List`1 entities)

For this concrete problem the reason is the following method:

public static RelationshipType? GetRelationshipType(this INavigationBase navigation)
{
var nav = navigation as INavigation;
if (nav == null) return null;
if (nav.ForeignKey.IsUnique)
return RelationshipType.OneToOne;
return nav.IsOnDependent ? RelationshipType.OneToMany : RelationshipType.ManyToOne;
}

While the ForeignKey-property still exists within the INavigation-Interface, the IsUnique-Property does not!
Looking at the IForeigenKey-Interface documentation reveals that the IsUnique-property was present in EF Core 5, but does no longer exist in EF Core 6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions