The name 'Configuration' does not exist in the current context
When registering the database context, if I have the code like that I get the error "The name 'Configuration' does not exist in the current context". Can anyone help?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: b34c4871-adc3-0d13-6f20-6f6ac1f65e91
- Version Independent ID: ea1742b3-808b-d449-3308-6847a9f339f9
- Content: Add a model to an ASP.NET Core Razor Pages app with Visual Studio Code
- Content Source: aspnetcore/tutorials/razor-pages-vsc/model.md
- Product: aspnet-core
- GitHub Login: @Rick-Anderson
- Microsoft Alias: riande
Add
using Microsoft.Extensions.Configuration;
BTW, why are you using VS Code and not VS?
Thanks for that. I am using vscode for other projects and I prefer it. VS seems to do a lot more (like automatically adding dependencies like this I guess) and I prefer to see a bit more explicitly what's going on
VS doesn't automatically add dependencies, it just tells you what you need to add so you don't need to open an issue :)
@Rick-Anderson landed here from a google search - which helped me solve my problem. I would encourage MS to actually see this as a problem. Having problems understanding what's going on using the command line tools for a tool that supposedly supports the command line and other setups / OSs... "use Visual Studio" isn't ideal.
Thanks for all your hard work. I am having fun playing around with .net on linux :).
I agree with the above comment. Microsoft behaves as platform exclusive and act like they don't. I would like to use whatever editor I choose to use.
Plus, in ASP.NET core 6; you get the method from the builder object like so: builder.Configuration.GetConnectionString("BloggingDatabase")
And this solution should've been easy to search, but I had to visit a couple links to find it.