It's a new age for .NET developers. You can build cross-platform apps, use lighter tools like VS Code, and deploy instantly using tools like Docker. In fact, ASPNET Core and EF Core are so cross-platform that not only can you deploy your apps to OSX and Linux (oh, and Windows, too), but you can even build them on any of the platforms. In this session, Julie Lerman will add EF Core into an ASP.NET Core WebAPI, connect to PostgreSQL, and use the web API to interact with the data. And just because she can, Julie will do all of this coding, debugging, and running in OSX on a MacBook. You'll also see how EFCore's new InMemory provider makes unit testing a breeze. Once the API is tested and working, you'll see how to push the database and the new API into docker containers and run them on Linux.
Julie Lerman is a Microsoft MVP, .NET mentor and consultant who lives in the hills of Vermont. You can find Julie presenting on data access and other Microsoft .NET topics at user groups and conferences around the world. Julie is the author of the highly acclaimed "Programming Entity Framework (with a second edition coming soon) and authors the MSDN Magazine Data Points column.
Introduction So here we are learning about EF Core with Julie Lerman. Very exciting, been in the works for a long time, but finally gone release candidate, and even golden master, so we're going to see how it works as a new cross-platform version of EF Core. So, Julie, first we're going to look at adding EF Core to an existing ASP. NET Core Web API app, that seems very practical. How do we start about going about doing that? Well, first I should point out, and people are probably used to seeing me work on Windows and in Visual Studio, and I'm going to actually do this demo for you on a Macintosh. And I'll explain why. Entity Framework Core, we've been hearing a lot about that, and also CoreCLR, and ASP. NET Core, and I want to make sure that people who are used to using Entity Framework Core aren't confused by what the CoreCLR means to. NET, and what Entity Framework Core means to. NET. There's a really big difference. So the CoreCLR is actually a stripped down version of. NET that is able to run on different operating systems. So not just Windows, but also Mac and Linux. So, if you target an app that's full. NET, that's only going to be an app that's going on Windows. But if you target an application to run on CoreCLR, that means you're using the newer version of. NET, because it will run everywhere. But Entity Framework is not divided in that way. Entity Framework Core is the same, just the same, whether you're running it in the full. NET or in the CoreCLR. So that's a really important thing because I think people freak out that Entity Framework Core is only going to work with CoreCLR and with ASP. NET Core APIs, and that's actually not true. You can use Entity Framework Core with full. NET apps as well. Now I was impressed when you demoed this for me earlier because, I've used a lot of early versions of software or first versions of software, 1. 0, and I was ready for all kinds of bugs and workarounds, but it works pretty smoothly. It really does. They've done a good job getting the whole thing working and reliable. Yeah. Well one of the ways that they were able to do that was to not try to do all of it at once. So this first release, that actually came out a little over a month ago, so we're in early August right now, so the first RTM of CoreCLR, ASP. NET Core, and Entity Framework Core came out at the end of June 2016. But, it is a subset. It's a much smaller footprint of capabilities and features than what we're used to with, for example, Entity Framework 6. And that feature set will continue to grow, but it's definitely, like this first release, it works pretty darn well, there are places people have found some issues with it still, but for the most part, what it's aimed to do, what it's targeted to do, it does really, really well. And I'll take that any day, a reliable subset rather than a cutting edge, full-featured version that may not fully work, so that's great that they've gone that route. Yeah, and if you still want to use the full-featured, completely stable version, then stick with Entity Framework 6. Right, this isn't a one-to-one replacement, it's the next generation, and so not everybody's going to move on to that next generation. So, given that, I just want to make sure people aren't confused about that, because I know there's a lot of confusion. So, you don't have to move to Entity Framework Core, you don't have to update your applications to use it. So take a look at what's in Entity Framework Core now, which I'm going to show you a little bit of today, and then keep up with what the team is sharing and working on in GitHub. I can give you some links after we're finished with this so that you can share them. And then whatever you're seeing here, even though this is a Mac, whatever I'm showing you with respect to Entity Framework is what is available to Entity Framework no matter what operating system you're on or targeting. What's also really, really cool about this is it is so cross-platform that not only can you deploy to a Mac or to Linux, I'm going to code it, and debug it, and have IntelliSense, and deploy it, and I can do all of that on a Mac. Now it's not going to be as rich as using Visual Studio, but I'm using Visual Studio Code, which is cross-platform, and it's not just for doing C# coding, you can use it for a lot of other things. But it's really good, and they keep releasing every month, and my ability to write, and debug, and work with C# code in here is just amazing.