In this code from Microsoft's MVC Tutorial NerdDinners:
public class DinnerRepository {
private NerdDinnerDataContext db = new NerdDinnerDataContext();
//
// Query Methods
public IQueryable<Dinner> FindAllDinners() {
return db.Dinners;
}
public IQueryable<Dinner> FindUpcomingDinners() {
return from dinner in db.Dinners
...
In the NerdDinner tutorial, Step 5, mid way down under Complete Edit Action Method Implementations there is a paragraph:
The nice thing about our Edit implementation is that neither our Controller class nor our View template has to know anything about the specific validation or business rules being enforced by our Dinner model. We can...
On the NerdDinner example of Professional ASP.NET MVC 1.0 there's a method to create a new dinner as copied bellow (page 89 of the free NerdDinner version).
There it checks ModelState.IsValid for true. It seems to check if the model is valid for the database (that is, it catches data type conversions, like dates with invalid format, but...
On the NerdDinner example a set of business rules are written to validate the data on a model. Things like empty strings are checked for and by calling modelObject.GetRuleViolations() you can get them all. But there's another layer of validation which is the database. For example, the datetime field is left for validation to the database...
I'm looking learn about ASP.NET MVC and OpenId using the ASP.NET MVC NerdDinner tutorial.
I would like to replace the Authentication system in NerdDinner to be OpenId only. I've downloaded the latest DotNetOpenAuth libraries but I'm not sure how to put it all together. Can anyone help with a quick step-by-step tutorial?
Is this as simp...
Question
How do you handle read-only fields when creating fakes?
Background
I'm in the beginner stages of using ASP.Net MVC and am using Steven Sanderson's Sports Store and Scott Gu's Nerd Dinner as examples. One small problem that I've just hit is how to work with read-only properties when doing fakes. I'm using LINQToSQL.
My interf...
NerdDinner.csproj won't load in vs2008 sp1 with .net 3.5 sp1. Am I not up-to-date on these tools or something? It complains this project type not supported on this installation.
...
In the NerdDinner example they use a repository pattern to decouple the business from the data layer. But then they use the Linq to SQL generated classes (Dinner specifically) as the entity class used throughout the project. So how decoupled is that really? It’s not like you could easily exchange Linq-to-SQL.
On my last project I creat...
Hello,
I am trying to work my way through the NerdDinner tutorial - and as an exercise I'm converting it to VB as I go. I'm not very far in and after having gotten past the C# Yield statement I'm stuck on Shared VB Array Initialisors.
static IDictionary<string, Regex> countryRegex =
new Dictionary<string, Regex>() {
{ "USA", new Regex(...
I'm going through the NerDinner free tutorial
http://nerddinnerbook.s3.amazonaws.com/Intro.htm
I got to somewhere in Step 5 where it says to make the code cleaner we can create an extension method. I look at the completed code and it has this to use the extension method:
catch {
ModelState.AddModelErrors(dinner.Get...
If I hosted NerdDinner and had google ad-sense would I be a commercial user of Bing Maps / Virtual Earth thus have licensing costs?
I've looked and found this question:
http://stackoverflow.com/questions/828853/virtual-earth-or-google-maps
and the TOS: http://www.microsoft.com/maps/product/terms.html but neither answer my question..
I'...
Why my VS 2008 will be closed down when try to open or edit the .ASPX files from Nerddinner Project?
I'm using VS 2008 Professional SP1 version.
...
From what I've read,
yield return <value>
jumps out of the function the moment the line is executed. However, Scott Guthrie's text indicates that
var errors = dinner.GetRuleViolations();
successfully pulls out a list of all the rule violations even though GetRuleViolations is a long list of
if(String.someFunction(text))
yield ...
I just got a new Windows Server 2003 machine and I've been trying to get Nerd Dinner onto it. The server already has .NET 3.5 SP1, ASP .NET MVC, etc.
When I upload Nerd Dinner via FTP to a subdirectory of the main webpage, I get a 404 when I go to any page in the site except for the root and the home page doesn't event show the map.
Fo...
Consider a beginner dealing with Dependency Injection. We're analyzing two relevant classes in NerdDinner.
DinnerRepository from the application:
FakeDinnerRepository from the tests:
They implement different logic, which of course is necessary, as the key idea here is to implement the IDinnerRepository, and provide different impleme...
I've been looking at the Nerd Dinner code and one thing they do in their models, is create an instance of the DataContext like this:
public class DinnerRepository {
private NerdDinnerDataContext db = new NerdDinnerDataContext();
public IQueryable<Dinner> FindUpcomingDinners() {
return from dinner in db.Dinners
...
I noticed that NerdDinner doesn't dispose of the DataContext -- ever. That seems very strange to me. They have a Repository class that creates a private member of the data context, which hangs around for the lifetime of the repository class -- and who knows how long that is, since it's created at the time of the controller's constructi...
I have created a web app in MVC following the NerdDinner tutorial. I have 2 fields that have many to many relationship with my "dinner". For each "dinner", I need to be able to select one or more Companies from a Company table and one or more Services from a Service table. I've been reading blogs and forums for 2 days, but can't seem ...
I'm working through the Nerd Dinner ASP.NET MVC tutorial and am at the part right after I've created the project and am trying to run my unit tests for the first time. I see the test project and the AccountControllerTest.cs and HomeControllerTest.cs files that were generated but when I click on Test -> Run all options are greyed out. W...
I am new to web apps, MVC, and LinqToSql. I created an MVC web app using the NerdDinner tutorial as a guide. I'm now adding many-to-many relationships to it. And am just running into walls at every step. I have a multiselect list in the Edit and Create views. For the Detail and List views I would like to list the selected values.
...