---
title: "Saving Enums with Entity Framework Core"
url: https://daily.dev/posts/saving-enums-with-entity-framework-core-sfse7erol
source_url: https://nodogmablog.bryanhogan.net/2018/09/saving-enums-with-entity-framework-core
type: article
source: "No Dogma Blog (Bryan Hogan)"
published: 2026-05-31T07:47:25.980Z
updated: 2026-05-31T09:08:40.829Z
tags: [".net", "c#"]
reading_time: 3
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Saving Enums with Entity Framework Core

**[No Dogma Blog \(Bryan Hogan\)](https://daily.dev/sources/bryanhogan)** · 3 min read · 0 upvotes · 0 comments

## Summary

Entity Framework Core's value conversions feature provides a clean way to persist C# enums to a database as either strings or integers. Using the HasConversion method in OnModelCreating, you can define two-way conversion expressions: one to serialize the enum for storage and one to deserialize it back. The post demonstrates saving a DeliveryPreference enum as a VARCHAR string and an AddressType enum as an INT, including the SQL table definition and the EF Core fluent configuration code.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://nodogmablog.bryanhogan.net/2018/09/saving-enums-with-entity-framework-core>

---

Tags: [#.net](https://daily.dev/tags/.net), [#c#](https://daily.dev/tags/c#)

[View this post on daily.dev](https://daily.dev/posts/saving-enums-with-entity-framework-core-sfse7erol)
