小编fer*_*adz的帖子

使用CSS在glyphicon或font-awesome图标上绘制斜线

我想在字形图标上绘制一条斜线,或者从font-awesome中绘制一个图标.例如,我想在此图标上添加斜线,因为"​​没有wifi可用.

<i class="fa fa-signal"></i>
Run Code Online (Sandbox Code Playgroud)

我尝试用堆叠来做,但为此我需要一个斜线的图标.

<div class="fa-stack fa-lg">
    <i class="fa fa-signal fa-stack-1x"></i>
    <i class="fa fa-ban fa-stack-2x text-danger"></i>                
</div>
Wi-Fi
Run Code Online (Sandbox Code Playgroud)

是否有更简单的方法在信号图标上设置斜杠?

css font-awesome glyphicons

15
推荐指数
5
解决办法
1万
查看次数

如何暂时禁用EF 7上的实体验证?

在EF6上,可以暂时禁用实体验证:

context.Configuration.ValidateOnSaveEnabled = false;
context.SaveChanges();
context.Configuration.ValidateOnSaveEnabled = true;
Run Code Online (Sandbox Code Playgroud)

我们怎样才能在EF7中实现这一目标?

entity-framework entity-framework-core

5
推荐指数
1
解决办法
1289
查看次数

为dnx rc2运行MVC 6 ASP.NET 5本地化示例

我试图从这里运行AspNet5Localization示例项目https://github.com/damienbod/AspNet5Localization/tree/rc2

但是,当我打开解决方案时,会出现一个警告框:

您的解决方案需要DNX SDC版本dnx-clr-win-x86.1.0.0-rc2-16444,但未在此计算机上安装.你想现在安装吗?如果选择"否",则"dnx-clr-win-x86.1.0.0-rc1-update1"将用作此会话的解决方案DNX SDK版本.

我选择是.

然后出现另一个信息框:

DNX SDK版本dnx-clr-win-x86.1.0.0-rc2-16444无法安装.该解决方案将为此会话使用DNX SDK版本dnx-clr-win-x86.1.0.0-rc1-update1.

因为我已经安装了dnx-clr-win-x86.1.0.0-rc2-16357,所以我将"Soltion DNX SDK version"从项目属性更改为1.0.0-rc2-16357.

Active Version           Runtime Architecture OperatingSystem Alias
------ -------           ------- ------------ --------------- -----
       1.0.0-rc1-update1 clr     x64          win
       1.0.0-rc1-update1 clr     x86          win             default
       1.0.0-rc1-update1 coreclr x64          win
       1.0.0-rc1-update1 coreclr x86          win
       1.0.0-rc2-16357   clr     x86          win
Run Code Online (Sandbox Code Playgroud)

但是,无论此更改如何,都无法还原软件包.

我看到以下错误:

System.ArgumentException: More than one runtime.json file has declared imports for 'win7-x86'
Parameter name: runtimeName
   at Microsoft.Dnx.Tooling.RestoreCommand.FindRuntimeDependencies(String runtimeName, List`1 runtimeFiles, Dictionary`2 effectiveRuntimeSpecs, HashSet`1 allRuntimeNames, Func`2 circularImport)
   at Microsoft.Dnx.Tooling.RestoreCommand.FindRuntimeDependencies(String runtimeName, List`1 runtimeFiles, …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc localization asp.net-core-mvc asp.net-core

5
推荐指数
1
解决办法
1377
查看次数

Windows 上的 WireGuard:无法创建 Wintun 接口:注册环时出错:列出 NDIS 接口时出错:未找到接口

我已经在 Windows Server 2017 上安装了 WireGuard。当我通过客户端应用程序(管理器)激活隧道时,一切正常。重新启动计算机后,WireGuard 无法自动启动。日志包含以下错误:

[tun] [wg0] Unable to create Wintun interface: Error registering rings: Error listing NDIS interfaces: no interfaces found

我可以通过客户端应用程序显式/手动激活隧道,但如果机器重新启动,我需要隧道自动启动。

我将它安装在其他 Windows Server 2017 机器上,在这些机器上,WireGuard 会在系统启动时自动启动。

感谢您帮助解决机器启动时 WireGuard 自动启动的问题。

wireguard wintun

5
推荐指数
0
解决办法
2945
查看次数

获取当前在控制器构造函数ASP.NET 5 MVC6中登录的用户标识

在MVC5中,我通过覆盖Initialize控制器中的方法将当前登录用户的ID初始化为私有域.

public class BaseControllerConstructor: Constructor
{
    protected UserProfile _currentUserProfile;

    protected override void Initialize(RequestContext requestContext)
    {
        base.Initialize(requestContext);

        if (User.Identity.IsAuthenticated)
        {
            _currentUserId = User.Identity.GetUserId();
            _currentUserProfile = LoadUserProfile(_currentUserId);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

在MVC6控制器没有Initialize.

当我试图让当前登录的ID的用户在构造函数中,UserHttpContextnull.

public BaseControllerConstructor()
{
    // HttpContext is null      
    string _currentUserId = HttpContext.User.GetUserId();
    _currentUserProfile = LoadUserProfile(_currentUserId);
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能在MVC6中实现这一目标?具体来说:如何获取当前登录用户的用户ID并_currentUserIdBaseControllerConstructor?中初始化?

然后在Controller动作中调用:

class Controller: BaseControllerConstructor
{
    public ActionResult Action()
    {
        foo(_currentUserProfile);
    }       
}
Run Code Online (Sandbox Code Playgroud)

更新:我使用依赖注入解决了这个问题.请看下面的答案.

c# asp.net asp.net-core-mvc

2
推荐指数
1
解决办法
2707
查看次数