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 8519633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:18:13+00:00 2026-06-11T06:18:13+00:00

I generated a new Migration, but for some reason, it drops all the enums

  • 0

I generated a new Migration, but for some reason, it drops all the enums i’m using and doesn’t add any support for it in the db schema. Although it is defined in Code-First

These are my enums:

using System;
namespace StockManagement.Enums
{
    public enum InventoryMethod
    {
        FIFO = 0,
        LIFO = 1,
        WEIGHTED_AVERAGE = 2
    }

    public enum TransactionDirection
    {
        BUY = 0,
        SELL = 1
    }
}

These are my 2 relevant classes:

public class User
{
    [Key]
    public int UserID { get; set; }
    public string UserName { get; set; }
    public string Email { get; set; }
    public string Password { get; set; }
    /// <summary>
    /// FIFO = First In First Out
    /// LIFO = Last In First Out
    /// AVG = Average
   /// </summary>
    public InventoryMethod InventoryMethod { get; set; }
    public virtual ICollection<Article> Articles { get; set; }
}

public class ArticleTransaction
{
    [Key]
    public int ArticleTransactionID { get; set; }
    public DateTime TransactionDate { get; set; }
    /// <summary>
    /// Buy = Buying goods from suppliers
    /// Sell = Selling goods to customers
    /// </summary>
    public TransactionDirection BuyOrSell { get; set; }
    public int Number { get; set; }
    public double PriceExclusive { get; set; }
    public virtual Article Article { get; set; }
}

This is my generated Migration:

using System.ComponentModel.DataAnnotations;
using System;
using StockManagement.Enums;
public class ArticleTransaction
{
    [Key]
    public int ArticleTransactionID { get; set; }


    public DateTime TransactionDate { get; set; }
    /// <summary>
    /// Buy = Buying goods from suppliers
    /// Sell = Selling goods to customers
    /// </summary>
    public TransactionDirection BuyOrSell { get; set; }
    public int Number { get; set; }
    public double PriceExclusive { get; set; }

    public virtual Article Article { get; set; }

}

I have EF 5.0 and this hasn’t changed recently 🙂
Anyone has an idea on why this is suddenly happening and how to fix this?

  • 1 1 Answer
  • 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-11T06:18:15+00:00Added an answer on June 11, 2026 at 6:18 am

    Most databases do not have concept of enums. This is reflected in EF where an enum properties are backed by columns of underlying types of the corresponding enum types. For example because the underlying enum type of the InventoryMethod type is System.Int32/int (which is the default underlying type if no specific underlying type is specified) all properties of this type will be backed by columns of int type (int in C# maps to Edm.Int32 in EDM which in turn maps to int in the database (I am talking about Sql Server here)).

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

Sidebar

Related Questions

I generated a new form using sean-gen (seam new-form) and added another field to
A PDF generated in iReport using the 'Times New Roman' font appears to be
My project doesn't seem to be aware of this new constant that's apparently auto-generated
I am working on a rails project using svn. I generated a migration file
I am new to jquery. I wanted to generated a set of image button
I am new to jQuery. I have a dynamically generated row with unique ID's.
I have an almost new setup of ROR 3.1 here and have already generated
I have a gridivew with auto-generated fields, whenever there is a new set of
I need to take an image and place it onto a new, generated white
I'm completely new to Rails, but I've done quite a bit of searching and

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.