[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Why does Entity Framework 4.0 require a recompile?

Posted on 2011-02-22
8
Medium Priority
?
555 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
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

649 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