我试图在Seed方法中添加一些ApplicationRoles,但是当我执行update-database时,我得到以下异常:
Running Seed method.
System.Runtime.Serialization.SerializationException: Type is not resolved for member ‘Oracle.ManagedDataAccess.Client.OracleException,Oracle.ManagedDataAccess,Version=4.121.2.0,Culture=neutral,PublicKeyToken=89b483f429c47342’.
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration,Boolean force)
at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__displayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Type is not resolved for member ‘Oracle.ManagedDataAccess.Client.OracleException,PublicKeyToken=89b483f429c47342’.
var roleStore = new RoleStore<IdentityRole>(context); var roleManager = new RoleManager<IdentityRole>(roleStore); if (!context.Roles.Any(r => r.Name == "USER")) { var role = new IdentityRole("USER"); roleManager.Create(role); }
update-database正在创建我的表而没有任何问题,它只是Seed方法有问题.
有没有人对这个问题有什么建议?
谢谢.
解决方法
C:\Windows\system32>cd E:\smn\packages\Oracle.ManagedDataAccess.12.1.021\lib\net40 C:\Windows\system32>e: E:\smn\packages\Oracle.ManagedDataAccess.12.1.021\lib\net40>"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil.exe" /i Oracle.ManagedDataAccess.dll Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.33440 copyright (c) Microsoft Corporation. All rights reserved. Assembly successfully added to the cache