小编kri*_*per的帖子

为什么我不能在Visual Studio 2015中创建共享项目?

我下载了2015年的visual studio社区.我试图创建一个共享项目并收到错误:

在此输入图像描述

来自Microsoft.Windows.UI.Xaml.CSharp.targets的内容

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup Condition="'$(TargetPlatformVersion)'==''">
        <TargetPlatformVersion>8.0</TargetPlatformVersion>
    </PropertyGroup>

    <PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP'">
        <RedirectionTarget>8.2</RedirectionTarget>
    </PropertyGroup>

    <PropertyGroup Condition="'$(RedirectionTarget)' == ''">
        <RedirectionTarget>$(TargetPlatformVersion)</RedirectionTarget>
    </PropertyGroup>

    <!-- Direct 8.0 projects to 8.1 targets to enable retargeting  -->
    <PropertyGroup Condition="'$(RedirectionTarget)' == '8.0'">
        <RedirectionTarget>8.1</RedirectionTarget>
    </PropertyGroup>

    <Import Project="$(RedirectionTarget)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
</Project>
Run Code Online (Sandbox Code Playgroud)

我没有名称为8.1的文件夹

c# visual-studio visual-studio-2015

27
推荐指数
4
解决办法
9776
查看次数

为什么EF导航属性返回null?

我有两个型号1)

public class Indicator
{
    public long ID { get; set; }
    public string Name { get; set; }
    public int MaxPoint { get; set; }
    public string Comment { get; set; }
    public DateTime DateChanged { get; set; }
    public DateTime DateCreated { get; set; }

    public virtual IList<CalculationType> CalculationTypes { get; set; }
    public virtual IList<TestEntity> TestEntitys { get; set; }
    public virtual IndicatorGroup IndicatorGroup { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

2)

public class CalculationType
{
    public long ID …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc entity-framework

10
推荐指数
3
解决办法
1万
查看次数

如何使用自定义IPasswordHasher?

我实现了IPasswordHasher

public class MyPasswordHasher : IPasswordHasher
{
    public string HashPassword(string password)
    {
        using (SHA256 mySHA256 = SHA256Managed.Create())
        {
            byte[] hash = mySHA256.ComputeHash(Encoding.UTF8.GetBytes(password.ToString()));

            StringBuilder hashSB = new StringBuilder();
            for (int i = 0; i < hash.Length; i++)
            {
                hashSB.Append(hash[i].ToString("x2"));
            }
            return hashSB.ToString();
        }
    }


    public PasswordVerificationResult VerifyHashedPassword(
      string hashedPassword, string providedPassword)
    {
        if (hashedPassword == HashPassword(providedPassword))
            return PasswordVerificationResult.Success;
        else
            return PasswordVerificationResult.Failed;
    }
}
Run Code Online (Sandbox Code Playgroud)

我在IdentityConfig中写道

manager.PasswordHasher = new MyPasswordHasher();
Run Code Online (Sandbox Code Playgroud)

var user = await UserManager.FindAsync(model.Email, model.Password);在AccountController/Login中不要使用MyPasswordHaser.

我怎样才能在身份2.1中使用它?

我的项目https://yadi.sk/d/NUL56SMccCtqd

c# asp.net asp.net-mvc asp.net-mvc-5

7
推荐指数
1
解决办法
3611
查看次数

HttpClient 不提供真正的异步操作吗?

我对异步 IO 操作感到困惑。在本文中中,Stephen Cleary 解释说我们不应该使用,Task.Run(() => SomeIoMethod())因为真正的异步操作应该使用

\n\n
\n

.NET 中的标准 P/Invoke 异步 I/O 系统

\n
\n\n

http://blog.stephencleary.com/2013/11/there-is-no-thread.html

\n\n
\n

但是,请避免在库中使用 \xe2\x80\x9c 伪造异步\xe2\x80\x9d。假异步是指组件具有异步就绪 API,但它只是通过将同步 API 包装在线程池线程中来实现。这对于 ASP.NET 的可扩展性来说会适得其反。假异步的一个突出例子是 Newtonsoft JSON.NET,这是一个优秀的库。最好不要调用(假)异步版本来序列化 JSON;只需调用同步版本即可。假异步的一个更棘手的例子是 BCL 文件流。当打开文件流时,必须显式打开它以进行异步访问;否则,它将使用假异步,同步阻塞\n线程池线程对文件的读写。

\n
\n\n

他建议使用 HttpClient 但内部使用Task.Factory.StartNew()\n在此输入图像描述

\n\n

这是否意味着它HttpClient不提供真正的异步操作?

\n

c# asp.net multithreading asynchronous async-await

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

如何最好地覆盖MVC 5中的身份验证?

我有一个没有注册的项目.管理员在admin中注册用户.该项目没有角色,我只有一种类型的用户.我不需要"AspNetRoles","AspNetUserClaims","AspNewUserLogins","AspNetUserRoles".在"AspNetUsers"表中我只需要"Id","Email","Password"和一些自定义属性.在mvc 5中实现这个的最佳方法是什么?

c# asp.net asp.net-mvc asp.net-mvc-5 asp.net-identity

3
推荐指数
1
解决办法
3325
查看次数