none
Entity Framework works in console app. but not ASP.NET MVC RRS feed

  • Question

  • I've spent 16 straight hours trying to figure this out, so any help would be greatly appreciated...

    I'm doing everything the same for each type of app., and in any console version I can access my ModelEntities (System.Data.Objects.ObjectContext) object's members, but can't in any ASP.NET app, for example:

    OrderEntities o = new OrderEntities();

    at which point 'o' isn't recognized by Intellisense, etc...

    I've checked everything that I can possibly think of, and the next step is to just bag the whole Entity Framework idea altogether.

    Feel free to chime in if this information isn't enough to go on.  The more I search, the less encouraged I become, having found but one trivial example using MVC/EF.

    What is it with the clowns from this site directing anything related to asp.net to their site, and their clowns directing everything having anything to do with EF over here?  Doesn't anyone allow for the possibility that there are problems that occur _only_ when these two are combined?!  ...very helpful indeed.

    Tuesday, December 1, 2009 7:59 AM

Answers

  • Hi,

    Welcome to MSDN Forums!

    langdon is right!  We need more information about the problem.  Do you receive any exceptions?  Please provide us with more detailed information.   Besides, I also recommend you make sure whether the problem is more related to ASP.NET MVC or EF.  For ASP.NET MVC issues, you can get more support at http://forums.asp.net.

     

    Best Regards,
    Lingzhi Sun


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, December 3, 2009 5:22 AM
    Moderator
  • Hello,

    Specifically, this should be asked in the ASP.Net MVC forum on forums.asp.net.

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

    Wednesday, January 15, 2014 4:11 PM
    Moderator

All replies

  • I don't know much about clowns, but if I were a betting man, I'd wager everything on you missing something small.  I've created numerous MVC applications that make use of EF.

    Post a sample project.
    Tuesday, December 1, 2009 10:18 PM
  • Hi,

    Welcome to MSDN Forums!

    langdon is right!  We need more information about the problem.  Do you receive any exceptions?  Please provide us with more detailed information.   Besides, I also recommend you make sure whether the problem is more related to ASP.NET MVC or EF.  For ASP.NET MVC issues, you can get more support at http://forums.asp.net.

     

    Best Regards,
    Lingzhi Sun


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, December 3, 2009 5:22 AM
    Moderator
  • You should really give some more information about what type of exception you are getting, error codes or messages, etc.

    Have you already made sure the Entity Connection String is in the <connectionStrings> section of the web.config file? Like:

    <connectionStrings>
        <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
        <add name="nerddinnerEntities" connectionString="metadata=res://*/Models.Nerddinner.csdl|res://*/Models.Nerddinner.ssdl|res://*/Models.Nerddinner.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\nerddinner.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
      </connectionStrings>
    Also, you will need to add a reference explicitely, as far as i recall.
    Monday, December 7, 2009 1:56 PM
  • Hello,

    Specifically, this should be asked in the ASP.Net MVC forum on forums.asp.net.

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

    Wednesday, January 15, 2014 4:11 PM
    Moderator