我在Windows 10上,使用Node 5.6.0和npm 3.6.0.我正在尝试将angular-material和mdi安装到我的工作文件夹中.npm install angular-material mdi错误:
+-- angular@1.5.0
+-- UNMET PEER DEPENDENCY angular-animate@^1.5.0
+-- UNMET PEER DEPENDENCY angular-aria@^1.5.0
+-- angular-material@1.0.6
+-- UNMET PEER DEPENDENCY angular-messages@^1.5.0 `-- mdi@1.4.57
npm WARN enoent ENOENT: no such file or directory, open
'C:\Users\xxxxx\Desktop\ngClassifieds\package.json'
npm WARN angular-material@1.0.6 requires a peer of
angular-animate@^1.5.0 but none was installed.
npm WARN angular-material@1.0.6 requires a peer of angular-aria@^1.5.0
but none was installed.
npm WARN angular-material@1.0.6 requires a peer of
angular-messages@^1.5.0 but none was installed.
Run Code Online (Sandbox Code Playgroud)
如何解决此问题以安装AngularJS Material和MDI?
我没有使用DI,只是想从我的控制器中调用DbContext.我正在努力弄清楚'选项'应该是什么?
ApplicationDbContext.cs
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public DbSet<Gig> Gigs { get; set; }
public DbSet<Genre> Genres { get; set; }
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> 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);
}
}
Run Code Online (Sandbox Code Playgroud)
GigsController.cs
public class GigsController : Controller
{
private ApplicationDbContext _context; …Run Code Online (Sandbox Code Playgroud) 关于如何获取当前登录用户的ID,这里有一堆不同的答案可以解决ASP.NET Core的不同RC问题.我想在这里问一个明确的问题.请注意,project.json现在有"Microsoft.AspNetCore.Identity.EntityFrameworkCore":"1.0.0"
使用RC1,您可以执行以下操作:
using Microsoft.AspNet.Identity;
using System.Security.Claims;
User.GetUserId();
Run Code Online (Sandbox Code Playgroud)
但是随着EF Core新发布的第1版,Microsoft.AspNet.Identity不是正确的版本.
有人建议使用UserManager,这对于获取当前登录的用户来说似乎很多:
private Task<ApplicationUser> GetCurrentUserAsync() => _userManager.GetUserAsync(HttpContext.User);
var user = await GetCurrentUserAsync();
var userId = user?.Id;
Run Code Online (Sandbox Code Playgroud)
我发现的另一种方法是:
private readonly UserManager<ApplicationUser> _userManager;
_userManager.GetUserId(User)
Run Code Online (Sandbox Code Playgroud)
使用ASP.NET Core 1 RTM和EF Core 1以及project.json中的以下库,获取当前登录用户的id的正确方法是什么?
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
Run Code Online (Sandbox Code Playgroud) 我有一个在 IIS Express 上运行的 asp.net 核心项目。如果我在浏览器中输入 localhost,URL(http://localhost:53142/和https://localhost:44374/)有效,但是,如果我输入我的 IPv4 IP 地址(192.168.1.72),它们就不起作用工作。
并排
我可以ping 192.168.1.72 地址就好了。
为什么我不能通过 ip 访问,我该怎么做?
我正在尝试在 Prism 7 中注册 DI 服务。我发现以下所有方法都有效,哪一个是正确的方法?各自的情况如何?
public class AndroidInitializer : IPlatformInitializer
{
static OpenAppService openAppService = new OpenAppService();
public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterInstance<IOpenAppService>(openAppService);
containerRegistry.Register<IFacebookLoginService, FacebookLoginService>();
containerRegistry.RegisterSingleton<IAppleSignInService, AppleSignInService>();
}
}
Run Code Online (Sandbox Code Playgroud) 有使用SQL命令执行SQL语句的EF Core等效方法吗?例如。我想通过内核中的迁移来“播种”我的数据库,以在UP方法中使用一些默认值:
public partial class PopulateGenresTable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
Sql("INSERT INTO Genres (Id, Name) VALUES (1, 'Jazz')");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
Run Code Online (Sandbox Code Playgroud) 我正在考虑在ASP.NET Core MVC应用程序中组织我的代码的最佳实践.我有两种类型的用户,医生和护士,最好的做法是在控制器/视图文件夹中的自己的医生和护士子文件夹中组织我的所有医生和护士控制器/视图吗?
控制器:
浏览次数:
原因是因为在每个Doctors/Nurses子文件夹级别,我想拥有自己的_viewstart文件的共享文件夹.
public string Index()
{
return View("~/Views/Doctors/Home/Index.cshtml");
}
Run Code Online (Sandbox Code Playgroud)
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "Doctors/{controller=Home}/{action=Index}/{id?}");
});
Run Code Online (Sandbox Code Playgroud)
_ViewStart.cshtml每个子文件夹都有不同
的内容.这项工作是否可以接受?asp.net-core ×5
angularjs ×1
c# ×1
iis-express ×1
networking ×1
node.js ×1
npm ×1
npm-install ×1
prism ×1