titol
titol

Reputation: 1149

Web form application, Entity framework 6.1, Build Action and web.config

I have few question about entity framework. I am making an aplication in asp.net using Visual Studio 2013. All works fine, now i try to add shop section with DB. I made SQL db in SQL server management and using entity framework put it in to my solution.

Everything goes fine, I have my database, but it makes me few errors and questions:

  1. When i try to open application in browser i've got an error which telling me that there is problem with .edmx files in web.config. I make it work adding:

    <compilation debug="true" targetFramework="4.0">
    
    <assemblies>
    
    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    
    <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    
    </assemblies>
    
    </compilation>
    

    Insted of:

    <compilation debug="true" />
    

    Application starts properly. My question is: Is that have something in common with seccond question, or it just standard option?

  2. I notice, that all files which were added by entity framework has Build Action set to: content

    Is it normal? Or should i change all to compile? For now i was forced to change files with tables name to compile, because when i'm writhing Modules code to operate this DB, (when entity talbes files got Build Action: Content) i can't use those clases. So my question is: Should i change every entity file Build Action to Compile, or i just need those 3 files with Table names to be changed?

Information that may be required:

Software: Visual Studio 2013

Framework: Entity Frmework 6.1

I made App_Code folder for my own and add ADO.NET entity data item there. I made other folder in App_Code for c# classes. If i create class here, it also got Build Action: Content, so i must change it manualy to Compile.

Upvotes: 1

Views: 230

Answers (1)

titol
titol

Reputation: 1149

If anyone will try to find the answer: It is strongly NOT recommended to create app_code folder, and put there entity framework files. In other folders files are allready have compile build action.

I didn't check answer for first question, but probably this will solve both.

Upvotes: 1

Related Questions