Entity Framework 6 Tutorial: Learn Entity Framework 6 from Scratch

  Рет қаралды 524,021

Programming with Mosh

Programming with Mosh

Күн бұрын

Пікірлер: 216
@esraahefny5859
@esraahefny5859 3 жыл бұрын
You are the best!!!!!. Simply I love your way of explaining. I have an interview and I have just learned the required basics of c#, .Net MVC, and Entity framework in just one day and you saved me. Thanks so so much.
@stephenwall9036
@stephenwall9036 6 жыл бұрын
Finally! A decent presentation on entity framework. Thank you.
@valentindemchuk1297
@valentindemchuk1297 7 жыл бұрын
Thanks Mosh! Your course is the best I've found in a week of searches on the Internet! A good and clear diction, an accessible explanation. Thanks a lot!
@divsyntax9720
@divsyntax9720 5 жыл бұрын
Thanks!! Actually I was a bit hesitant to use entity cause I like using MSSQL, but now I'm like....."WOW! This is what I've been missing!" So easy! :) Thanks!!
@nahiandev
@nahiandev 7 жыл бұрын
SIr, You are more tham amazing ! Recently I had your C# basics course on Udemy. To be honest , I learnt a lot from your course that I wasn't taught in my uni. Thanks for being awesome.
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
xinchao
@moritzschmidt8528
@moritzschmidt8528 7 жыл бұрын
Excellent tutorial! I just had to migrate my ASP.ET-Core Project to a normal ASP.NET-Prject and had problems because I was using EF-Core. With this tutorial I managed it to migrate the DataBase within 15 minutes without any probelms. Great work!
@artokilponen6989
@artokilponen6989 7 жыл бұрын
I have been wanting to see _recent_ EF video tutorial for a long time. Even if this video wouldn't cover a lot of EF, as long as it states the starting point i.e. how to apply methods of old versions to EF, that is enough for me. I like a lot of the editing of video. No-one is actually interested in you writing the code. You can tell where and what to write, but the actual typing is pointless to see. Good work with that! One thing you could have in the video is pointing out typical pitfalls like "pay attention that you...". I had three of these (mostly because I didn't pay enough attention): 1) Adding "using System.Data.Entity;" there in code first section. 2) Typing "public class BlogDBDontext : DbContext" Gave me no errors, the database just didn't appear. 3) "System.Data.Entity.Infrastructure.DbUpdateException occurred HResult=0x80131501 Message=Unable to update the EntitySet 'Posts' because it has a DefiningQuery and no element exists in the element to support the current operation. Source=EntityFramework StackTrace: at System.Data.Entity.Internal.InternalContext.SaveChanges() at System.Data.Entity.Internal.LazyInternalContext.SaveChanges() at System.Data.Entity.DbContext.SaveChanges() at EF_DatabaseFirstDemo.Program.Main(String[] args) in ...EF_DatabaseFirstDemo\Program.cs:line 22 Inner Exception 1: UpdateException: Unable to update the EntitySet 'Posts' because it has a DefiningQuery and no element exists in the element to support the current operation. " which was caused by not having a primary key (your database sample has it, I had just missed it). I needed to edit and run the SQL-file to add the missed primary key. And remove and re-create the edmx. Question: As I also had my "Generate Change Script" disabled, what are the basic steps you do if you forget to add the primary key on table creation process? Is it what I wrote above, or is there a simpler way to accomplish the same? And a couple of questions: 1) At 17:09 you have this jumping to App.config. I know how to get there manually, but is the method you use a part of Resharper (noticed that in your menus) and how do you launch that window? 2) In order to get a connection string to your database, is the best way to copy-paste it from the database first example app.config or do you have some other method for that besides "just type it out from the top of your head"? But in overall a great video! You have clear voice and there was enough but not too much pictures for my taste.
@yrusTube
@yrusTube 7 жыл бұрын
As always top notch content. Can you please make a video on Unit testing, I am sure it be helpful to all your subscribers.
@yrusTube
@yrusTube 7 жыл бұрын
Thanks Mosh. Will be looking forward to it :)
@myaccount09011975
@myaccount09011975 6 жыл бұрын
Excellent presentation, I have become a great fan of your sessions on KZbin.
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
ccc
@danielnewman6731
@danielnewman6731 6 жыл бұрын
5:50 With DB first you should create the database using a Database Project in Visual Studio. You can also reverse engineer a database without the EF designer or any edmx files. There are tools you can use to reverse engineer a database to EF, and you can the model generation logic too, using t4 templates and such. For example you want your EF Models to inherit an IEntity. Also, you should treat it as designer generated code, so you can always reverse engineer from database. You should never modify the generated Models directly, if you need to make changes do so through metadata/partial classes.
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
aa
@gw4303
@gw4303 4 жыл бұрын
I bought your course of Entity Framework on Udemy. I believe is well spent money :) thanks for the tutorials!
@TahirAlviPakistan
@TahirAlviPakistan 7 жыл бұрын
Mosh, well done. You simply rocks. Your presentation, conciseness ans grip on the topic is flawless. Thanks.
@belghoulbilal8794
@belghoulbilal8794 Жыл бұрын
Hi, sir mosh i'm very greatefull for your courses they are best, please if you can explain us the asp donner identity and how we can custumize and intigrated with real wolrd project,
@Naq94
@Naq94 6 жыл бұрын
Very nice, illustrative and perfect. Thank you.
@Diyar_Bakir
@Diyar_Bakir 7 жыл бұрын
Thanks Mosh ... I watched full course of C#, probably I'm ganna watch this one. then return to continue asp.net mvc course because I'm new to .Net family and I migrate my programming life from PHP to asp.net and I'm very happy when I see Microsoft going to change asp.net to open source.. please we need tutorial about deploying asp.net project especially on Linux sever even doing on azure not bad.. I hope you have fantastic life and make more tutorials.... for your info: Hamadan is a place in IRAN if I'm not wrong :)
@GaleAnders
@GaleAnders 6 жыл бұрын
This is just so much fun! Afraid I simply have spend the rest of the day doing the full course.
@GaleAnders
@GaleAnders 6 жыл бұрын
What do you mean by pain, man? I've been writing code in all kindes of environments for almost 20 year now. This is the most fun I've had since we dragged the lake looking for my mother in law! BTW I used to teach my self for some years, and your courses are reeeeeally good, man. I've been around the block a few times, and have seen a bit of this and that along the way. Give your self a pat on the back!
@dawidsoko3018
@dawidsoko3018 3 жыл бұрын
We need ytbers like you! Thanks a lot
@zybute
@zybute 4 жыл бұрын
You put learning programming to the next level! Thank You for sharing your knowledge and inspiring to learn more in understandable way!
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
aa
@richardvyse5611
@richardvyse5611 4 жыл бұрын
Brilliant, I will be buying this course on Udemy.
@Karenitooo
@Karenitooo 7 жыл бұрын
wow you are a mentor for us :D
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
aa
@xVidarx18
@xVidarx18 6 жыл бұрын
At 15:56 what function do u use to navigate back to the programm? Is it from resharper?
@MohanPatil_Software_Engineer
@MohanPatil_Software_Engineer 3 жыл бұрын
Nice explanation.. full understanding in one go..
@nazgulresebo
@nazgulresebo 7 жыл бұрын
My favorite option is code first with data base ;D
@Felixstoll
@Felixstoll 7 жыл бұрын
thanks Mosh, I am going for the course through pluralsight, it is definitely worth it.
@responsibleparty
@responsibleparty 7 жыл бұрын
Always declare you database context in a *using* block, to ensure it is cleaned up in a timely manner. This should be emphasized even when you are just running a demo to illustrate workflow because it is so important.
@suprajainamadugu7083
@suprajainamadugu7083 5 жыл бұрын
Hi, Am not able to get ADO.net Entity Data Model template in VS2017 none of the internet solutions helping me could you please suggest how i can resolve
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
ccc
@jaimerojas6578
@jaimerojas6578 6 жыл бұрын
Amazing I loved the way you explain the topics, I already bought your course in Udemy! Thanks for making it!
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
xinchao
@OuterOrange
@OuterOrange 3 жыл бұрын
I love your video so far! I do have a question. How do you open app config? It seems to be something I'm struggling in getting to work/find. Thank you!
@ShayanFiroozi1
@ShayanFiroozi1 4 жыл бұрын
Bravo Moshfegh !
@sasca854
@sasca854 5 жыл бұрын
Just a heads up to everyone: Entity Framework does *not* work with Azure data warehouses.
@madezra64
@madezra64 4 жыл бұрын
What does this mean? Does this mean my Azure SQL Server won't work with Entity?
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
xinchao
@bobkerman2419
@bobkerman2419 4 жыл бұрын
@@shortsgirl5345 biến
@GivanniDrogo
@GivanniDrogo 2 жыл бұрын
Hi Mash, thank you for the great contents. I'm designing a java application using Spring. Based on your past experience, what are the relatively not too complex design pattern that enables developing a n-tier application composed by: 1. front-end application (Client HOST - Browser) - Programming language: Angular(?-TBD) 2. web server application (Web server HOST) - Programming language: Java 3. back-end server application (back-end server HOST) - Programming language: Java 4. relational database server application (RDBMS server HOST) - Postgres/Oracle/SQLserver Thank you in advance
@DavitHuroyan
@DavitHuroyan 5 жыл бұрын
Excellent presentation
@mateusarruda23
@mateusarruda23 6 жыл бұрын
Great video! Worked perfectly with the MVC project!
@leondu
@leondu 7 жыл бұрын
hi, mosh,just finished your complete mvc5 course, it was awesome. Will you publish videos about architecting and testing in mvc ,that be complete for that course.thanks
@eddiegere
@eddiegere 7 жыл бұрын
What an amazing tutorial! Thank you.
@uddipmitra
@uddipmitra 7 жыл бұрын
Mosh, where exactly on the Sql Server Management Studio 17.0 do I find the "Change Script" option?
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
bbb
@GeoffTV2
@GeoffTV2 7 жыл бұрын
Excellent tutorial, very helpful. Many thanks.
@gyanshukla4389
@gyanshukla4389 6 жыл бұрын
really i liked your video this help me lots, i have one question that i have to install entityframework every time with respect projects ?
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
bbb
@taab84
@taab84 5 жыл бұрын
With code first we can focus only on code and that's the purpose of the ORMs
@morelovenohate5029
@morelovenohate5029 7 жыл бұрын
Thank you so much! I needed this so bad and you popped it on the screen. all your videos are awesome i will be taking this course
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
aa
@anoopsimonlx
@anoopsimonlx 7 жыл бұрын
Thank you Very Much , Wonderful Tutorial...
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
ccc
@Riteshtandon23
@Riteshtandon23 4 жыл бұрын
You are the best 👍💯
@nishthakapur997016
@nishthakapur997016 5 жыл бұрын
in code first approach, we have not mentioned which field is primary key then how does it generate table with id as primary key.
@jamesmiller8847
@jamesmiller8847 6 жыл бұрын
Those Udemy ads are so repetitive lol. Great tutorials man.
@Telee_Pawt
@Telee_Pawt 5 жыл бұрын
Looks great. If only I could get VS to work.
@alexaneals8194
@alexaneals8194 5 жыл бұрын
I enjoyed the tutorial. However, there is one inaccuracy, you don't necessarily have to use the database designer to create tables. I have created databases with tables and views just using sql scripts. In fact, I find for me personally it is faster to type in the sql scripts.
@KDOERAK
@KDOERAK 7 жыл бұрын
I am impressed: a great presentation.
@vin2629
@vin2629 7 жыл бұрын
Man you are my gold !Your tutorial on MVC was sublime and this too is fantastic. Can you please post videos on ASP.NET MVC Core Middleware. My project requires a HttpHandler which is not supported on .NET Core please help !
@vin2629
@vin2629 7 жыл бұрын
Mosh I have some piece of code to add some user data to cache,written in an ashx HttpHandler which could take this userdata as an input and add that to application cache. During SSO of the application through GatewayPortal,first this HttpHandler on the application is hit passing userinformation from GatewayPortal and HttpHandler adds the userdata into the cache on the application. We right now transitioned to ASP.NET CORE and there is no ashx support in Core. I read somewhere ASP.NET Core Middlerware is a substitute for HttpHandlers. I am curious if there are any tutorials of yours on ASP.NET Core middleware Thanks !
@emi22a
@emi22a 4 жыл бұрын
12:57 what is the shortcut to where that search files/folders pops up?
@robimegu3712
@robimegu3712 3 жыл бұрын
IDK, but you can use CTRL + ; (control and semicolon) this functioning like that. This brings up the Solution Explorer's search bar and searches from that
@gbmarshall
@gbmarshall 6 жыл бұрын
Question - if you have a legacy database that uses a lot of stored procedures that need re-writing - do you suggest in certain situations to rewrite in ef? And then your db code is where on the Client Windows application or on a .net console app running on the server, or asp.net on the server?
@suprajainamadugu7083
@suprajainamadugu7083 5 жыл бұрын
I really love this course.
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
hello
@parko1965
@parko1965 6 жыл бұрын
In this example when I query a database for case sensitive text it returns a field no matter what case is submitted against the database. How is that?
@joshe9626
@joshe9626 5 жыл бұрын
Great video!!, can you make a video explaining ASP NET MVC 5 IDENTITY ?? please.
@flyingleaves5480
@flyingleaves5480 3 жыл бұрын
should we be worried about sql injections when using entity frameworks?
@TopazCentuallas
@TopazCentuallas 7 жыл бұрын
I already saw this course and it was great!
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
aa
@heiko3169
@heiko3169 6 жыл бұрын
Good explanation.BUT: you should have mentioned property attributes for code first entities. This is an essential thing! In your example code you would create 2 columns with nvarchar max (because you didnt define the string max length for those columns). And string columns in a db table with max length definition, makes things rapidly worse with high performance impact. Its a NoNo.
@nicsevern
@nicsevern 3 жыл бұрын
Exactly what I was looking for and presented concisely! Thank you!
@bibinlouis4927
@bibinlouis4927 4 жыл бұрын
I have problem with organizing fluent API configuration?? in visual studio 2019 , please can you help me?? i have enrolled in your entity framework course in udemy
@daniyalawan7759
@daniyalawan7759 7 жыл бұрын
Thank You Very Much Mosh !!
@abhinavkumar8271
@abhinavkumar8271 7 жыл бұрын
Very Good Mosh.. You RockOn!!!
@BBStub3
@BBStub3 5 жыл бұрын
What about if i manually add a column later in database using SQL Mngmt studio to the database i created with CodeFirst migration. will still work the app, or i have to manually open the console and write the update migration code ? i'm imagining i build database CodeFirst fashion style. and i build my app and i give the app away for users to use. then in 2-3 moths time i open sql managment studio and add a column to the table. how this will affect my running app of users ? can there be a method to be called everytime the app is opened (to update the classes properties "to add more" in case more columns appears in database) ?
@egl2004
@egl2004 7 жыл бұрын
If we get stuck while taking the course is there a specific, focused, community (ie: not StackOverflow) we can reach out to? How do we get "unstuck"?
@adnanganic7427
@adnanganic7427 5 жыл бұрын
Thank you Mosh... This is great tutorial :)
@ahmadjaber2940
@ahmadjaber2940 4 жыл бұрын
Hi! Personally I don't like the idea of code first migration so I manualy created a script to create the database scheme and then I runned >> scaffold-dbcontext -provider Microsoft.EntityFrameworkCore.SqlServer -connection "My_connection" That created the classes I need to interact with database. Is that a good thing to do or we should use the CodeFirst way? please help
@EminoMeneko
@EminoMeneko 4 жыл бұрын
Do you have a chapter on the different annotations in your Udemy course? Do you talk about ForeignKey or InverseProperty? What's their purpose and how to use them? Regards.
@SeanSheraton
@SeanSheraton 4 жыл бұрын
What was the shortcut you used to find a file in the solution? Is that an extension?
@danielakachi3666
@danielakachi3666 6 жыл бұрын
Another awesome one!!.. Thanks..
@ambientsoda106
@ambientsoda106 4 жыл бұрын
Great tutorial....but visual studio has some classes for dealing with logins that read data...do you know about these classes
@redeslog1815
@redeslog1815 2 жыл бұрын
I liked the Class😄
@soysonialo
@soysonialo 5 жыл бұрын
this was great! thank u so much.
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
xinchao
@jameeliqbal9107
@jameeliqbal9107 3 жыл бұрын
thanks mosh! Do you have a similar video for EF Core (.net 5)?
@karananeja8054
@karananeja8054 4 жыл бұрын
what command are you using to move between the files in Visual Studio
@babuk9572
@babuk9572 3 жыл бұрын
Hi Mosh, Thank you. How to use Entity Framework with multi-database like (SQL and Oracle). One application with Multi Database. Do you have any sample videos? Please share it Thanks Babu
@matheus-il
@matheus-il 4 жыл бұрын
Thank you!!
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
hello
@abal6127
@abal6127 2 жыл бұрын
nice job. I have concern. I can see a lot of KZbin Tutorial use Entity framework( DbContext) when they want to deal with a DB. I'm a guy who uses SQl client and store procedures to deal with the DB (Since I'm good with a DB). I don't know why but I have this believe using this method, gives me more control. IS it a bad practice and why?
@markanthony4556
@markanthony4556 4 жыл бұрын
Great video but needs some updating to be applicable to the present date sql and .net
@bassemk6555
@bassemk6555 4 жыл бұрын
this course include Code-based configuration and its issues ? so , i can set custom connection parameters.
@kevoxs
@kevoxs 4 жыл бұрын
THANK YOU!!!!!
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
aa
@marifalsafi3452
@marifalsafi3452 7 жыл бұрын
Kheir az javunit bebini kheyli khub dars midi
@mazkaibil9108
@mazkaibil9108 5 жыл бұрын
i get this error: "The type initializer for 'System.Data.Entity.Migrations.DbMigrationsConfiguration`1' threw an exception"
@longpheap9592
@longpheap9592 5 жыл бұрын
Maz Kaibil i have this error too.. so i create new solution project and it’s worked
@longpheap9592
@longpheap9592 5 жыл бұрын
Maz Kaibil this error caused when u try to add migration.. The issue is with connection string
@chicagoboy279
@chicagoboy279 6 жыл бұрын
What about that program class? I don't have it nor executable method to instantiate objects. Visual 2010
@UncleAlvertho
@UncleAlvertho 5 жыл бұрын
I know a person that use model first, because your comment that you don't know people that use this approach may be the person I know is like a Sasquatch developer.
@jkerchek
@jkerchek 4 жыл бұрын
enable-migration does no longer work with EF6.4. any updates with the latest EF?
@marceloleandro331
@marceloleandro331 6 жыл бұрын
Hello dear, one question: Is indicated to use AsnoTracking() in Get method's all or single? it is wrong?
@backey
@backey 5 жыл бұрын
Thanks David Cross :)
@j.almadhaji
@j.almadhaji 6 жыл бұрын
can I use entity framework to deal with two databases and make relation between their tables
@stefersonpatake
@stefersonpatake 6 жыл бұрын
Thanks to you, now I really understand the difference between code and database first and HOW to implement each one. 'Successfull programmers uses keyboards, not mouse' was nice! :-D
@henrygene5899
@henrygene5899 6 жыл бұрын
"'Successful programmers uses keyboards, not mouse' " is just plain arrogant. As in "If you don't do it MY way, you are not a good programmer!". Brilliant. When defining a project, the db design and schema is a major, primary step. Arguably, you first design the data structure that you need, then build programs around it. To do otherwise is to put the cart before the horse. Code First may be a superior method because of maintainability (it keeps the schema in line with the app), but to build your schema from code is arguably wrong; You are basically using VS/C# as an alternative editor to SQL Management studio, which is a 'highly questionable' choice.
@ztreinamento
@ztreinamento 6 жыл бұрын
Great tutorial, thaks!!!
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
ccc
@ramisaadani6076
@ramisaadani6076 6 жыл бұрын
Awesome Tutorial , thanks alot
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
aa
@chiwonkim1887
@chiwonkim1887 6 жыл бұрын
good guide to EF
@makizo-nl5gx
@makizo-nl5gx 7 жыл бұрын
#Mosh fantastic videos ...loved it
@dchan5251
@dchan5251 5 жыл бұрын
super ! very detail indeed ! Thank you for the introduction
@barathmanikandan688
@barathmanikandan688 6 жыл бұрын
Thank you Mosh :)
@shortsgirl5345
@shortsgirl5345 4 жыл бұрын
xinchao
@supermankelly
@supermankelly 7 жыл бұрын
Will you be doing a EF Core course? Ideally one which assumes no knowledge like this rather than like most which assumes most people looking at EF Core know EF6.
@Gapo1994
@Gapo1994 5 жыл бұрын
You should add PayPal as a paying method for your courses as well :D
@valluriveeravenkatasatyapr5047
@valluriveeravenkatasatyapr5047 6 жыл бұрын
if i purchase your course from the link provided, will i see that in my Udemy list?
@Praveenkumar-ng7vf
@Praveenkumar-ng7vf 6 жыл бұрын
Hello mosh, I followed your tutorial step by step but i am getting this exception.Please help me where it went wrong. "An unhandled exception of type 'System.Data.Entity.Core.EntityException' occurred in EntityFramework.SqlServer.dll"
@PilotChrisDavis
@PilotChrisDavis 7 жыл бұрын
Hello. I am trying to follow your tutorial but once I get to the context.SaveChanges(), I get this error when I run it: + $exception {"Unable to update the EntitySet 'Posts' because it has a DefiningQuery and no element exists in the element to support the current operation."} System.Data.Entity.Infrastructure.DbUpdateException
@shailabhagwat6356
@shailabhagwat6356 6 жыл бұрын
Is the identity on for the table
@cocobos
@cocobos 6 жыл бұрын
Once you do a Code First, you'll never gonna go back to DB First, especially in MVC
@henrygene5899
@henrygene5899 6 жыл бұрын
Huh? If you already have your database (eg, an accounting system, or a customer's project that you walked in on), do you have any choice but to do DB First?
@cocobos
@cocobos 6 жыл бұрын
@@henrygene5899 I'd rather proposed them to create a new system, after all, MVC is very fast to code especially code fist. You can even use the old classes to generate the DB.
@morsayxd4441
@morsayxd4441 4 жыл бұрын
sir u really good
Repository Pattern with C# and Entity Framework, Done Right | Mosh
26:24
Programming with Mosh
Рет қаралды 876 М.
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 51 МЛН
Node.js Tutorial for Beginners: Learn Node in 1 Hour
1:18:16
Programming with Mosh
Рет қаралды 6 МЛН
Entity Framework Migrations Explained
36:53
dotnet
Рет қаралды 33 М.
139. What Are Your Thoughts on Entity Framework Core vs. Dapper?
21:49
Get started with ENTITY FRAMEWORK in C#!
15:57
tutorialsEU - C#
Рет қаралды 25 М.
Design Patterns in Plain English | Mosh Hamedani
1:20:01
Programming with Mosh
Рет қаралды 1,4 МЛН
C# Events and Delegates Made Simple | Mosh
32:04
Programming with Mosh
Рет қаралды 953 М.
ASP.NET Core Crash Course - C# App in One Hour
1:00:44
freeCodeCamp.org
Рет қаралды 1,6 МЛН
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 51 МЛН