Base solution for your next web application
Open Closed

Use tool to build entity with primary key of type Long #11923


User avatar
0
Ojala7 created

Hi,

I used the tool to create an entity with Primary key of type long. The entity only has one property of type string and is multilingual. I get these errors:

  1. This class is created public class abcTranslation : Entity<long> If I create with a primary key on int, it does not put the type at the end So I removed the <long> at the end it could build ok.
  2. I run the app and when I save a new entity I get this error: Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> System.InvalidCastException: Unable to cast object of type 'System.Int64' to type 'System.Int32'.
  3. in the DB the translation table has two columns CoreId and coreId1

3 Answer(s)
  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @Ojala7,

    I created an issue for it. You can follow the progress here https://github.com/aspnetzero/aspnet-zero-core/issues/5166

  • User Avatar
    0
    Ojala7 created

    So how do I continue from here? How long will this take to fix?

  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi, you need to migrate it with efcore. This problem will resolved at next release.