Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

To Change Default Column Names Which the Framework Requires #5325


User avatar
0
FahrettinOzturk created

Hello guys,

I've downloaded the framework with VisualStudio Core MVC, and I've changed the database settings to be compatible for PostgreSQL. I'm trying to create new screens on my existing tables which I've already been using.

I've just realized that the framework requires two mandatory columns such as "Id" and "TenantId" on tables. The problem is that I've already been using the "id" column as primary key on my existing tables. PostgreSQL is case sensitive when creating columns, so the boilerplate does not recognize the column "id" in lowercase because it requires upper case for the first letter. On the other hand, I can not change the "id" column to uppercase since the table is being used by other services.

I need to change the framework's mandatory column "Id" to "id" to be able to handle that case. I think, that column comes from the abstract "Entity" class. Is there any way to change it?

Thanks in advance.


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    The case of Entity cannot be changed, but you can configure the ColumnName of the EF Core database. for example:

    modelBuilder.Entity<User>().Property(x => x.Id).HasColumnName("id");
    
  • User Avatar
    0
    alper created
    Support Team

    See the related post #40

  • User Avatar
    0
    FahrettinOzturk created

    That worked.

    Thanks!