So I am trying to map an internal property to my database and according to this article online this is how you are supposed to do it. The other resources that I found also tell me to do the same thing. For whatever reason the method doesn't exist and I can't find online what they renamed it too or if they just removed the method.
Here is my code:
public class Criteria : DbEntity { internal string _Condition { get; set; } [NotMapped] public Condition Condition { get { return string.IsNullOrEmpty(_Condition) ? null : JsonConvert.DeserializeObject<Condition>(_Condition); } set { _Condition = JsonConvert.SerializeObject(value); } } } protected override void OnModelCreating(ModelBuilder builder) { builder.Entity<Criteria>().Property(b => b._Condition);//.HasColumnName("Condition"); <-- this doesn't exist... }
EF Core 5.0 requires a . NET Standard 2.1 platform. This means EF Core 5.0 will run on . NET Core 3.1 or .
The most recent Entity Framework Core 6.0 (EF Core 6) was released on 10 November 2021.
IEntityTypeConfiguration<TEntity> InterfaceAllows configuration for an entity type to be factored into a separate class, rather than in-line in OnModelCreating(ModelBuilder).
Had to install Microsoft.EntityFrameworkCore.Relational
to fix the issue.
Edit: Credit goes to Ivan Stoev for finding this out
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With