EDM in Web Site project vs. Console App

Last post 06-10-2009 3:52 PM by John Hoge. 0 replies.

Sort Posts:

  • EDM in Web Site project vs. Console App

    06-10-2009, 3:52 PM
    • Participant
      1,226 point Participant
    • John Hoge
    • Member since 11-03-2004, 7:27 AM
    • Posts 339

    Hi,

    I'm on my first day with Entity Framework. I managed to get some sample code working in a console app as follows:

            using (var ctx = new ProgrammingEFDB1Entities())
            {
                foreach (Address addr in ctx.Addresses)
                    Console.WriteLine("{0} {1}", addr.Street1, addr.PostalCode);
            }


    I did this by making a model from a database and hitting Next-Next-Finish. It was very easy but worked much like Linq to Sql. I then tried to do this in a Web Site project and had no luck. The DataContext ProgrammingEFDB1Entities wasn't recognized in the Web Site project.

     I don't know if this has something to do with a namespace issue. I have done pretty much the same steps in the Web Site that I did in the Console Application and replaced "Console.WriteLine()" with "Response.Write()". I suspect it might be some wierd namespace issue, but I don't know where to go next.

    Thanks,
    John

Page 1 of 1 (1 items)