5

I'm designing a data base using the Table Designer in VS 2010 pro, then generating code with SqlMetal.

I want to use a enum as a type in one of the columns.

How is it possible?

MikroDel
  • 6,705
  • 7
  • 39
  • 74
elyashiv
  • 3,623
  • 2
  • 29
  • 52

1 Answers1

3

You can use Convert to Enum as described in Enum Support - EF Designer:

  • create new model
  • add new Entity
  • convert it nu Enum

Update

You need to Entity Framework 5.0, .NET 4.5 and Visual Studio 2012

It is not possible under you condition with Visual Studio 2010

MikroDel
  • 6,705
  • 7
  • 39
  • 74
  • If I understood right, this will only work on .NET framework 4.5, and there for worn't work out for me, [because VS2010 doesn't support .NET 4.5](http://social.msdn.microsoft.com/Forums/vstudio/en-US/8ab8782d-36f5-4b7a-a264-c68f2dd564f9/targeting-net-45-with-visual-studio-2010) – elyashiv Sep 30 '13 at 11:16
  • @elyashiv - yor are right - its Feature of EF 5.0 Can you update you project for Visual Studio 2012? – MikroDel Sep 30 '13 at 11:22
  • @elyashiv - and also "Enum support was introduced in Entity Framework 5." You can use Entity Framework 5 with Visual Studio 2010 - so try it please. – MikroDel Sep 30 '13 at 11:24
  • from the link you provided: "Enum support was introduced in Entity Framework 5. To use the new features like enums, spatial data types, and table-valued functions, **you must target .NET Framework 4.5.**" – elyashiv Sep 30 '13 at 11:32
  • @elyashiv - yes I have read it too - thats why my proposal for you is to **try it** – MikroDel Sep 30 '13 at 11:33
  • Doesn't work. not surprising when it is written in the [official site](http://blogs.msdn.com/b/adonet/archive/2012/08/15/ef5-released.aspx) it won't. – elyashiv Sep 30 '13 at 11:48
  • @elyashiv - and upgrade to 2012 is not possible? – MikroDel Sep 30 '13 at 11:52
  • 1
    @elyashiv - I have updated my answer. Negative answer can also be a solution – MikroDel Sep 30 '13 at 11:54