23. (ASP.NET Core 1.0 & MVC) Entity Framework Core Code First Example

preview_player
Показать описание
This Entity Framework Core Code First Example video is part of the ASP.NET Core 1.0 beginner programming tutorial course hosted by Steve Bishop, and covers the first steps in creating a context for your entity framework, and the models for your application. The ASP.NET Core 1.0 beginner course is a free .NET tutorial series that helps beginning programmers learn the basics of ASP.NET Core 1.0. These free ASP.NET Core programming tutorials cover a variety of basic topics such as downloading and installing ASP.NET Core, setup and configuration of ASP.NET Core, the MVC architecture, Razor View engine, ASP.NET Identity, Entity Framework 7.0, and other topics. After watching this beginner series on ASP.NET Core 1.0, you should be able to create your own website or web application.

Рекомендации по теме
Комментарии
Автор

This guy has a great voice for narration, and appears to demonstrate a very logical, and easily understood, approach to teaching.

I'm a fan already.

captainslow
Автор

Hello sir i am having this issue while applying add-migration
Value cannot be null.
Parameter name: connectionString

string connection =
=>

adeelmalik
Автор

You can put your connection string in appsetting.json and then use
var

So u can change the connection string by edit json file without changings in the code

lost_daemon
Автор

Hello sir plz tell a little difference between .net core 1.0 and 2.0 because i am using version 2.0 can i follow you with 2.0 ?? Thank YOU :)

adeelmalik
Автор

I love your videos. They are a bit more in-depth as to what really happens when you execute the code, as opposed to other tutorials that just show you the How and not the Why :-)

mortenrudjensen
Автор

Hello! I am unable to access the Work Files. The link doesn't go to files anymore. Is that just me or are the files gone forever?

jasoncowin
Автор

Hi.
I followed your video from the first and really appreciate your clips.
However, I stuck in this lecture.
When I put 'add-migration Initial-Migration -context ContosoContext' in PM Console, I got 'Startup project 'src\WebApplication4_core' is an ASP.NET Core or .NET Core project for Visual Studio 2015. This version of the Entity Framework Core Package Manager Console Tools doesn't support these types of projects.' this message.

and I checked my EntityFrameworkCore version and those are followings
"1.1.1",
"1.1.0",
"1.1.1"

Is there any solution??

and I would like to ask one more thing.
I think in this tutorial, SQL is used as a database. Actually, I would like to use NoSQL, especially 'Apache Cassandra'. In this case, is it also useful to follow or know your video clips about 'Entity Framework Core' parts?

Thanks!

lsmenhorse
Автор

Would you please clarify the discrepancy between the textual title ("Code First") and the title in the actual video ("Model First")? IMO, simply conflating the two terms is quite different than what I understood the MS-stated position was, which is *eliminating* Model First. I would also appreciate that if a related clarification is made only in your description above, a comment here to let me know.

syndicatedshannon
Автор

Hi Steve,

Thanks for these videos, they're so great. I notice that the steps of setting up connect strings and using methods have changed and they're a bit different right now, so in the latest doc they don't setup connect string in startup.cs but just use "OnConfiguring" method in "BloggingContext" to connect to the DB, but I am wondering how does the compiler know where to look for the files that it needs to get the connection string since it's not specifying in the startup.cs file anymore?
Thank you so much, I really appreciate your help.

hakunamatata
Автор

How to correct this Error. "The term 'add-migration' is not recognized as the name of a cmdlet". Please reply

lakshmikundu
Автор

So If I populate the database using Code first in this way, Won't I have to keep dropping tables whenever there is a change in the database? Changes like adding a new column to a table for example while the data is in the database.

Kidkromechan
Автор

I love your course you talk about everything in detail that's so easy to understand world needs more courses like that! I'd love to see a front-end course about angular or react from you.

konrad
Автор

This says code first but the first couple seconds he says model first. Which is it?

EnduranceT
Автор

I got tihs Error when adding migrations : the Entity Framework Core Package Manager Console Tools doesn't support these types of projects... please help.

marvenwilsonsdonque
Автор

This version of EF is wrong, more than that, there is not even a version on the video. Everybody knows that we need to specify a version being the same as the project. None of them works. Incredible how Microsoft messed up with VS putting in so many tecnologies that does not work on the IDE and making programming live more complicated than even! You spent so many time figuring out how to accomplish it, in this case, sounds better creating the whole DB direct on the Database Server as old times.

justfair
Автор

Is it convention to have a "xContext" class for every Model you have? For example, do you need to have a "PersonContext" and a "ItemContext" for "Person.cs" and "Item.cs" respectively?

somegeneralist
Автор

Looking forward to your next video, I'm hoping its DB first.

RusticByNature
Автор

Solution To: - The term 'add-migration' is not recognized as the name of a cmdlet

1. Close the Package Manager Console window
2. Restart Visual Studio
3. Open Package Manager Console
4. It should now recognize the cmdlets needed.

jasoncowin
Автор

Hey, Steve. I've hit a wall when it comes to wiring up EntityFramework. I've installed Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.Tools, and Microsoft.EntityFrameworkCore.Design, but when I try to use "add-migration Initial-Migration -context MealPlannerContext I get an error reading: No executable found matching command "dotnet-ef". As I have read on stackoverflow and GitHub, I need to run dotnet ef commands from the same directory as my project.json file. I'm pretty sure I'm already in this directory (src\MealPlanner), but it's basically telling me it's not reading my EF, right? How would you go about problem solving this?

garrettdavid
Автор

Hi Steve,
Cannot execute Add-Migration command. It's getting an error called 'EF Core commands do not support PowerShell version 2.0. Please upgrade PowerShell to 3.0 or greater and restart Visual Studio'. Can I resolve this adding power shell 3 manually to Windows 7 machine? Thanks.

LAKSHIKA