Questions tagged «asp.net-core-1.0»


8
如何在.NET Core中读取连接字符串?
我只想从配置文件中读取连接字符串,为此向我的项目中添加一个名称为“ appsettings.json”的文件,并在其上添加以下内容: { "ConnectionStrings": { "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet- WebApplica71d622;Trusted_Connection=True;MultipleActiveResultSets=true" }, "Logging": { "IncludeScopes": false, "LogLevel": { "Default": "Debug", "System": "Information", "Microsoft": "Information" } } } 在ASP.NET上,我使用了以下方法: var temp=ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; 现在如何在C#中读取“ DefaultConnection”并将其存储在.NET Core中的字符串变量中?


7
从ASP .Net Core 1.0.0-rc2-final交换为1.0.0时,JSON属性现在小写
我刚刚将项目从ASP .Net Core 1.0.0-rc2-final交换为1.0.0。由于JSON属性的大写,我们的网站和客户端已停止工作。例如,此行JavaScript现在失败 for (var i = 0; i < collection.Items.length; i++){ 因为控制器现在将数组称为“ items”而不是“ Items”。除了安装更新的软件包和编辑project.json文件外,我没有做任何更改。我尚未更改仍使用其属性的C#模型文件。 为什么ASP.Net Core控制器开始使用小写属性返回JSON?我该如何回到他们那里来纪念模型中属性名称的大小写?

13
找不到与命令“ dotnet-ef”匹配的可执行文件
我正在通过将ASP.Net Core RC2与Microsoft.EntityFramework.CoreSQLite一起使用来做项目示例。 我遵循了本教程:https : //damienbod.com/2015/08/30/asp-net-5-with-sqlite-and-entity-framework-7/ 但是,当我运行以下命令时: dotnet ef migrations add FirstMigration 我收到此错误: No executable found matching command "dotnet-ef" 这是我的project.json配置: { "dependencies": { "Microsoft.NETCore.App": { "version": "1.0.0-rc2-3002702", "type": "platform" }, "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final", "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final", "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-final", "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final", "Microsoft.Extensions.Logging": "1.0.0-rc2-final", "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final", "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final", "Microsoft.EntityFrameworkCore": "1.0.0-rc2-final", …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.