Skip to content
Advertisement

Tag: asp.net-core

In entity framework core, how we can set relationship for a table, when two fields is mapping to primary key of the another table

In entity framework core, how we can set relationship for a table, when two fields is mapping to primary key of the another table. For example I have two table namely Users & CashBox. Users Table Field Value UserId int UserName string CashBox Table Field Value CashBoxId int ActivatedBy int DeactivatedBy int In this case, activatedby & deactivatedby has to

RawSQL and auto-generated keys in EF Core 3.1

I have a Model with a Guid primary key. I want the Database to generate a key on insert so I added the following annotations: Now I expected that inserts with RawSQL wouldn’t expect a primary key, however the folllowing statement doesn’t work when executred through ExecuteSqlRaw: An error is caused by the DB about a non-nullable primary key. Explicitly

Advertisement