© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
22 replies
Tvde1

Not mapping an EF Core DB-First enum property

I have scaffolded my Db Context. My entity has a
[Column("status")]
public string _status { get; set; }
[Column("status")]
public string _status { get; set; }

I am making a partial class which is:
public partial class Host
{
    [NotMapped]
    public HostStatus Status
    {
        get => Enum.Parse<HostStatus>(this._status);
        set => this._status = value.ToString().ToLower();
    }
}
public partial class Host
{
    [NotMapped]
    public HostStatus Status
    {
        get => Enum.Parse<HostStatus>(this._status);
        set => this._status = value.ToString().ToLower();
    }
}

Yet, when I do
_context.Hosts.ToList()
_context.Hosts.ToList()
, it does attempt to select a column named "Status". How do I prevent this? The
NotMapped
NotMapped
attribute does not seem to be working.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

EF Core Model not-required property
C#CC# / help
4y ago
❔ EF Core Code-first relationships
C#CC# / help
4y ago
Updating a property and saving it to DB (EF Core)
C#CC# / help
4y ago