Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7814803

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:18:50+00:00 2026-06-02T05:18:50+00:00

We have been using EF CF for a while in our solution. Big fans!

  • 0

We have been using EF CF for a while in our solution. Big fans! Up to this point, we’ve been using a hack to support enums (creating an extra field on the model; ignore the enum durring mapping; and map the extra field to the column in the db that we would have used). Traditionally we have been storing our enums as strings(varchars) in the DB (makes it nice and readable). Now with enum support in EF 5 (Beta 2) it looks like it only supports mapping enums to int columns in the DB….Can we get EF 5 to store our enums as their string representation.

Where “Type” is an enum of type DocumentType

public enum DocumentType 
    {
        POInvoice,
        NonPOInvoice,
        Any
    }

I tried to map it using:

public class WorkflowMap : EntityTypeConfiguration<Model.Workflow.Workflow>
    {
        public WorkflowMap()
        {
            ToTable("Workflow", "Workflow");
            ...
            Property(wf => wf.Type).HasColumnType("varchar"); 

        }
    }

I thought was going to be the magic bullet but..

That just throws:

Schema specified is not valid. Errors: (571,12) : error 2019: Member
Mapping specified is not valid. The type
‘Dodson.Data.DataAccess.EFRepositories.DocumentType[Nullable=False,DefaultValue=]’
of member ‘Type’ in type
‘Dodson.Data.DataAccess.EFRepositories.Workflow’ is not compatible
with
‘SqlServer.varchar[Nullable=False,DefaultValue=,MaxLength=8000,Unicode=False,FixedLength=False]’
of member ‘Type’ in type ‘CodeFirstDatabaseSchema.Workflow’.

Your thoughts?

  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T05:18:52+00:00Added an answer on June 2, 2026 at 5:18 am

    This is currently not possible. Enum in EF has same limitations as enums in CLR – they are just named set of integer values. Check this article for confirmation:

    The EF enum type definitions live in conceptual layer. Similarly to
    CLR enums the EF enums have underlying type which is one of Edm.SByte,
    Edm.Byte, Edm.Int16, Edm.Int32 or Edm.Int64 with Edm.Int32 being the
    default underlying type if none has been specified.

    I posted article and related suggestion about this problem. If you want to see this feature in the future please vote for the suggestion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using PHPUnit for a while now, but suddenly hit a big
I have been using this copy method for quite a while, in lots of
We have been using MongoDB as our main datastore for a little while but
I have been using C# for a while now, and going back to C++
I have been using Ruby for a while now and I find, for bigger
I have been using spring for a while as my IOC. It has also
I have been using emacs for a while but not so familiar with lisp
We have been using CruiseControl for quite a while with NUnit and NAnt. For
I have been using IoC for a little while now and I am curious
I have been using LINQ to SQL for a while, and there is one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.