?
Solved

Why does Entity Framework 4.0 require a recompile?

Posted on 2011-02-22
8
Medium Priority
?
552 Views
Last Modified: 2012-05-11
I have a table in the database of column names and an int column in that table to hide or show the associated column. I use EF4 to use that table and a Lambda expression which successfully shows or hides the given table, which is shown my Dynamic Data web application.  But I see a strange phenomenon I need to work around.

I display the Dynamic Data web page grid which SHOWS the column, and that coincides with the fact that the show_state column has a value of 1.  When I change the value to 0 (zero) a page refresh does not hide the column and neither does a program restart.  I must recompile the program in Visual Studio and restart the program so that the column is then hidden, which is the correct behavior.

Why must I do this? I want a simple change of the value from 1 to 0 to hide the column on a page refresh.

Thanks,
newbieweb




0
Comment
Question by:newbieweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 

Author Comment

by:newbieweb
ID: 34952609
It seems as though on recompile, Entity Framework takes a snapshot of the database, which does not change until the program is again recompiled.

Am I right about this?

If so, how can I stop this behavior?

newbieweb
0
 
LVL 25

Assisted Solution

by:apeter
apeter earned 2000 total points
ID: 34961967
how ur saving it back/ and how ur they binding back?..please paste your code.
0
 

Author Comment

by:newbieweb
ID: 34962799
I am not changing the code via the Entity Framework. In another program, I am , and have no problems with data persistence. In this Dynamic Data website, certain table columns are hidden by way of changing an integer from 0 to 1. Then when I refresh the page, the column should become hidden, but it does not. I restart the program, and it's still not hidden. Last I recompile and then it is properly hidden from view.

So to answer your question, the database change is made using MS SQL Management Studio.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 25

Assisted Solution

by:apeter
apeter earned 2000 total points
ID: 34972301
You have a view to bind?what is your datasource?
0
 

Author Comment

by:newbieweb
ID: 34979277
I use MVC3 and my datasource is a DataStore object that wraps my Entity Framework 4.0 object.

I verify that when I stop then re-run my application, Session_Start is called again, which means the Session[] is getting the new instance. So clearly, that EF4 object exists and contains old data.

Is it on disk somewhere? Is there a property of EF4 to force a database hit?

Confused...

newbieweb
void Session_Start()
{
   HttpContext.Current.Session[Global.AdminDataStoreStr] = new AdminDataStore(UserLogin, Password);
}

Open in new window

0
 
LVL 25

Accepted Solution

by:
apeter earned 2000 total points
ID: 34991391
can we see the AdminDataStore class's constructor which accepts UserLogin, Password as password?.  

Not very sure of MVC pattern...looks the source is not repopuplated. some how your build steps constructing the source. You have anything in post buid scripts in ur main project or  in entity project?
0
 

Author Comment

by:newbieweb
ID: 35007280
There's no magic here:

        public AdminDataStore(string userLogin, string password)
        {
            this.userLogin = userLogin;
            this.password = password;
            rddbEntities = new DEVEntities1();
        }

the object DEVEntities1 is the Entity Framework 4.0 object defined by the edmx file.
0
 

Author Closing Comment

by:newbieweb
ID: 35019219
Thanks.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question