Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新建项目后,按实际环境修改配置OSharp:DbContexts:[MySql]后,执行Update-Database报错 #272

Open
ZengOwen opened this issue Oct 20, 2021 · 2 comments

Comments

@ZengOwen
Copy link

PM> Update-Database
Build started...
Build succeeded.
OSharp.Exceptions.OsharpException: 无法解析类型为“MySql”的 OSharp.Entity.IDbContextOptionsBuilderDriveHandler 实例

是我哪里没做对吗

@gmf520
Copy link
Member

gmf520 commented Oct 20, 2021

应该是没引用 OSharpNS.EntityFrameworkCore.MySql

@ZengOwen
Copy link
Author

ZengOwen commented Oct 20, 2021

把Startup.cs 的 ConfigureServices 加上AddPack《MySqlDefaultDbContextMigrationPack》() 可以了

但是执行建立数据库时,依然报错
PM> Update-Database
Build started...
Build succeeded.
System.ArgumentException: An item with the same key has already been added. Key: OSharp.Entity.DefaultDbContext
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)

另外,如果自定义了个Controller, 其中实现了action及对应的url, 那么权限控制表里,会出现这个新的url吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants