DEV Community

Discussion on: Build a Simple CRUD App with Angular 8 and ASP.NET Core 2.2 - part 1 - back-end

Collapse
 
cdthomp1 profile image
Cameron Thompson

Hello Martin,

This tutorial is great!

I am, however, getting stuck on the adding the migration section of this tutorial. When I type "Add-Migration Initial" the build starts then fails imminently.

Any ideas on what is causing this?

Thanks again!
Cameron

Collapse
 
cdthomp1 profile image
Cameron Thompson • Edited

So after some investigation, I changed line 35 of Startup.cs from "options.UseSqlServer(Configuration.GetConnectionString("BlogPostsContext")));" to "options.UseInMemoryDatabase(Configuration.GetConnectionString("BlogPostsContext")));" This allowed me to skip the section of doing "Add-Migrations Initial"

Collapse
 
dileno profile image
Martin Soderlund Ek

Thanks for sharing!

Installing these packages via Nuget might solve it too:

Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.SqlServer

Collapse
 
dileno profile image
Martin Soderlund Ek

Hi and thanks!

Does the solution build? Do you get any build errors?

I tried reproducing your error and could reproduce it when building an old version of this app (with url slugs actually) and got the same migration error. I also got build errors related to TypeScript and IteratorResult.

Then I used VS Code to run ng build in the ClientApp folder and got the following error:

ERROR in src/app/blog-post-add-edit/blog-post-add-edit.component.ts:8:27 - error TS2307: Cannot find module 'path'.

8 import { delimiter } from 'path';

I simply commented out this section in blog-post-add-edit.component.ts and ran ng build again and then building worked.

I finally ran ng serve (which builds and runs the ClientApp application) and then everything worked fine.