Enums in .NET 4.5

Nov 15, 2012 at 4:15 PM
Edited Nov 15, 2012 at 4:15 PM

Entity Framework v5 now supports Enums as properties  -  but only if your project is built to .NET 4.5  (for which you need to be using VS2012, apparently). In other words you can now have:

public MyEnum Foo {get; set;}

where previously you had to say:

public int Foo {get; set;}

Which also means that you don't keep having to cast between the Enum type and int in your code.  Naked Objects will recognise the Enum property just the same.