问题
When I do an update-database
and an error happens at the database I get:
System.Runtime.Serialization.SerializationException: Type is not resolved for member 'Npgsql.NpgsqlException,Npgsql, Version=2.2.5.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7'.
Its trying to tell me about an error but I presume it can't find the exception type its trying to wrap it in so I'm left guessing at my mistake.
I'm using version 2.2.5.0 Npgsql.EntityFramework which is currently the latest version.
回答1:
This is an open bug on the Npgsql issue tracker:
https://github.com/npgsql/npgsql/issues/714
回答2:
You need to enable Copy Local for Nogsql assembly in the project and optionally also add it to GAC.
回答3:
I came across this issue before. In my case, I had 3 migrations that was created when using SQLServer. When I changed the database to PostgreSql and run update-database, this error showed up.
My Solution was delete all migration scripts, execute Add-Migration, and then the update-database worked just fine.
Hope this will help
来源:https://stackoverflow.com/questions/29852359/npgsql-cant-find-npgsqlexception-when-doing-migrations