Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12171

'The type of navigation 'Site.operatives' is 'User[]' which is an array type. Collection navigation properties cannot be arrays.'

$
0
0

I have never faced this problem before. I recently switched from azure sql server to local Db for testing.

I have been running the same thing for more than 3 months and I have never came across this issue.

I tried debugging and doing some research online, but no luck as I am still a noob XD

This happens on the service I have which is used to get siteById

public Site getSiteById(string id){  var site = _appDbContext.Sites    .FromSqlInterpolated($"SELECT * FROM [API].[dash_GetSiteStatus]({_userId}, {id})")    .OrderBy(s => s.id)    .FirstOrDefault();  return site;}

and the Site model looks like

public class Site  {  public User[] operatives { get; set; } }

and my DBContext looks like

  public class AppDbContext : DbContext {      public AppDbContext(DbContextOptions options) : base(options)      {      }      public DbSet<Site> Sites { get; set; }      .      .      public DbSet<User> Users { get; set; }  }

here is the snapshot of the error

Dependencies

<ItemGroup><PackageReference Include="Azure.Core" Version="1.17.0" /><PackageReference Include="Azure.Storage.Blobs" Version="12.9.1" /><PackageReference Include="Azure.Storage.Files.Shares" Version="12.7.0" /><PackageReference Include="EntityFramework.CodeFirstStoreFunctions" Version="1.2.0" /><PackageReference Include="GraphQL.Server.Ui.Voyager" Version="5.0.2" /><PackageReference Include="HotChocolate.AspNetCore" Version="11.2.2" /><PackageReference Include="HotChocolate.AspNetCore.Authorization" Version="11.2.2" /><PackageReference Include="HotChocolate.Data.Entityframework" Version="11.2.2" /><PackageReference Include="JWT" Version="8.2.2" /><PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.6" /><PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.2.3" /><PackageReference Include="Microsoft.EntityframeworkCore.Design" Version="5.0.6"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets><PrivateAssets>all</PrivateAssets></PackageReference><PackageReference Include="Microsoft.EntityframeworkCore.SqlServer" Version="5.0.6" /><PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0" /></ItemGroup>

Viewing all articles
Browse latest Browse all 12171

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>