1
我奮力複製ASP.NET身份樣本爲2.0.x的測試包,因爲我不能創建一個類型化的UserManager。代碼-IdentityFactoryOptions - 無法解析符號語境
public class ApplicationUserManager : UserManager<ApplicationUser, int>
{
public ApplicationUserManager(IUserStore<ApplicationUser, int> store) : base(store)
{
}
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options)
{
var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(options.Context as ApplicationIdentityDbContext));
由於IdentityFactoryOptions類似乎不包含符號「Context」,因此不會編譯。
當我在檢查對象瀏覽器類,但是,它包含以下屬性 -
public Microsoft.Owin.IOwinContext Context { set; get; }
Member of Microsoft.AspNet.Identity.Owin.IdentityFactoryOptions<T>
public Microsoft.Owin.Security.DataProtection.IDataProtectionProvider DataProtectionProvider { set; get; }
Member of Microsoft.AspNet.Identity.Owin.IdentityFactoryOptions<T>
public Microsoft.AspNet.Identity.Owin.IIdentityFactoryProvider<T> Provider { set; get; }
Member of Microsoft.AspNet.Identity.Owin.IdentityFactoryOptions<T>
我可以看到和使用「DataProtectionProvider」和「供應商」屬性。鑑於這三者具有相同的訪問修飾符,阻止我查看和使用「Context」屬性的是什麼,以及我需要做些什麼才能使ASP.NET Identity示例與當前的軟件包測試版一起工作?
包版本 -
<package id="Microsoft.AspNet.Identity.Core" version="2.0.0-beta1-140211" targetFramework="net45" />
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.0.0-beta1-140211" targetFramework="net45" />
<package id="Microsoft.AspNet.Identity.Owin" version="2.0.0-beta1-140211" targetFramework="net45" />
<package id="Microsoft.Owin" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Host.SystemWeb" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Security" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Security.Cookies" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Security.OAuth" version="2.1.0" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
僅供參考,我已經刪除了項目中的「bin」目錄並重新啓動了Visual Studio和計算機。清潔/重建解決方案也沒有區別。 – pwdst