Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Entity Framework 101
Message
De
04/06/2014 15:38:06
 
 
À
04/06/2014 15:36:41
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Versions des environnements
Environment:
C# 4.0
OS:
Windows 8
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01601183
Message ID:
01601299
Vues:
27
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform