What happened to HasColumnName for EF Core?

c# ef-code-first entity-framework entity-framework-core

Question

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...
}
1
19
8/11/2017 1:10:58 PM

Accepted Answer

Had to install Microsoft.EntityFrameworkCore.Relational to fix the issue.

48
8/7/2017 8:38:29 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow