locked
EF June 2011 CTP does not create enum columns during code-first database creation RRS feed

  • Question

  • Hi,

    When I am creating a code-first entity, columns based on enums are not showing up during database creation. I suspect the 2011 CTP is not being recognized.

    Here is my setup:

    Target Framework: June 2011 CTP - Console App
    Included References: 
    System.Data 4.0
    System.Data.DataSetExtensions 4.0
    System.Data.Entity 4.2
    System.Data.Linq 4.0
    System.ComponentModel.DataAnnotations 4.0
    System.Web 4.0
    System.Web.Mvc 3.0 
     
    (note: I did not reference EntityFramework.dll because it results in the following error: The type 'System.ComponentModel.DataAnnotations.ForeignKeyAttribute' exists in both 'C:\..\Microsoft ADO.NET Entity Framework 4.1\Binaries\EntityFramework.dll' and 'C:\..\.NETFramework\v4.2\System.Data.Entity.dll' - Is this dll needed?)

    In my App.Config
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.2"/>
      </startup> 	
    
    

    I had to switch it to v4.0 rather than v4.2 due to the error explained in this thread.  


    And my connection string:
        <add name="Db" connectionString="Data Source=MACBOOKPRO\SQLEXPRESS;Initial Catalog=TestFoM;Integrated Security=True" providerName="System.Data.SqlClient"/>
    
    

    If possible, could someone post a sample June 2011 CTP project/database with columns that use enums so I can compare the setup?

    Thank you,
    Jordan



    • Edited by JordanR Sunday, August 14, 2011 5:24 PM
    Saturday, August 13, 2011 7:36 PM

All replies

  • Hi Jordan,

     

    I have the same problem, and I didn't find some solution...

    I think that in next CTP this problem will have a solution...

     

    []s!


    Fernando Henrique Inocêncio Borba Ferreira
    while(alive){ this.WriteCode(); }
    Blog: http://ferhenriquef.wordpress.com/
    Twitter: @ferhenrique
    Sunday, August 14, 2011 1:39 PM
  • Its nice to know I am not crazy :)

     

    Does anyone have a working June 2011 CTP sample project using Enums?

     

    If not, anyone have thoughts on the following line? Will it not work unless its set to version="v4.2"?

     

    <startup>
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.2"/>
     </startup>

    Sunday, August 14, 2011 5:22 PM
  • Does anyone have a working June CTP code-first sample solution with enums that they can post so I can compare?
    Wednesday, August 17, 2011 5:05 PM
  • I have the same problem. I did download of three files and install. It's all ok, but my enum columns don't work, he dont create enum columns in database :(, someone can help us?
    Friday, August 19, 2011 7:34 PM
  • I had the same problem and noticed that I forgot to set the target framework to "Microsoft Entity Framework June 2011 CTP", but Jordan I see in the first line of your listed setup you have the correct target.  Perhaps some of the others might not.


    Monday, September 5, 2011 2:09 AM
  • Paul, is there anyway you can post a code-first sample project with enums including the database schema so I can compare?

    Thanks!

    Saturday, September 10, 2011 8:49 PM
  • Give this a try: http://db.tt/mBE5gAD

    It's a zipped up barebones example that works on my machine.  Other than the .Net Framework 4.0 and all windows updates, I installed the June CTP as per the instructions here:

    http://blogs.msdn.com/b/adonet/archive/2011/06/30/announcing-the-microsoft-entity-framework-june-2011-ctp.aspx

    Sunday, September 11, 2011 11:05 AM
  • Paul, I can't thank you enough!!

    The problem is enums will NOT work if they are declared within a class! All enums must be declared within a namespace only. 

     

    Sunday, September 11, 2011 4:06 PM