What's wrong with HasColumnName for EF Core?

So I am trying to map an internal property to my database and according to this article on the internet , this is how you should do it.Other resources I have found also tell me to do the same. For some reason the method doesn't exist and I can't find on the internet what they renamed, 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...
}

      

+3


source to share


1 answer


Will have to install Microsoft.EntityFrameworkCore.Relational

to fix the problem.



+9


source







All Articles