Hi Tom, What a great sample! This's exactly what I'm looking for for a long time! Thank you very much! And I do have questions like: 1.What kinds of knowledge or skills should I get to help me fully understand your work? Since I just started to learn EF and MVC/WebApi, something looks really "unfamiliar" to me like ("PluralizingTa
bleNameConventi on",etc),so do you have any suggestion for me? 2.Do you think it's necessary to introduce repository-patt ern into this sample to make it more testable? Because in that case DA components like DbSet/DbContext could be replaced by mock objects easier(I googled a lot of articles, and the conclusion is that using repositories+EF is the most common way if I want to unit test my WebApi/MVC controller.I may be wrong on that). Thanks again!
The browser chooses the input control based on the data type. For the date type we're using Chrome provides a date picker but IE and Firefox don't. See http://html5tut
Hi, Tom ! The link to the tutorial "EF 6 MVC 5 VS 2013 tutorial series" is broken, where can I see the tutorial? (http://www.asp
.net/mvc/tutori als/getting-sta rted-with-ef-us ing-mvc/creatin g-an-entity-fra mework-data-mod el-for-an-asp-n et-mvc-applicat ion). Excelent tutorial, I'm doing it but kept on part 2 Thanks
The URL to that tutorial was changed, but redirects have now been created so the URL you cite now works again.
When I try to run this application in Visual Studio 2013, I get the following parser error. Please help!!! Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load type 'ContosoUnivers
ity.MvcApplicat ion'. Source Error: Line 1: <%@ Application Codebehind="Glo bal.asax.cs" Inherits="Conto soUniversity.Mv cApplication" Language="C#" %> Source File: /global.asax Line: 1
Did all of the NuGet packages get restored successfully, and does the application build without errors? This project shouldn't require Update 3 (the most current update), but when you run into difficulties it's generally a good idea to make sure that your copy of Visual Studio is current.
Tom, I applied the Update 3 to Visual Studio 2013 as you suggested and now the earlier error does not appear but it doesn't show the correct start page with the student listing as shown in the example. Instead it shows a page in the browser that says Welcome to Contoso University and has options to "Build it from scratch" and "Download it". Nothing like the Student listing screen shown in the sample file screenshots. Any idea what's the problem?
You should see tabs (links) to the Student, Instructor, and other pages at the top of that home page. If you have a narrow browser window, you'll have to click the square box of short horizontal lines at top right to open up the tabs menu.
Thanks for your sharing. It's very useful for my site http://lambangd
aihoc.net/lam-b ang-dai-hoc-tai -tphcm/
I found that you are using UnitOfWork only in CourseControlle
r like private UnitOfWork unitOfWork = new UnitOfWork(); And in rest controllers you are directly using DbContext. Why is this? It will be good if could you modify the code with Dependency Injection or IOC container? Thanks
The downloadable project is exactly as it would be created if you worked through the tutorial. The UnitOfWork class is added in one of the later tutorials as an example of how to implement that pattern, and having shown the example there was no need to go back and add it to controllers that had been created earlier. Thanks for the suggestion, we'll consider adding dependency injection in a later edition of the tutorial.
I agree, this is the way to go. Nice sample!
I download your project example. when I click the page, it show can't find dbo.student. I try to look database table but I don't see that student table, just see Course, CourseInstructo
r, Department, Enrollment, OfficeAssignmen t and Person. what happen?
Try changing the database name in Web.config and running update-database again.
Hi Tom how can I manage unique constraint please.
For questions not about the sample/tutorial itself, see StackOverflow or the ASP.NET EF forum (links at the top of the first page in the tutorial series).
hi Tom can i please have the documentation to c how the code flows please please its working perfect
See the Description tab -- there's a link to the tutorial series that shows how to build the application from scratch.
.com report please Tom
Hi Tom: I can't attach file CU10.mdf to database. Do you have any script to do that?
If you mean update-database creates the file but it won't attach, chances are you already used the CU10 name. Go into Web.config and change the name of the database or delete the existing database. For instructions on how to change the name, see the note near the end of the fourth tutorial: http://www.asp.
net/mvc/tutoria ls/getting-star ted-with-ef-5-u sing-mvc-4/crea ting-a-more-com plex-data-model -for-an-asp-net -mvc-applicatio n