Before reading the following, please read up on the tutorial posts listed here to get up-to speed on how i have accomplished Image handling using MVC so far, as i wont be going into detail on the code i have updated changed, only new code: https://garfbradazweb.wordpress.com/2012/02/26/mvc-3-mvcimage-project-its-alive/ Also, before i continue, you can download and use […]Read more "[MVC 3] MvcImage Project–How did i do Thumbnail Support?"
Now we should be writing strongly typed Views based on our Models. Now in some cases you may want to use the ViewModel pattern, which allows you to create a View based on: a) One Model and some additional properties b) Two or more combined Models c) Two or more combined Models plus some […]Read more "[MVC3] ViewModel Binding To Controller–POST Methods"
Image via Wikipedia I’m at the moment trying to write a light-weight AJAX control for my home page, which displays New Properties which have been added, aptly named WhatsNew. The issue i had was the following error which i inspected in Fiddler when i didn’t have any JSON returned to my view: A circular reference […]Read more "[MVC 3] Entity Framework and Serializing JSON–Circular References"
I find myself when using Entity Framework, before accessing any of Objects i have various try/catch methods, due to the amount of exceptions that “bubble” up. Now before i try and access my ObjectSet’s within my ObjectContext i usually make sure there are objects there to begin with. I usually do something like: […]Read more "[MVC 3] ObjectSet Extension Method–CountAll"
In the last post i described a way of using a static method to obtain which model field is causing your ModelState to be invalid. My good friend Shaw Young said that a Extension Method would be another way of doing this. And thinking of it, it makes more sense and a better and cleaner […]Read more "[MVC 3] ModelState ModelErrorCollection Debug–Extension Method"
UPDATE: Dan Kendall kindly done a gist of the code which can be found here if you need it which is related to this post: https://gist.github.com/3699804 We all use the ModelState.IsValid before we commit any changes to our Entity Framework ObjectContext to update our data source. But what is ModelState.IsValid? Well basically ModelState says… “Yes, all models […]Read more "[MVC 3] ModelState ModelErrorCollection Debug"
Image via Wikipedia The Entity Framework can throw a lot of Exceptions depending on what you are trying to achieve. We are lucky that the default CRUD controller template includes how to use EF during a Create/Delete/Edit scenario, but sometimes (a lot of the time in my case), when you first begin using EF, the […]Read more "[MVC 3] Entity Framework 4–Disposing ObjectContext–TIP"