Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Entity Framework 101
Message
De
04/06/2014 15:41:06
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
04/06/2014 15:38:06
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:
01601301
Vues:
26
Thanks for the input. I added that specific portion this morning and I've be preoccupied with other things today. I actually just committed a few hours ago without being finished, so the example I just posted was half done.

>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?
Very fitting: http://xkcd.com/386/
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform