Base solution for your next web application
Open Closed

Tests Failing - no suitable constructor was found for entity type Hierarchy Id #12005


User avatar
0
naurinrr created
``Message: 
  System.InvalidOperationException : No suitable constructor was found for entity type 'HierarchyId'. The following constructors had parameters that could not be bound to properties of the entity type: 
      Cannot bind 'value' in 'HierarchyId(SqlHierarchyId value)'
  Note that only mapped properties can be bound to constructor parameters. Navigations to related entities, including references to owned types, cannot be bound.
 
Our app uses a Sql Server Type:Hierarchy Id to store hierarchical data and we have configured the options in the DbContextConfigurator.
 
public static void Configure(DbContextOptionsBuilder<DbContext> builder, string connectionString)
{
    builder.UseSqlServer(connectionString, conf => {
        conf.UseHierarchyId();
    });
}
 
public static void Configure(DbContextOptionsBuilder<DbContext> builder, DbConnection connection)
{
    builder.UseSqlServer(connection, conf => {
        conf.UseHierarchyId();
    });
}
 
Can you please advise how to change the base test project to handle this?
 


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @naurinrr

    I tried this with latest version and couldn't reproduce the problem. Could you share the steps to reproduce this issue ?