Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Entity Framework 101
Message
From
04/06/2014 15:38:06
 
 
To
04/06/2014 15:36:41
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
ASP.NET
Category:
Entity Framework
Environment versions
Environment:
C# 4.0
OS:
Windows 8
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01601183
Message ID:
01601299
Views:
28
No problem. There could be a legitimate reason why it's coded the way it is. I often learn a lot when I ask these types of questions.

>The refresh routine isn't the point of the application, so it was done quick and dirty. I had a comment explaining such further into the loader. I'll pull it up a bit.
>
>>
>>public ActionResult Refresh()
>>        {
>>            var movies = MovieLoader.LoadMovies();
>>
>>
>>            _dataContext.ProductionCompanyMovies.Delete();
>>            _dataContext.MovieGenres.Delete();
>>            _dataContext.Characters.Delete();
>>            _dataContext.Actors.Delete();
>>            _dataContext.Movies.Delete();
>>            _dataContext.Genres.Delete();
>>            _dataContext.ProductionCompanies.Delete();
>>            _dataContext.MovieStatuses.Delete();
>>            _dataContext.SaveChanges();
>>            movies.ForEach(movie => _dataContext.Movies.Add(movie));
>>            if (_dataContext.MovieStatuses.All(status => status.Status != "Cancelled"))
>>            {
>>                _dataContext.MovieStatuses.Add(new MovieStatus("Cancelled"));
>>            }
>>            if (_dataContext.MovieStatuses.All(status => status.Status != "Planned"))
>>            {
>>                _dataContext.MovieStatuses.Add(new MovieStatus("Planned"));
>>            }
>>            if (_dataContext.MovieStatuses.All(status => status.Status != "In Production"))
>>            {
>>                _dataContext.MovieStatuses.Add(new MovieStatus("In Production"));
>>            }
>>            _dataContext.SaveChanges();
>>
>>
>>            return new HttpStatusCodeResult(HttpStatusCode.OK);
>>        }
>>
>>
>>The strings in
>>
>>new MoveStatus("magic string")
>>
>>status.Status != "In Production"
>>
>>
>>
>>>Where exactly is this magic string you speak of?
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform