AggregateRoot.ExtraProperties could not be mapped Ef Core
#247, #641 IHasExtraProperties implementation needs revision for ef core.
Error occured in https://abp.io/documents/abp/latest/Tutorials/AspNetCore-Mvc/Part-I tutorial.
Error details after running add-migration: The property 'Book.ExtraProperties' could not be mapped, because it is of type 'Dictionary<string, object>' which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.
Oh, the aggregate root change has affected it. We will update the tutorial in a short time. Thank you for reporting this.
This will be automatic in the next release: https://github.com/abpframework/abp/issues/682
Whose try to upgrade project, i have done successfully by re-creating migrations at the final and just copied the first initial, designer and snapshot from renew created project from abp.io
Because homehow, i couldn't make new migrations was having an error called
One or more errors occurred. (Invalid column name 'ConcurrencyStamp'.
Invalid column name 'ExtraProperties'.)
Hi, i have the same error, when i run Add-Migration on EntityFrameworkCore.DbMigration project,
am i wrong with prepare Entity Class?
My Entity Classes are here,
public class EAInvoiceMaster: AggregateRoot
}
public string StationCode { get; set; }
public string OrderNumber { get; set; }
public DateTime OrderDate { get; set; }
public string LicensePlate { get; set; }
public virtual ICollection<EAInvoiceDetail> EAInvoiceDetail { get; set; }
public EAInvoiceMaster(Guid id,string stationCode, string orderNumber, DateTime orderDate, string licensePlate):base(id)
{
StationCode = stationCode;
OrderNumber = orderNumber;
OrderDate = orderDate;
LicensePlate = licensePlate;
}
}
public class EAInvoiceDetail:AggregateRoot
}
public Guid MasterId { get; set; }
public int LineNumber { get; set; }
public string ServiceType { get; set; }
public decimal Quantity { get; set; }
public decimal UnitPrice { get; set; }
[ForeignKey("MasterId")]
public virtual EAInvoiceMaster EAInvoiceMaster { get; set; }
public EAInvoiceDetail(Guid id,Guid masterId,int lineNumber,string serviceType,decimal quantity,decimal unitPrice):base(id)
{
MasterId = masterId;
LineNumber = lineNumber;
ServiceType = serviceType;
Quantity = quantity;
UnitPrice = unitPrice;
}
The property 'EAInvoiceDetail.ExtraProperties' could not be mapped, because it is of type 'Dictionary<string, object>' which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.
- Did you inherit
AbpDbContext? - Did you override
OnModelCreating? If yes, then did you call thebasemethod?
Hi, it was my mistake, I forgot the ConfigureExtraProperties() in ConfigureExtension. The problem solved. Thanks for your help.