ASP.NET MVC Data Access in C# - The complete data path from database to display and back

  Рет қаралды 340,927

IAmTimCorey

IAmTimCorey

Күн бұрын

Пікірлер: 1 300
@formerfatboy90
@formerfatboy90 2 жыл бұрын
I'm a junior developer at a large company. I've been trying to build on this very complex QA application for weeks and feel like a fool for not seeing how the pieces are fitting together, connecting DB to backend to frontend, etc. Your deliberate, explicit instructions are helping me to document the MVC process in my own code and on Miro. This video is really helping me for my career. Thanks, Tim.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thank you!
@vinuhosanagar1
@vinuhosanagar1 6 жыл бұрын
While it is very evident that your quality of teaching is fabulous, your commitment and consistency in educating community of developers is amazing I know it requires a lot of efforts to produce such long videos with best quality that too consistently. We all appreciate your contribution sir. Hope you be known to whole dot net community. God bless :)
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
I appreciate the kind words.
@jackfitzgerald5735
@jackfitzgerald5735 4 жыл бұрын
0:00 Intro 1:14 Project setup 4:25 Implementing employee sign-up form 12:00 Adding requirements to employee form 23:10 Making a quick form with html.EditorForModel() 25:28 Understanding how the employee form works in SignUp.cshtml 27:54 Handling the employee form in HomeController.cs 32:45 Creating the Employee table 40:00 Creating the EmployeeModel class in DataLibrary 44:00 Using Dapper to interact with the database 52:09 Implementing the EmployeeProcessor class to handle the business logic 59:39 Using the EmployeeProcessor class to store employee data 1:04:22 Displaying employee data by using the EmployeeProcessor class 1:12:44 Ending review
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
That is a great start. I know doing this time stamping is very time consuming but its a HUGE help to many students. If you get thru the rest of the video and capture the main topic timestamps, I will gladly add it to the video. Thank you for making a significant contribution to the community.
@jackfitzgerald5735
@jackfitzgerald5735 4 жыл бұрын
@@IAmTimCorey Thank you Tim, you have given me the motivation to finish this. And thank you for making great content, I just started learning C# and MVC and your videos have helped me out a lot with understanding how this all works.
@Arrato1977
@Arrato1977 2 жыл бұрын
I watch your tutorials few days in a row now. Speechless, you are the best teacher I ever seen.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thank you!
@chrismtz2020
@chrismtz2020 4 жыл бұрын
For those of you who are having issues with your database, here's some advice (after 1 week of listening to this video over and over again): -> When you update your DB, make sure to publish it again -> Put your Database and DataLibrary in the same folder as the MVC project to make things easier. -> ConnectionString should be the exact DB that you're using. Make sure you copy and paste it right too. -> Make sure when you call your DB, to tripple check the spelling (ex. dbo.Users not dbo.User) -> Also, you might get errors using a Database named called "dbo.User". If so, either rename it or use "dbo.[User]" to fix your problem. Good luck everyone! Google your mistakes and dont be afraidto try again and again on your project.
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Thanks for sharing. Great job sticking with it.
@FlickyBeanss
@FlickyBeanss 2 жыл бұрын
I can’t begin to tell you how helpful your videos are, in just over an hour you’ve helped me understand what it’s taken me all week at work to wrap my head around. I have so much of your content bookmarked. Thank you so much Tim
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
I am glad it was so helpful.
@aymanmetwally5560
@aymanmetwally5560 3 жыл бұрын
Thanks .. is there a .Net Core version?
@raduionita4496
@raduionita4496 5 жыл бұрын
I can't thank you enough Tim. I have been struggling for over 2 weeks to find how to do this, and you saved me! Thank you very much. Love you! Subscribed.
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
Awesome!
@gff2112
@gff2112 4 жыл бұрын
You're an awesome instructor Tim.
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Thank you!
@fatimaajij428
@fatimaajij428 5 жыл бұрын
Every time when I watch your Tutorials, I find the actual logic how people work in software Companies. Thanks for Amazing videos.
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
You are most welcome. Thanks for watching.
@greendeer2437
@greendeer2437 3 жыл бұрын
public static int SaveData(string sql, T data) { using (IDbConnection cnn = new SqlConnection(GetConnectionString())) { return cnn.Execute(sql, data); } } Hi, Thanks for the tutorial. I have tried to run the solution like at 1:02:38 but it gives me error on line "return cnn.Execute(sql, data); " saying that there is an Incorrect syntax near 'value'. The break point does not get hit. How can I resolve this?
@neutronstar6739
@neutronstar6739 2 жыл бұрын
For future people, sounds like you miss `s` on the `values` there. Syntax for SQL Insert would be INSERT INTO your_table(column_name) VALUES (column_name_value) So with this in mind, in this case it would be INSERT INTO dbo.Employee(EmployeeId, FirstName, LastName, EmailAddress) VALUES (@EmployeeId, @FirstName, @LastName, @EmailAddress) It's recommended to look into SQL syntax and educate yourself on SQL injection to understand these.
@omniterry
@omniterry 5 жыл бұрын
Getting addicted to watching your videos. Love your voice and how you pay attention to all the little details. Thank you
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
You are most welcome. Thanks for watching.
@rokkrdude
@rokkrdude 4 жыл бұрын
I am having an issue with the LoadEmployees method in the employeeprocessor. my error is inconsistent accessibility and it claims that the return type is less accessible than the method. can you help me?
@James-zr1lu
@James-zr1lu 4 жыл бұрын
@Garrett Sullivan From memory, I had the same problem. It was because the EmployeeModel class in the Models folder in the DataLibrary folder was not set to public.
@orientgamessa1340
@orientgamessa1340 4 жыл бұрын
@Garret Sullivan Thanks so much for asking this question! I was experiencing this too! @@James-zr1lu Thanks so much for the answer! helped tremendously!
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Its great with the community helps each other out. The IAmTimCorey community members are some of the best!
@haramboy6932
@haramboy6932 4 жыл бұрын
@@James-zr1lu U Mad LAd
@mierLG
@mierLG 4 жыл бұрын
thanks @@James-zr1lu , save me a lot of time
@DiddleDangle
@DiddleDangle 5 жыл бұрын
I know this doesn't have to do with the content of the video, but I love how you handle the audio in your videos. I feel like I get to the end of your videos and it feels like only 10 minutes have passed while other lecturers drone on for hours and it really feels that way because you can hear a constant buzzing in the background or every spit wad in their mouth. Thank you for creating such cleanly edited and planned out videos. Looking forward to your content always.
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
I am glad you appreciate the audio quality. I do put a lot of effort into it (even though audio editing is not a skill of mine).
@James-zr1lu
@James-zr1lu 4 жыл бұрын
I'm getting the error "System.NullReferenceException: 'Object reference not set to an instance of an object.'" @ 11:48. I have copied everything exactly as in the video. I have also run the source code and still get the same problem. My only difference is that I'm using the latest Visual Studio 16.7, .NET Framework 4.7.2. May the problem may lie there? There are others in the comment section that are having the same problem with no solution. Thank you
@James-zr1lu
@James-zr1lu 4 жыл бұрын
Well, if I change return view() to return View(new Models.EmployeeModel()); for ActionResult SignUp() in the HomeController, then that works.
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
I think maybe you created a different form, maybe an Edit form instead of a create. I just recreated this in a new project in Visual Studio 2019 (16.7.2) with .NET Framework 4.7.2 and it worked as I demonstrated in the video.
@James-zr1lu
@James-zr1lu 4 жыл бұрын
@@IAmTimCorey That can't be it because I also tried using the source code that you provided via the download link in the description. We are using the exact same code yet producing different outcomes. At least I have a work around as I provided above.
@christianconder35
@christianconder35 4 жыл бұрын
Hi James. I also have been struggling with the exact same issue as you. I have managed to find a solution. I had placed the connection string into the wrong Web.config file. @ 39:14 Check that you have the connection string in the correct Web.config.
@christianconder35
@christianconder35 4 жыл бұрын
@@IAmTimCorey Mr Corey, I really enjoyed the tutorial but I did not initially see that there were two Web.config files and I placed the connection string in the Web.config inside the views folder. Just some feedback
@OmniTato
@OmniTato 4 жыл бұрын
For those struggling with an error saying "System.NullReferenceException: Object reference not set to an instance of an object", check that your connection string is in the CORRECT web.config file. It SHOULD be in the Web.config below packages.config and Global.asax in your MVCApp project, NOT the one under views, shared, Web.config. This solved my problem =) Hope this helps those who are struggling, because I sure as hell nearly pulled my hair out hahaha
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 4 жыл бұрын
Thank you for sharing this. I'm sure it will help others.
@lucasisaac8063
@lucasisaac8063 4 жыл бұрын
Mine was already in the correct web.config folder, but thank you for the advice. Tim said in another comment, that a class or a variable needs to be instantiated. I copied his code line for line (Or so I thought) and I still can't find it... Again, thank you for the advice
@christiandiomangay5107
@christiandiomangay5107 3 жыл бұрын
Inconsistent Accessibility:return type 'List' it seems there is an error in the class privacy in the buisness logic please help tim ..
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
It sounds like EmployeeModel is not marked as public.
@christiandiomangay5107
@christiandiomangay5107 3 жыл бұрын
@@IAmTimCorey Wow great! Thanks for the fast response sir Tim (bow)
@immortal7167
@immortal7167 3 жыл бұрын
how did you fix this issue ? I have already added the keyword public
@madhavmehendale7324
@madhavmehendale7324 4 жыл бұрын
Strange as it may sound - this video is symphony. I followed each line of code by coding it in parallel in VS2019 - taking time to savour the notes of logic, the melody of the architecture and the rhythm of the underlying logic as the whole application came together like a musical crescendo. Life is good.........!
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
I am glad you found it so pleasing.
@robmooreproductions7160
@robmooreproductions7160 5 жыл бұрын
Is anyone else having trouble with the ConfigurationManager thing at around 46:45?
@traktor207
@traktor207 5 жыл бұрын
You can right click on references in the solution explorer and add System.Configuration manually.
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
Yep, TraktorFerguson is correct.
@mohammedal-haifi6037
@mohammedal-haifi6037 5 жыл бұрын
@@traktor207 Thanks. worked for me
@alialsaady5
@alialsaady5 5 жыл бұрын
To be more specific you must do the following: Right-click on References and click on Add Reference. In Assemblies, select System.Configuration and click OK.
@glebfrolov3557
@glebfrolov3557 4 жыл бұрын
for me for some reason worked also adding into references System.Configuration.Install
@tccoder3547
@tccoder3547 2 жыл бұрын
This video was great for me, because I had a hard time understanding how MVC design worked. You also helped me understand validation and model binding as it relates to Model state. You rock Tim Corey!
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
I am glad it was so helpful.
@victorkimura1
@victorkimura1 3 жыл бұрын
Hi Tim, I receive an error at around 59:15 when entering "LoadEmployees" ( kzbin.info/www/bejne/mHrMdqmVlLaBrtk ). Visual Studio states Code CS0050. Inconsistent accessibility: return type 'List' is less accessible than method 'EmployeeProcessor.LoadEmployees()'. I'm a beginner in C# coming from a PHP background. I understand the main concepts thanks your gifting in teaching. :) But is anyone having this problem? If so, how do I resolve it as I can't load the page. I followed along every step of the way. Thank you for your help.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
That message means that you missed adding "public" to one of your properties or classes. My guess is that the List is not set to public. If not that then the EmployeeModel is not set to public.
@victorkimura1
@victorkimura1 3 жыл бұрын
@@IAmTimCorey , Hi Tim, Thank you for the reply. I'm very grateful and appreciative that you took the time to respond. I'll check when I'm back at work Monday. I think I checked the public settings but I'll check again and perhaps I'll go through the tutorial on my home computer too. I really like your teaching as you encourage others to write the code step-by-step and this is one of the best ways to learn. I pray the blessings from Numbers 6:24-26 upon you and your family: “‘“The Lord bless you and keep you; 25 the Lord make his face shine on you and be gracious to you; 26 the Lord turn his face toward you and give you peace.”’
@webluke
@webluke 3 жыл бұрын
@@IAmTimCorey Ran into this too. I missed setting the DataLibrary.Model.EmployeeModel class to public. The error VS gives, and the help in the docs is not very useful.
@mamahumen
@mamahumen 2 жыл бұрын
Is there any answer to this?
@UltimatePiccolo
@UltimatePiccolo 2 жыл бұрын
@@mamahumen I had the same problem, I fixed it by going into the "EmployeeModel" class in the "Models" folder, and making the class public. My line 9 now says "public class EmployeeModel" and I no longer have the error.
@cagataysert1995
@cagataysert1995 6 жыл бұрын
I just want to say how thankful I am for all your videos. I hope you can add more videos related .net. Thank you again Sir.
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
You are most welcome. Thanks for watching.
@dariogiordani2002
@dariogiordani2002 2 жыл бұрын
Hi Tim thank you for your tutorials, fantastic work. I've ran into an exception on final test run at the SqlDataAccess. return ConfigurationManager.ConnectionStrings[connectionName].ConnectionString;... System.NullReferenceException: 'Object reference not set to an instance of an object.' - Hard to diagnose from three lines but do you have any thoughts? Thanks
@Vyrkadian
@Vyrkadian 2 жыл бұрын
I'm getting the same error, did you fix it?
@species-xo4tz
@species-xo4tz 3 жыл бұрын
More then 2 year ago i had to stop developing and begin learning and maintaining solutions build in ssis, stored procedures using functions, triggers the whole lot.. . Recently I’m starting to develop again. Your videos has help me a lot getting back into development, thank you. You’r for sure one of the better trainers i have found, keep up the good work.
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 3 жыл бұрын
Welcome back and thanks for looking to Tim for assistance.
@VictorGarcia-si8wy
@VictorGarcia-si8wy 3 жыл бұрын
I commend you for not even attempting to try to store passwords. I've stored passwords before and I never want to do it again.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Agreed.
@chiefxtrc
@chiefxtrc 5 жыл бұрын
these kind of overview videos are very necessary and underrated, I hope you keep implementing them
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
Thank you!
@AamerKhawaja
@AamerKhawaja 4 жыл бұрын
Hello Tim, this was the best MVC tutorial on youtube hands-down. This comes from someone who's been through tutorial-hell. Excellent job!
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
I am glad it was so helpful.
@kennington4375
@kennington4375 4 жыл бұрын
Would love to see more ASP.NET. Your doing such a great job. It's much clearer and better than courses in University.
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
More to come!
@kennington4375
@kennington4375 4 жыл бұрын
@@IAmTimCorey Sending emails and using Webforms would be great :)
@mokatemoreki8620
@mokatemoreki8620 4 жыл бұрын
Indeed this is much better than in University, worst in university such topics of MVC are not covered we only do C# and Desktop Apps if we are lucky
@kevinbrosnahan2416
@kevinbrosnahan2416 4 жыл бұрын
Awesome video! I learned so much more today even having programmed in ASP/VB.NET Web Forms for over 10 years. Your MVC video was incredible as well. Soon I will be adding MVC5 to my resume!
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Excellent!
@bandermaster81
@bandermaster81 5 жыл бұрын
I enjoyed the tutorial and learned a lot! I like your style of teaching, you explain everything. While others just assume we know things.
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
I'm glad you enjoyed it and that you found it valuable.
@albasula216
@albasula216 4 жыл бұрын
I loved the vid ... i bought a udemy course for this and it was terrible... the teacher was saying this is beyond the scope of this course but u can find it in my other udemy course...and that happended multiple times...it was really hard to understand what he was doing...and not even close to this way of coding...thank u so much for your great work ....I actually have a task to complete in order to get a job as .Net dev and this helped a lot...thank u so much...I will consider buying one of ur courses but when I get the job...bc a bit expensive ...but it is worth it bc of the great material and great way of teaching...again thank u and u won a new subs and supporter 😊
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
I'm glad this video was so helpful.
@bigtimecoder2588
@bigtimecoder2588 4 жыл бұрын
AWESOME FRIGGIN TUTORIALS DUDE . . . YOU EXPLAIN IT SO CLEARLY AND WITH EASY EXAMPLES INSTEAD OF GOING OVER OUR HEADS . . . AND DON'T WASTE ANY TIME BEFORE JUMPING INTO THE CODE. LOVE IT MAN, I WANT TO SIGN UP FOR YOUR COURSES AND MENTORSHIPS STUFF REALLY BAD BUT IM KIND OF POOR RIGHT NOW.
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
I am glad you have found my content so helpful. The good news is that you can learn a ton for free.
@mmuneebajaz
@mmuneebajaz 6 жыл бұрын
Big thumbs , one of best channel on youtube i ever found for .Net
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Thank you!
@RalfsBalodis
@RalfsBalodis 4 жыл бұрын
Minor adjustments to existing time codes. Credit to Jack Fitzgerald 0:00 - Intro 1:13 - Creating ASP .NET Framework app 4:35 - Adding MVC data Model 6:20 - Sign-up form: new MVC Controller action and View with "create" template 12:56 - Signup-form configuration and validation: data Model annotations 23:41 - Crude sign-up form: Html.EditorForModel() 25:27 - Sign-up from code walkthrough 27:53 - Posted data validation: Controller POST action 32:43 - Posted data storage: Database table design 38:15 - Posted data storage: Database connection string 40:00 - Data Model for database 43:39 - Data access with Dapper 52:09 - Data access Business Logic 59:40 - Storing posted data in Database 1:04:39 - Accessing and displaying data from database. 1:12:44 - Summary and concluding remarks
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Thanks for the update!
@User_00128
@User_00128 4 жыл бұрын
@@IAmTimCorey am trying to move from using webforms to MVC and am wondering is it dangerous to put our query in the controller or its ok you just put them in the logic to make it more universal ? by the way you explain everything better than my university's web dev instructor i have been watching this on repeat for like ten times lol greatly appreciated
@pierreplourde
@pierreplourde 3 жыл бұрын
Very helpful to see the full stack like this, as to how all the pieces fit together.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Glad it was helpful!
@tomsupis8724
@tomsupis8724 4 жыл бұрын
Thanks, Tim, was a great video, def better than my last coach. Had multiple errors, but I handled them like a champ, and the comment section helped a lot. Looks like its better if I learn some SQL before I continue with ASP.net
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
I'm glad it was helpful.
@SweetNectorOfTheGod
@SweetNectorOfTheGod 3 жыл бұрын
Nailed it Tim. Nice one. Just what I needed, someone who went through data connection without all the automation. You get from me an A++
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Thanks!
@SweetNectorOfTheGod
@SweetNectorOfTheGod 3 жыл бұрын
@@IAmTimCorey Hey just trying to extend on the content, do I need to create individual save load classes in dataaccess proj. I feel like my program is loading fom multiple forms automatically and getting stuck at dbaccess
@ernandojeanny1393
@ernandojeanny1393 4 жыл бұрын
Very good guy your explanation of the subject! I was looking for several days without finding an article that showed and commented as well as his video. Congratulations! It helped me a lot to clarify doubts. Muito boa sua explicação do assunto cara! Passei vários dias procurando sem encontrar um artigo que mostrasse e comentasse tão bem quanto seu vídeo. Parabéns! Me ajudou muito a esclarecer dúvidas.
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
I am glad it was so helpful.
@ejkenny
@ejkenny 6 жыл бұрын
Another amazing ah ha tutorial. You have a great way of putting concepts into English and demonstrating with simple code. Thank you !
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Excellent! I am glad it helped you out.
@abdulmudhir4042
@abdulmudhir4042 4 жыл бұрын
Why Are you such an amazing dude? I am always super excited to watch your videos even before going to bed
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Glad you like them!
@iantrembirth6918
@iantrembirth6918 5 жыл бұрын
Tim, I'm starting to make the move from web forms to MVC for a pretty big project and have read a couple of books and seen a few video tutorials (including one on Channel 9), this is the clearest explanation yet of how MVC works and how to actually get it to do something. Thank you!
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
I appreciate the kind words. I'm glad you found it clear and helpful.
@johnreyp.canillo6569
@johnreyp.canillo6569 4 жыл бұрын
Ive watch from the start until the End! Your such a good instructor❤️😍😍
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Thank you so much!!
@jinsmp
@jinsmp 4 жыл бұрын
I much appreciate you this type of tutorial. Every person can understand and can fast learning. This is a really good tutorial.
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Glad it was helpful!
@philippeanglard7394
@philippeanglard7394 3 жыл бұрын
Thank you for your tuto! English/American isn't my native langage, but I hink I was understanding you at 95%.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Awesome!
@krogilds
@krogilds 5 жыл бұрын
Really useful Tim, thank you. I understand it now (I think). I had an issue, but found it. This is absolutely wonderful. You are doing really great work, and I am supporting you through your Patron page.
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
I appreciate the kind words and the support.
@MaddCoder
@MaddCoder 6 жыл бұрын
Great video Tim. Exactly what I was looking for and straight to the point.
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Thank you!
@alevsoft
@alevsoft 4 жыл бұрын
A deep and warm "Thank you!" from the bottom of my heart! You are my man XD. No, really. Only your lessons made my way through.
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
You are most welcome. I'm glad they were so helpful.
@hamudaanfoune839
@hamudaanfoune839 5 жыл бұрын
This was awesome. I am new to MVC and been struggling to wrap my head around it, but this has mad it very clear.. Thank you!
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
Awesome!
@vbgSnake
@vbgSnake 4 жыл бұрын
Love your classes Tim, really good, great depth and not to focused on stuff. Its also easy to have you on monitor2 while i do your class on monitor1 in my studio. Super thanks. BR
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Glad you like them!
@yogevgershon3424
@yogevgershon3424 4 жыл бұрын
37:14 Dear Tim, I love your videos! it helped me a lot to improve myself (4 year programmer), you said as a rule dont use password as plain text into you db, which I fully aggree, but you just explaind why not to do it, and not how to do it correctly (with somekind of guid or hashing) Would really love of you to make a video of authantication on MVC.
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Use a system like Microsoft Identity (I use it in the TimCo Retail Manager series and a couple other videos). The big thing is to not design your own system.
@rajnhard
@rajnhard 5 жыл бұрын
Good video Tim, thanks. It`s also worth mentioning, that the Id of the Employee table (PK), supposed to be set IsIdentity to yes and also enable identity increment ( mine was defaultly set to false ).
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
I didn't point it out (and I should have) but at 33:58, I add "IDENTITY" at the end of the ID column. That sets it up to be an identity column with an auto-increment value of (1,1).
@hawnyawk1
@hawnyawk1 6 жыл бұрын
Thanks for the video Tim, I recently got a VB6 to Web project dumped on me, being mostly a desktop programmer I was lost on what to do. This video made it clear that MVC was the way to go. Thanks so much.
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
You are most welcome. Thanks for watching.
@davidramirez3322
@davidramirez3322 5 жыл бұрын
I could manage to confirm what yuo teach us. Really great tuto! everything worked fine for me, and I could learn a lot watching your excelent way to drive all the stuffs and concepts in a very concrect mode. Thnks a lot.
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
You are most welcome. Thanks for watching.
@simonjsaunders
@simonjsaunders 6 жыл бұрын
Thank you so much Tim. I'm really looking forward to the Core video that might be in the works. This has been an incredibly timely and helpful video
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Thank you!
@rudreshangadi4496
@rudreshangadi4496 5 жыл бұрын
One more fruitful productive morning .. Excellent dear Mr. Tim.. Very clear, neat and upto the mark.. I am getting confidence to work on my entity framework web application that is going to start right from tomorrow :-)
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
I am glad it was so helpful.
@TAPE5IVE
@TAPE5IVE 4 жыл бұрын
Great tutorial. Very helpful for my .NET module as part of BSc Computer Science Honours degree. Thank you 🤙🏼
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
I am glad it has been so helpful.
@BYFav
@BYFav 3 жыл бұрын
Thank you Tim for this great tutorial! I really appreciate the also delivered valuable hints to methodology. This makes your videos first class.
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 3 жыл бұрын
Tim's goal is to educate, not just dump information on folks. I'm glad you can appreciate that.
@antonlyamin3318
@antonlyamin3318 5 жыл бұрын
Tim your channel is an absolute goldmine of programming knowledge. It amazes me how well you relate all your coding to the higher level programming concepts you aim to explain. I have used your MVC videos to introduce myself to the field of web development. Because of you I am confident in creating a simple website using MVC and am now looking to expand my horizons. However I have encountered an problem. There seems to be so many directions to go from here, and I'm struggling to figure out which are most relevant and useful to me. My question to you is, for someone interesting in web development, who has a solid understanding of OO principles, SQL and front end design langauges (css, javascript, html) yet has only started to combine them using platforms like MVC, what are the next steps to take?
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
I would look at .NET Core, and specifically Razor Pages (here is a video: kzbin.info/www/bejne/bGnXoKqnjsiEors ). Then, start practicing. Build test projects and learn how the pieces fit together.
@michaelwong6004
@michaelwong6004 3 жыл бұрын
34:00 Adding the IDENTITY specifier when creating table is important, because it tells SQL server to assign auto increment id whenever new entry is added to the Employee Table. I missed that part and spent some time to figured that out.
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 3 жыл бұрын
Thanks for highlighting it for others, I'm sure it will benefit them
@meeradhumne4685
@meeradhumne4685 3 жыл бұрын
Nicely demonstrated. Love the way you put it together. Thanks so much for the tutorial!!
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Glad it was helpful!
@Motuochez
@Motuochez 5 жыл бұрын
Great video! I did miss a lot of logic of the methods and the classes and didn't really understand what does what exactly but just like you intended, this video is great for understanding the whole process and the bigger picture!
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
Thanks!
@rasa7945
@rasa7945 5 жыл бұрын
Hello Tim, @ 1:10:02, I'm having a different error than yours. 'Object reference not set to an instance of an object.' It's pointing to the ViewEmployees.cshtml at the foreach (var item in Model). Any suggestions, Thanks
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
It sounds like you didn't instantiate your Model.
@rasa7945
@rasa7945 5 жыл бұрын
Thank you for your reply. The mistake was, I didn't pass employees in the return View.
@benja-min1588
@benja-min1588 4 жыл бұрын
Found this video immensely useful in 2020. Great Job, take my sub and gratitude!
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Glad it helped!
@chengfeng6375
@chengfeng6375 6 жыл бұрын
It's the best one I have never seen, thanks Tim.
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
You are most welcome. Thanks for watching.
@khanhzodoi
@khanhzodoi 4 жыл бұрын
So many things to learn in just a video. Thank you very much!!!
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
You are welcome.
@lyubomyr6457
@lyubomyr6457 3 жыл бұрын
I know that my questions might be a bit late, but I would really appreciate if you could explain me something. Isn't it more convenient just to use Entity Framework for the Data Access instead of typing the Data Library by your own? What's the difference between these 2 approaches? And where exactly was Dapper used? It seems like you have mapped the data between 2 models manually, isn't it?
@mariustaboo
@mariustaboo 6 жыл бұрын
Nice one! Another great mini tutorial from Tim Corey.
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Thank you!
@RudiHansen
@RudiHansen 6 жыл бұрын
Great video as always thanks. But a little late :-) I just finished my first MVC app for a client today using your old video (Introduction to ASP.NET MVC) and some Google Foo, i think this video would have saved me about one day of work :-) Now instead I have some refactoring to do....
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Bummer. Sorry it didn't come out a bit quicker. Maybe next time.
@SirHonore
@SirHonore 6 жыл бұрын
Hi Tim, thank you for another great video.
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
You are most welcome. Thanks for watching.
@nuthouse99
@nuthouse99 5 жыл бұрын
Outstanding video - easy to understand gives a usable example from which to build.
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
Thank you!
@chrisgond
@chrisgond 5 жыл бұрын
Hello. Excellent tutorial! One question though. Though you add Dapper at 44:38 and reference it in the SqlDataAccess class, you don't seem to make use of it instead preferring to manually map the data objects. Am I correct in this?
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
We use Dapper for the data access portion of this video. In the video at 49:42, I have cnn.Query That code is a Dapper call. It calls the query/stored procedure and maps the data back to type T automatically. That's what Dapper does for us. There is no manual mapping involved.
@chrisgond
@chrisgond 5 жыл бұрын
@@IAmTimCorey Thanks for the reply. That's a really useful feature!
@kingkongtv380
@kingkongtv380 6 жыл бұрын
I am successful with this video. This is my first time doing web development. 😁
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Excellent!
@MegaJagveer
@MegaJagveer 4 жыл бұрын
I'm new to the C#/.NET ecosystem (coming in from Node.js development). A possible video recommendation would be an Intro to C# Web Development for Node/JavaScript Developers, including comparing and contrasting the benefits of each. I think Node has a lot of hype behind it and is the cool thing nowadays, and a lot of developers have gone through college never even knowing about C#/.NET and only hearing about it in jokes about how it's old and outdated. But having worked with both ecosystems now, I'm starting to see serious benefits and advantages in the C#/.NET ecosystem that alot of the Node devs would appreciate, but they've just never bothered to learn about/ never been taught because everyone just follows whatever the hype is. Especially now with .NET Core, the ecosystem is moving in a very good direction.
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Thanks, added to the list.
@MegaJagveer
@MegaJagveer 4 жыл бұрын
@@IAmTimCorey Awesome:)Thanks for all the incredible content!!
@kyleschmitz9677
@kyleschmitz9677 3 жыл бұрын
Thank you for holding to the "no plain text passwords in database" rule!
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
You are welcome.
@davemcpherson3346
@davemcpherson3346 5 жыл бұрын
Tim, I followed several of your videos as I started learning ASP.NET with MVC. They've been a great help to me in forming the basis of a project idea I'm working on. I've learnt a lot from the videos and been able to expand my knowledge from your tutorials: they've been a great help. Thank You. I've recently started deploying the app to IIS for testing, using SQL Express as the database. There were a few teething problems related to permissions, which I was able to resolve. One point I have difficulty with is creation of the data tables in the SQLExpress database. I'm using Identity framework (from another of your videos) and found that the identity database tables are created automatically. However I find the application tables (dbo.Table etc) are not created. I googled extensively and can only find recommendations to use EF. I don't want to migrate / refactor, so can you suggest how I can get the .sql files to run to create the application data tables? I have 30+ tables, so don't want to recreate a script for each. The Dapper docs weren't much help, I found.
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
I'm not sure how you originally created the tables. Are you hoping the models will be used to create the tables for you? If so, you would need to use Entity Framework ( kzbin.info/www/bejne/p5ytap6bd9KEjdE ). That will take some setup work and it isn't something I recommend if you aren't very familiar with Entity Framework. I would personally recommend going the route of SQL Server Data Tools to build your application database: kzbin.info/www/bejne/n5unlHt9rd6ke5Y
@davemcpherson3346
@davemcpherson3346 5 жыл бұрын
@@IAmTimCorey Tim, thanks for the prompt reply. For the tables, I created them just as you described... Database project > Add > Table > enter fields matching Model. This created a .sql file in dbo.Table folder matching the data I entered. Just need to run that on the third-party SQL database, but unclear how to do that. I'll look into SQL Server Data Tools, as you suggest. I used VS SQL Server Object Explorer for local IIS linked SQLExpress database and published the database project... but that won't work for a third-party server, of course.
@MathGeekQ
@MathGeekQ 5 жыл бұрын
Hello Tim, @40:30, would the "front end model" with all the decorators and validation be considered a ViewModel? And the one with just the properties is just a data Model? I've seen some projects with two separate folders named Models and ViewModels, where Models are data Models (i.e. model the db tables), and ViewModels are models used only to pass data to the views and often get data from two or more data Models. Is what you talked about here the same concept as the ViewModels?
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
Nope. A ViewModel is part of the MVVM structure where you have Views, Models, and ViewModels. A ViewModel is close to the same concept as a Controller in MVC (ViewModels have two-way binding, Controllers have one-way binding). Models are used to store data. That is pretty much it.
@waz_boolin6582
@waz_boolin6582 5 жыл бұрын
Dude you are a lifesaver thanks for the valuable info.
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
You are welcome.
@joshuatindoc1013
@joshuatindoc1013 4 жыл бұрын
Very informative Demo Thank you. You're a great influencer God bless you
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Thank you!
@rizreighnand6471
@rizreighnand6471 5 жыл бұрын
great explaination! i saw asp.net as a complicated framework but you explained it very well subbed!
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
I appreciate the kind words.
@dperfetto89
@dperfetto89 Жыл бұрын
This video was helpful and at a good digestible pace. Thanks!
@IAmTimCorey
@IAmTimCorey Жыл бұрын
You are welcome.
@lukehewitt604
@lukehewitt604 4 жыл бұрын
Thank you for the very clear tutorial Tim! It helped me understand a lot!
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Glad it helped!
@kataseiko
@kataseiko 6 жыл бұрын
35:20 "That limit is a maximum of 64 characters (octets) in the "local part" (before the "@") and a maximum of 255 characters (octets) in the domain part (after the "@") for a total length of 320 characters. However, there is a restriction in RFC 2821 on the length of an address in MAIL and RCPT commands of 254 characters."
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Interesting. There used to be exceptions (I believe for Arabic and one other character set) that greatly increased the length but I don't see those anymore. Good to know.
@hthclash1970
@hthclash1970 6 жыл бұрын
Super clean code, I love it.
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Thanks!
@Itchymcgee
@Itchymcgee 5 жыл бұрын
You a hero Tim! Also, a course on making a blog engine would be cool.
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
Thanks for the suggestion!
@ezbytes
@ezbytes 3 жыл бұрын
Just what I needed to access database. There are kind of articles out there but nothing comes close to it.
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 3 жыл бұрын
Thanks for watching and sharing
@grzegorzsmolak8947
@grzegorzsmolak8947 Жыл бұрын
Very nice and helpful video, but I have one question now. If I make everything dapper-based, how do I add Identity authorization now?
@IAmTimCorey
@IAmTimCorey Жыл бұрын
It depends on what system you use. I'm assuming you are asking about Microsoft Identity, which still uses Entity Framework. You can see an example of using it while using Dapper for the rest of the data access in my TimCo Retail Manager playlist.
@grzegorzsmolak8947
@grzegorzsmolak8947 Жыл бұрын
@@IAmTimCorey alright, I'll look that up. Thanks a lot!
@oskar5700
@oskar5700 3 жыл бұрын
Amazing videos. You made this easily understandable and explained it clearly. Keep up the good videos! :D
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Thank you.
@tomservo75
@tomservo75 5 жыл бұрын
What is data type T ????? You confused me with the line conn.Query(sql); What's with the T in the angle brackets?
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
It is a generic type. You can learn more about it here: kzbin.info/www/bejne/omfWaHSsj91ooJo
@JustQASME
@JustQASME 3 жыл бұрын
This is a great tutorial. Easy to follow and implement. Thank you so much!
@tomthelestaff-iamtimcorey7597
@tomthelestaff-iamtimcorey7597 3 жыл бұрын
Thanks for watching!
@Infinitize99
@Infinitize99 5 жыл бұрын
at 47:00, my using Dapper contain an error which shows that it is now found despite being installed. How to solve this?
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
Did you install it in the correct project (the class library, not the user interface)?
@arturdziepak
@arturdziepak 5 жыл бұрын
Does your say using directive is unnecessary? every single line of code after instaling Dapper is like black magic! I've tried to follow along but I get errors that It does not exist in the current context or could not be found. If I specify directory before relating to the file for eg. Models.UserModel instead just UserModel the error is disappearing but I don't know if that's the right solution.
@alialsaady5
@alialsaady5 5 жыл бұрын
Hi Tim, thank you for the clear explanation. I only had one more question. At 35:55 you decide not to save the password in the database. But what if someone wants to log in, how can you find out if someone enters the correct password?
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
You would use the Identity system, which stores a hash of the password in a safe manner. I demonstrate this in the TimCo Retail Manager series.
@woozy_deer
@woozy_deer 6 жыл бұрын
Hey Tim, could you do a video on attributes/pre-processor directives? Having trouble with that topic, use-cases, when to use them, where the standard library attributes apply, etc. Your videos are great, I always look forward to new ones popping up in my notifications, thanks!!
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Sounds like a good video topic. I'll add it to the list.
@Shubhaiss
@Shubhaiss 4 жыл бұрын
Hi Tim, while making the method of LoadEmployees at 59:29, I am getting a red underline under the 'LoadEmployees()' stating: inconsistent accessibility: return type 'List' is less accessible than method 'EmployeeProcessor.LoadEmployees()'. Would you know what to look into?'
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
EmployeeModel is probably not marked as public.
@Shubhaiss
@Shubhaiss 4 жыл бұрын
@@IAmTimCorey Thank you Tim. Adding 'public' to the EmployeeModel.cs EmployeeModel class has worked. I really appreciate the support and I will definitely purchase this course today.
@nickeax
@nickeax 5 жыл бұрын
This is a fantastic guide, like all of your videos. Many thanks.
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
You are welcome.
@rafaelrodriguessilva9994
@rafaelrodriguessilva9994 11 ай бұрын
and as always, excellence!
@IAmTimCorey
@IAmTimCorey 11 ай бұрын
Thank you!
@dogburrito
@dogburrito 5 жыл бұрын
Tested and working. This is the first MVC tutorial of 3 that I've attempted that proved to be 100% valid and effective. Better than PluralSight (which I cancelled today). This code is now working 100%. Thanks Tim! This get's me halfway to where I need to be for my first MVC project Can you recommend a resource for one or more of these problems? 1) capture an argument from the URL, like (host/Index/ 2) SQL select a two tier (2 table "header - detail" join) into the model and then display the header and detail data on the view 3) embed a hyperlink into the above detail records. When licked it reads a PDF file from a file-system and opens it in the browser
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
I don't have a demo of the MVC version of the first question (I do for Razor Pages). For the second question, just do two queries - one for the header, one for the details. Then combine the results into one model. For the third question, that's a bit too specific to answer in a comment, sorry.
@tomservo75
@tomservo75 5 жыл бұрын
Question: at 4:45 when you added the EmployeeModel, you created the model as an ordinary class. Does that mean that a "model" and a "class" are functionally the same thing when it comes to MVC?
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
A model is a type of class. It typically is just properties and is designed to keep data together. So models are a subset of classes.
@utsabshrestha277
@utsabshrestha277 4 жыл бұрын
Hi Tim can we use this same technique to make a 3-Tier Architecture application for Data access layer with Dependency Injection ?
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Yes you can.
@WorriedBubble
@WorriedBubble 5 жыл бұрын
Hi Tim, this is an absolutely fantastic course; it's helping me a lot in my learning. I am however having an issue understanding why I would need the local variables for the CreateEmployee method at 54:10. Where does the 'data' info go & how is it used? Is there a way I can just call the model & skip this step? Thanks for the free lessons!
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
The class is passed into Dapper as an object. Dapper takes objects and looks at each property to match it up to parameters in the SQL. Yes, we need this local variable (or we need to create an anonymous variable).
@AztecPyramid
@AztecPyramid 5 жыл бұрын
Hi Tim, I saw you add the Dapper nuget, but, I am not sure where that came into play. How was Dapper used please? Thanks for a great video!
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
Dapper is used for data access. It is what is talking to SQL when we ask for data.
@pylvr8021
@pylvr8021 5 жыл бұрын
the Fuctions Query and Execute are from Dapper. you dont see the word Dapper in the code because he's using the statement 'using Dapper ' to include the dll in the namespace
Simple C# Data Access with Dapper and SQL - Minimal API Project Part 1
1:14:08
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
Getting Started with Dapper in .NET
11:29
Amichai Mantinband
Рет қаралды 15 М.
Intro to WebAPI - One of the most powerful project types in C#
1:15:21
How to connect C# to SQL (the easy way)
1:20:40
IAmTimCorey
Рет қаралды 1,1 МЛН
62. .NET Framework vs .NET Core vs .NET vs .NET Standard vs C#
25:14
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 260 М.