Julia Lerman's Blog, page 7
March 21, 2017
Cloning a GitHub Repo in Visual Studio 2017 …and a Quiz
When showing off some VS2017 features at our VTdotNET meetup, I made a last minute decision to demo the ability to clone a repository right from GitHub. Then I thought I would combine that with other things I planned to demo.
I already had just the right repo sitting in my GitHub account. A small ASP.NET Core project that was built with Visual Studio 2015 using project.json for its metadata. It’s at https://github.com/julielerman/NetCor....
I had this same solution on my laptop already to use for another demo: showing off VS2017’s ability to auto-migrate a project.json based solution to the new csproj based format for .NET Core projects.
Clever me, I decided to kill two birds with one stone. Clone the repo and have the migration run as it was opening that solution.
So I started up Visual Studio 2017 (since I wanted to show how fast that is) and began the process of cloning the solution from my GitHub repo. I already had my credentials set up and was able to go to File, Open and Open from Source Control.
This opens the Team Explorer window and I clicked the Clone option, which then opened a window showing all of the accounts I’m connected to.
I expanded my own account and scrolled down to the repo I wanted, selected it and clicked the Clone button.
The solution got cloned and then it opened up in Visual Studio.
But it never triggered the migration! And if you look at the solution, you can see that the project I expanded still has its xproj file and its project.json file. At the time I was confused but now that I know what happened, the answer to why this didn’t migrate is very visible in that screenshot of the Solution Explorer. However, one of the developers who was watching this and had just done another demo with Visual Studio 2017, identified the problem quickly.
Let’s move on for some more clues.
I closed the solution. Then from File/Open, I browsed to the place where it had been saved on my computer, and selected the sln file to open. This time, the same exact solution opening up in VS2017, did indeed trigger the migration, which is quite obvious thanks to this screen.
Then I let the migrate feature do its job. When it was finished, you can see that the project no longer has its xproj and project.json files.
Now, look at this new Solution Explorer screenshot compared to the previous one.
And then take a look at the list of new VS2017 features in the Release Notes (https://www.visualstudio.com/en-us/ne...) under the section IDE and see if you can tell what the cloning did differently when opening the solution than just opening the solution directly from the drive.
Also, I will find out if this is by design or possible a behavior that can get modified to behave the way I had expected.
March 19, 2017
DotNet Core Version Confusion
I see people scratching their heads over this a lot so am dropping it here even though I’m sure it’s stated in many places already.
When you are at the dotnet command line (aka the CLI aka Command Line Interface) and type ‘dotnet’ you will be shown the version of the runtime.
When you add the version parameter (‘dotnet –version’) that will return the version of the SDK (aka CLI aka Command Line Interface) that you are working with.
Here’s an example:
If you are confused, you’re not alone. There’s a good discussion/debate on GitHub about how to alleviate this confusion at What should dotnet –version display?
March 7, 2017
Changes to EF Core With the RTM of VS2017 and Tools
When Visual Studio 2017 released today a few other things happened that are relevant to Entity Framework Core.
EF Core Migrations Tools Release
First – something we were prepared for – the .NET Core SDK was also released. It’s last stable version was 1.0.0-preview2-1-003137. It’s now simply 1.0.0. Along with this, it’s dependent tooling, including EF Core Tools for PowerShell and dotnet were also released. As the .NET Core support evolved from project.json to msbuild, the EF Core tools split . We have been using 1.0.0-preview4 (for .NET and project.json) and 1.0.0-msbuild3 for msbuild/csproj support.
Now the tool packages are 1.1.0 (Tools) and 1.0.0 (Tools.DotNet)
For PowerShell support: Microsoft.EntityFrameworkCore.Tools 1.1.0
For dotnet CLI support: Microsoft.EntityFrameworkCore.Tools.DotNet 1.0.0
In Visual Studio 2015 (for full .NET projects) and Visual Studio 2017 (shown here, for full .NET or .NET Core projects), the Package Manager will show the RTM versions:
Notice that I do not have “Include prerelease” checked.
If using PMC to install, it’s just
install-package Microsoft.EntityFrameworkCore.Tools
That’s for the PowerShell tools, otherwise, add .DotNet to the name.
But notice that you no longer need to add the –pre.
When using the CLI version of the tools, the command
dotnet ef –version
results in
Entity Framework Core .NET Command Line Tools 1.0.0-rtm-10308
Changes to Migrations Commands
As the tools evolved through the previews, some details changed for example, the scaffolding command got smarter.
But one change that is notable is with respect to EF Core in class libraries. You still need to point to an executable project (exe or test) to run most of the commands, but now you can at least just use “dotnet ef” to get the help file without having to set the –startup-project parameter. There are a few other commands that will run without knowledge of the startup project. You can read more about this in this GitHub thread. Check some of the later comments by Brice Lambson as he worked on evolving the commands.
EF Core 1.1.1 – Patch
This was a more subtle part of the release. Even though the 1.1.1 milestone on GitHub had 30 bug fixes that are all closed , there hadn’t been any mention that this was going to get pushed out and the milestone had no target date on it. Though I had my suspicions! Here’s a screenshot I happened to take on March 5.
And yes, the newest version of the EF Core packages is now 1.1.1. These are bug fixes …as the increment suggests. Most of them are edge cases, but regardless, you should definitely update your EF Core packages to ensure you have these latest fixes. If you’re creating new projects, 1.1.1 is what you’ll see available from NuGet.
March 4, 2017
Vermont .NET Birthday Cakes Throughout the Years
As Visual Studio prepares for the VS2017 launch and the 20th anniversary of Visual Studio, I started reminiscing of Vermont.NET birthdays of the past. Our first meeting was in February 2002. Here’s a screenshot (thanks to the way back machine!) from October 2002 of our hand-made (by yours truly) ASP.NET 1.0 website:
More fun though is the various cakes we’ve had throughout the years when we’ve celebrated the passing time.
First is the cake made by user group member Laura Blood for our Feb 2003 meeting, our first anniversary.
According to my blog, we had cake at our Feb 2006 meeting with special guest (thank you INETA), Ken Getz. I don’t seem to have a picture though.
Another was from our 6th year. We had a presentation on unit testing that night by Sarah Cameron who came down from Montreal.
2010 was our 8th year. We didn’t have cake for our Feb meeting but we DID for the April meeting which was the launch of Visual Studio 2010. Dave Burke designed this cake and it was implemented by the bakery at a local supermarket:
For our 10th year, the supermarket bakery suggested balloons and I asked for green ones in honor of Vermont. Many jokes have been made about this cake. I did NOT see the problem until someone pointed it out at the meeting. Then we were all giggling like school boys.
Rob Hale was quick to tweet it so I was able to find this picture easily enough!
Here was my own creation for Vermont.NET’s 12th anniversary in 2014. Notice that the sprinkles are dinosaurs.
I wasn’t here for our February 2017 meetup, but our upcoming March meetup will celebrate the VS2017 launch so I plan to make or get a cake to celebrate for sure!
February 27, 2017
Troubleshooting the dotnet ef command for EF Core Migrations
When using EF Core in a .NET Core app (ASP.NET Core or other app sitting on .NET core), it’s easy to run into a problem when attempting to use EF Core migrations at the command line. The most common one is
No executable found matching command "dotnet-ef"
In my EF Core course on Pluralsight, I chose to stick with VS 2015 for the .NET Core demos. VS2017 has the latest tooling and supports msbuild. But it was too bleeding edge (not even released) for my purposes — though I did demo with RC4 at the end of the course. VS2015 only supports project.json and the project templates set you up for .NET Core 1.0, not .NET Core 1.1. So in the course means that we’re stuck with project.json support and tooling that’s not quite aligned. But Pluralsight and I both agreed that it made sense not to ALSO force users to the bleeding edge, not even released VS2017 for the demos. The course’s focus is on EF Core, so as long as I could hand-hold users through the project.json setup stuff without the need to make them expert at that, it was the right way to go.
Of the nearly 2000 who have already watched the course since it’s release less than 2 weeks ago, a few people ran into some confusion with the versioning and getting the “no executable found” message. I worked through these with them but wanted to write down the suggestions I’d made and have a single blog post I could point to.
There are a few key things to watch out for.
The current stable tooling for EF Core migrations is split into two packages.
Microsoft.EntityFrameworkCore.Tools is for PowerShell
Microsoft.EntityFrameworkCore.Tools.DotNet is for the CLI (dotnet commands)
Make sure you’ve referenced the Tools.DotNet version of the package so that you have access to the CLI commands. If you’re following my course, that’s explained.
Make sure that you are running the command from the folder that contains the project where the Tools package is referenced. This is explained in the course demos, but still a step you may overlook in your excitement!
Make sure that you have the Tools package in the Tools section, not the dependencies section.
"tools": {
"Microsoft.EntityFrameworkCore.Tools.DotNet":
"1.1.0-preview4-final"
}
Make sure that the version of the EF Core tools you are using aligns with the version of .NET Core on your machine.
In my EF Core course, I’m using EF Core 1.1 and for EF tools, Microsoft.EntityFrameworkCore.Tools.DotNet 1.0.0-preview4.
You’ll need .NET Core 1.1 installed and the related SDK – which is not numbered as simply. Today the .NET Core SDK tools are still in preview so the version number of the current “stable” build that goes with .NET Core 1.1 is 1.0.0-preview2-1-001377. Note that on March 7 when VS2017 has its official release, the .NET Core SDK tools will also be released so the versions will just be normal numbers like 1.0.0.
With the “dotnet ef” command will tell you if you don’t have .NET Core 1.1 installed:
The specified framework 'Microsoft.NETCore.App', version '1.1.0' was not found.
- Check application dependencies and target a framework version installed at:
C:\Program Files\dotnet\shared\Microsoft.NETCore.App
- The following versions are installed:
1.0.1
- Alternatively, install the framework version '1.1.0'.
You can get the correct version via the download grid at microsoft.com/net/download/core. The grid only exposes stable releases. If you’re looking for nightly builds, there’s a link to those just below the grid.
The set of downloads you get via the LTS button is for .NET Core 1.0.3. The Current button gives you the latest stable versions. The SDK button gets you the Runtime + SDK. Whereas the Runtime button gives you ONLY the runtime.
I’m on windows 64bit, so selecting the Current, SDK for x64 is the path I want.
After it’s installed, typing dotnet will show you that you have the 1.1.0 version of .NET Core. dotnet –version gives you the version of the SDK. That should now be 1.0.0-preview2-1-001377,
If you installed this SDK but are still seeing the old SDK version (1.0.0-preview2-001313), that is likely because that version is specified in the global.json file of your solution. That shouldn’t create a problem for using the migration commands, but it’s a good idea to have the correct version listed in global.json.
Some additional tips for you!
Commands can only run from an executable/test project
In my Pluralsight EFCore course, I have the DbContext in its own class library project. So when running dotnet ef, after solving all of the above problems, you’ll get a new message which is just pointing out that the commands depend on an executable to run. That message looks like this:
Could not invoke this command on the startup project 'TestEFCore.Data'. This version of the Entity Framework Core .NET Command Line Tools does not support commands on class library projects in ASP.NET Core and .NET Core applications.
In my case, I wasn’t ready to add a UI or test to the solution, so I added a minimal console app just to cover this need. And it needs to reference the project with the DbContext. Once that’s sorted, you can use the —startup-project parameter of the dotnet ef command to point to that project. While I show all of this in my course, you can also see that in my MSDN Magazine article here: msdn.microsoft.com/magazine/mt742867
This will get a touch easier with the msbuild version of the EF Core tools. With the newer tooling, you’ll at least be able to run dotnet ef to get the command’s help without pointing to a startup-project, although to run sub commands, you’ll still need to specify the startup project.
Installing the EF Core Tools via Nuget in Visual Studio 2015
One of the viewers of the course reported a strange problem. He was able to add the EF Core Tools package in project.json and use the migrations from the CLI as expected. But if he attempted to add the package from the NuGet Package Manager or the Package Manager Console instead, he was back to the old ‘No executable found matching command “dotnet-ef”‘ error.
He finally noticed that there were errors when NuGet attempted to download the package. But in his IDE the errors were subtle, so he was unaware that the tools package was not installed. Here’s a screenshot he shared:
I figured out how to get myself into a similar bind and got a much more helpful error message:
Package 'Microsoft.EntityFrameworkCore.Tools.DotNet 1.1.0-preview4-final' uses features that are not supported by the current version of NuGet. To upgrade NuGet, see http://docs.nuget.org/consume/install....
Even though Visual Studio extension manager did not indicate an available update AND it listed my NuGet Package Manager version as 3.5 (the latest), I learned that the team responsible for this extension had temporarily stopped pushing notifications for updates! That change is noted in the “No Auto Updates” section of this blog post: http://blog.nuget.org/20161027/Announ...
So I had to explicitly download the latest VSIX (ignoring the fact that it seemed to have the same version # as the one I had installed!) from the NuGet distributions page. After installing that, it resolved the problem of installing the EF Core tools package from the Package Manager and Package Manager Console.
There’s a sneak peek at EF Core with msbuild in VS2017
A few people mentioned to me that they decided to go straight to VS2017 when working through the demos in the course. And they also said they were confused by some differences and had to do some research. I know for sure that one of these devs was kicking himself when I asked if he had watched the VS2017 demo I did at the end of the course before trying to VS2017 along with the early demos. (His answer was “umm, now you tell me!”) It’s listed in the table of contents for the course. So if you take a peek at that first, I think doing all the demos in VS2017 will be a lot easier!
Hope this helps!
February 15, 2017
Entity Framework Core: Getting Started on Pluralsight
I’m happy to share a new course on Pluralsight with you – Entity Framework Core: Getting Started.
Here’s how I described it in the trailer:
Most software – whether for business or entertainment – is driven by data that users need to interact with. In Entity Framework Core: Getting Started , you will learn how to use Microsoft’s modern data access platform, Entity Framework Core. You will learn how to build data models, use EF Core to bridge your software with your data store and how to incorporate all of this into desktop, mobile and web applications. When you’re finished with this course, you will have a foundational knowledge of Entity Framework Core that will help you as you move forward to build software in .NET, whether you are targeting Windows, OS X or Linux. Software required: Visual Studio 2015 or Visual Studio 2017.
Here is the list of modules in the course. You can see the titles of various clips in each module on Pluralsight.
36m 52s
42m 38s
30m 56s
44m 31s
38m 30s
32m 55s
29m 14s
24m 20s
37m 51s
To see the full list of my courses on Pluralsight, go to pluralsight.com/authors/julie-lerman
January 27, 2017
EF Core CLI Commands with VS2017 RC3
Visual Studio 2017 RC3 was released yesterday but unfortunately an install issue has take it back off the shelf for a brief period. Watch this space for the return of RC3!
But I did manage to get it installed and wanted to show you that the EF Core CLI commands are now working. If you’ve been playing with VS2017 RC and EF Core you may have run into the problem that the EF Core tooling package was not in sync yet with the MSBuild tooling for .NET Core. That’s fixed now and not only does it work but there’s a change that I’m really happy to see.
As always, I have my dbcontext in its own project. Here are the csproj contents for that project:
Notice that the DotNetCliToolReference is pointing to Microsoft.EntityFrameworkCore.Tools.DotNet . The dotnet and PowerShell commands are exposed in separate packages. With “.DotNet” is the package that has the CLI commands. Without “.DotNet” is the package that contains the PowerShell commands.
More importantly, the package version went from “1.1.0-preview4” to “1.0.0-msbuild3-final”. I can’t explain why we went from 1.1.0 down to 1.0.0 but this is the newer and correct package.
With that in place, I then open up a command prompt. I can use a regular one but I’m using a PowerShell command for a single benefit…that I can shorten the prompt. Here’s the command I did to trim most but not all of the path:
Remember that I’m pointed to the path of a class library. DotNet EF requires you to point to a path containing an executable in order to run the commands. However with the latest bits, you can get HELP without having to point to the executable. Thank you Brice Lambson. It was a little meta to have to figure that out because rather than just getting help from the command, you had to googlebing for help on how to get help. So here are a simple dotnet ef command to get top level dotnet ef help, followed by dotnet ef dbcontext to get help on the dbcontext sub-commands.
To run commands that depend on the APIs, you still have to point to a startup-project if you are running the commands from a class library. Here I’ve run the command to list the migrations in my project. I’ve only got one, sqlite-init.
January 20, 2017
Some Insights into Features (Besides EDMX) Being Dropped in the Move From EF6 to EF Core
I had written these details for my Pluralsight EF Core course (hopefully published at end of Jan 2017) but decided not to spend the time on this explanation. Instead, I’ll put it here and the course will have a link to this blog post! Clever, huh?
You’ve probably heard a lot about EF Core not bringing forward the designer based EDMX from EF Core and this a feature cut that I’ve heard the most feedback about. But there are other EF features that are also getting cut. these are not as worrisome to developers, based on my own experience and paying attention to response in social media but it’s important to be aware of the biggest of these cut features.
ObjectContext API
The first is the ObjectContext API. This was the original mechanism for EF’s change tracking and database interaction. Since EF4.1 was released with the DbContext in early 2011, Microsoft has recommended that all new projects use DbContext. The DbContext does the more cumbersome work of interacting with the ObjectContext. But the ObjectContext has remained a public API for backwards compatibility with EF4 and EF3.5 projects. Also, we could access the ObjectContext to do low level tasks if needed.
There will not be an ObjectContext API in EFcore. Rather than relying on the ObjectContext for metadata work, change tracking and database interaction, this low-level activity is being restructured and we’ll get at it directly from the DbContext. If you have old software that is still using the ObjectContext and you haven’t updated it by now, hopefully, you won’t want to update it to EFCore anyway. I wrote a 2 part article for MSDN magazine in 2014 that included guidance for moving ObjectContext code to DbContext if you think you may want to explore that.
Data Points : Tips for Updating and Refactoring Your Entity Framework Code Part 1
Data Points : Tips for Updating and Refactoring Your Entity Framework Code Part 2
Entity SQL
Entity SQL was the original string based querying SQL like language written for EF. By the time EF was first released, it had already embraced the also-new LINQ. ESQL is only usable with the ObjectContext API. I think I used to be one of the few people in the world who really knew how to use ESQL because I wrote about it extensively in my first EF book, giving it equal visibility as LINQ to Entities. In the 2nd edition, I had split the ESQL details out into their own chapter because by then it was clear that it was barely being used. I haven’t had any reason to use ESQL in many years. I’ve not heard of anyone using it either. So it is going to fade away along with the ObjectContext API and won’t be part of EFCore.
Edge-Case Mappings & the Original Metadata APIs
Entity Framework has allowed a lot of variations on mappings from your classes to your database objects and fields. It even let you combine many of these crazy mappings in one model. The EF team blog post highlights “for example you could have an inheritance hierarchy that combined TPH, TPT, and TPC mappings as well as Entity Splitting all in the same hierarchy.” It was possible because of the Metadata Workspace API. But building in this flexibility also meant that using that API was very complex, made query compilation difficult and for developers, discovering information about a model’s metadata has been very cumbersome.
So EFCore has a simpler metadata model which means some the truly edge case mappings won’t be achievable. This doesn’t mean things like inheritance will go away (although currently, EF Core only supports TPH), just the funky, rare mapping combinations.
MEST (Multiple Entities for a Single Type)
One single mapping technique that will go away is MEST. In all of my years of working with EF, I’ve never come across anyone who was taking advantage of it. It was only supported with EDMX and ObjectContext and the team decided not to try to bring it forward to the code-based model and DbContext for EFCore.
Automatic Migrations
Migrations are a critical technique for evolving a database schema from a code-based model. We’ve had two ways to use EF migrations – the default way which is to explicitly add migrations through the package manager console and then to apply those migrations using a variety of techniques. Another option has been to use automatic migrations that are worked out and executed on the fly at run time. Supporting automatic migrations caused a number of major headaches for migrations support overall. It forced migrations to store model snapshots directly in the database. This caused problems for developers using regular migrations – especially with source control. I’ve been in loops where I can’t add a migration because it thinks I need to apply one, but when I try to execute a migration it tells me I have to add one. I’m not the only one who has gotten all tangled up in some circular problems when trying to manage migrations. These problems will go away because EFCore will not attempt to automate migrations at all. You can read more about this in Brice Lambson’s blog posts about EFCore Migrations at design time. Brice is an engineer on the EF team.
So these are the most notable EF features that the team is not planning to implement at all in EFCore. Personally, I have not been using any of them ever or in a long time and I have guided my clients away from them as well. So if you are on that same path, you are well-positioned to use EF Core without having to worry about them.
January 8, 2017
EF Core, Postgres and the Camel-Cased Identity Tables
PostgreSQL doesn’t really like camel-case too much. I’m no expert but I know that at least.
I was doing yet another exploration of EF Core in Visual Studio Code on my MacBook. Usually I use JetBrain’s DataGrip (database IDE) to check out the actual data. But this time I wanted to play with the Visual Studio Code extension called “” which lets you interact with MySQL and PostgreSQL right in the IDE.
There are a bunch of database extensions in fact:
I’ve already been using the mssql extension to muck about with SQL Server data inside of VS Code:
As I was using a default web app from the template, ASP.NET Identity was involved and the context to manage identity inherits from Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityDbContext
And IdentityDbContext has fluent API code to explicitly map table names which are not the same as the entity’s they are mapping. And it makes those names all camel-cased.
DataGrip did not mind the camel cased identity table names but vscode-database didn’t comprehend the table names when it was reading the database to build Intellisense for the tooling. It’s anticipating lowercase and throwing exceptions when it hits the camelcased names. Shay Rojansky, who maintains the npgsql PostgreSQL providers for EF & EF Core, explained to me that if the tool simply placed quotes around the names, it would be okay.
For a temporary workaround, I wanted to just change them to lower case so I could reap the benefits of vscode-database extension.
Since the IdentityDbContext class creates the table names in its OnModelCreating override, I needed to change those names to lower case after the fact.
It’s easy enough to do if you know the right path through the APIs.
Here’s my DbContext class that handles Identity in my ASP.NET Core app. I’ve added the foreach clause to lower case the name after the base class (IdentityDbContext) has already changed the names.
I’m grabbing the ToTable name that was specified by ApplicationDbContext and then re-applying the name as lower case.
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using WebApplication.Models;
namespace WebApplication.Data {
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions options)
: base(options) {
}
protected override void OnModelCreating(ModelBuilder builder) {
base.OnModelCreating(builder);
// Customize the ASP.NET Identity model and override the defaults if needed.
// For example, you can rename the ASP.NET Identity table names and more.
// Add your customizations after calling base.OnModelCreating(builder);
//quick and dirty takes care of my entities not all scenarios
foreach (var entity in builder.Model.GetEntityTypes()) {
var currentTableName = builder.Entity(entity.Name).Metadata.Relational().TableName;
builder.Entity(entity.Name).ToTable(currentTableName.ToLower());
}
}
}
}
vscode-database has some cool features with Intellisense. It has some UX issues to work on (or maybe I need some training and I’ll raise an issue just in case) but it’s free and let’s you execute queries and commands on the database for those times you don’t need the bells and whistles of a full IDE .
November 22, 2016
Updated My EFCore / WebAPI / PostreSQL / XUnit Repo to 1.1
Today was dedicated to updating my long running repository sample that I started when EF Core was EF 7 to the newest version of EF Core: 1.1. Here is the updated repo: https://github.com/julielerman/EFCore....
Phase one of this update continues to use project.json.
In addition to updating the version #s of the Nuget package references, I also made some changes to the code to reflect a few new features.
Pay attention to the tooling packages. In the tools section, the package name has changed – note DotNet at the end – and the version is currently 1.0.0-preview3 even though IIS version is preview2.
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools":
"1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools.DotNet":
"1.0.0-preview3-final"
},
Also in the dependencies, the EFCore Design package is 1.1.0 like the rest of EFCore. That’s part of the EF APIs, not tooling.
Code changes ….
You’ll discover the DbSet.Find method and change tracker Load method in use in the repository class. These were both added in to EF Core 1.1.
I modified the WeatherEvent class to fully encapsulate its Reactions collection using the support for mapping to IEnumerable. That resulted in some changes to constructors and the addition of an AddReaction method and a local variable.
Unrelated to EF Core, I also modified the SeedData.cs class. It reads a hard coded seeddata.json file to read in seed data. That data used old dates. I wanted the data to show current dates to help me tell that I really and truly pushed new data into the database. Since the Date property of WeatherEvent is private, they way I went about this was to read the raw JSON and update the date value that way then save the raw JSON back to the original file. Then I deserialize the JSON with a current range of dates into a set of WeatherEvents. This also means that I added Delete/Create database back in so the database gets thrown away and recreated/reseeded every time you start up the application.
The tests are also update to use the latest packages. In addition to changing the versions, I had to add a reference to an older package (InternalServices) as its dependency has not yet been updated in xunit.
Here’s the full project.json for the test project since I had to do a bunch of googling to figure it out.
{
"version": "3.0.0-*",
"description": "Tests for simple app using aspnetcore, efcore and
postgresql. developed and run on OSX.",
"authors": [ "Julie Lerman" ],
"testRunner": "xunit",
"dependencies": {
"Microsoft.EntityFrameworkCore.InMemory": "1.1.0",
"src": "3.0.0",
"xunit": "2.2.0-beta4-build3444",
"dotnet-test-xunit": "2.2.0-preview2-build1029",
"Microsoft.DotNet.InternalAbstractions":"1.0.0"},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
}
},
"imports": [
"dnxcore50",
"portable-net45+win8"
]
}
}
}
I hope you find this repository useful to see EF Core 1.1 in action.
Oh and as per a tweet by Brad Wilson, I added SDK to my global.json file!
Pro-Tip: Your .NET Core projects should *always* have a global.json file with an SDK version in them.
ALWAYS.
— Brad Wilson (@bradwilson) November 21, 2016
Now I have to go learn about why this is important. Clearly it is!
Julia Lerman's Blog
- Julia Lerman's profile
- 18 followers
