1 year ago
#223407
KAMyAw
How to map ComplexType of EF6 in base class to derived class table in EF Core?
Our system is existed and upgrading into EF Core
We have an EntityBase class for all entities to inheritance, but every derived class has its own key "Sid"
EntityBase.cs
public abstract class EntityBase
{
// some other properties
public UpdateInfo UpdateInfo { get; set;}
}
UpdateInfo.cs
public class UpdateInfo
{
// some other properties
public string CreatedBy;
}
All business entities class is like
public class BusinessEntity: EntityBase
{
// some own properties
}
Now in our original database, every UpdateInfo will map to the derived class table as "UpdateInfo_CreatedBy" using EF 6 ComplexType with column constraint. Table will be like:
But I don't know how to map to the original database with EF Core fluent API in "OnModelCreating" with bulk configuration without changing the original database table structure and original business class definition.
EDIT:
I finally found out how bulk configuration works and successfully made the UpdateInfo normally Add-Migration
c#
entity-framework
.net-core
ef-fluent-api
0 Answers
Your Answer