c# - How can i save an enum in my context in EF code first version 6 -


hi need save single enum in context, tryed this:

  public class context : dbcontext   {       public context() : base("name=context"){}        myenum myenum  { get; set; }       public dbset<object1> objects{ get; set; }  } 

, when modify myenum changes value after saving changes when want use goes enum of value 0. heres modification code:

 myenum example = myenum.value1;  using (var ctx = new context())         {             ctx.criterioplanificacion = example;             ctx.savechanges();         } 

enum default type int. normal value 0 because first element. if want put description elements can use description attribute , retrieve shown here.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -