Comments (7)
Now we know the reason about this exception..
There is a missing parameter (migration executer) in constructor : Npgsql.EntityFrameworkCore.PostgreSQL/src/Npgsql.EntityFrameworkCore.PostgreSQL/Storage/Internal/NpgsqlDatabaseCreator.cs
I don't know how to solve it.. I will continue to read/understand..
from efcore.pg.
Hi!
@roji, I added the required parameter to the constructor. Do you think it may help ? I will compile it and test.
public NpgsqlDatabaseCreator(
[NotNull] NpgsqlRelationalConnection connection,
[NotNull] IMigrationsModelDiffer modelDiffer,
[NotNull] IMigrationsSqlGenerator migrationsSqlGenerator,
[NotNull] IMigrationCommandExecutor migrationCommandExecutor,
[NotNull] IModel model,
[NotNull] IRawSqlCommandBuilder rawSqlCommandBuilder)
: base(model, connection, modelDiffer, migrationsSqlGenerator, migrationCommandExecutor)
{
Check.NotNull(rawSqlCommandBuilder, nameof(rawSqlCommandBuilder));
_connection = connection;
_migrationsSqlGenerator = migrationsSqlGenerator;
_rawSqlCommandBuilder = rawSqlCommandBuilder;
}
from efcore.pg.
@sirentek thanks for diving into this!
I looked, and it seems that the additional parameter (the IMigrationCommandExecutor) isn't present in EFCore's release branch (which is rc2), only in dev (which is rc2), the precise commit where they added it is ce07379. So a mismatch has probably occurred - you're trying to use Npgsql's EFCore provider (which is rc2) with rc3 EFCore...
I've removed Microsoft's myget aspnetcidev feed to make sure that when compiling Npgsql.EFCore there's no rc3 anywhere, but the project.json already explicitly depends on -rc2- only, so this shouldn't be happening. Take a look at exactly which dependencies are being taken when you build your application, and please let me know!
from efcore.pg.
You are right. The sample uses float dependencies (1.0.0-*) in project.json. As a result all packages including entity framework used rc3 versions.
In my second test, I modified the NuGet.Config file of the sample as:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="AspNetRelease" value="https://www.myget.org/F/aspnetrelease/api/v3/index.json" />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="Npgsql" value="https://www.myget.org/F/npgsql-unstable/" />
</packageSources>
</configuration>
As you can see, I replaced the aspnetcidev with aspnetrelease. This time I didn't see any of rc3 versions during the restore.
After running dotnet ef run, it produced the following exception:
System.MissingMethodException: Method not found: 'Void Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator..ctor(Microsoft.EntityFrameworkCore.Metad
ata.IModel, Microsoft.EntityFrameworkCore.Storage.IRelationalConnection, Microsoft.EntityFrameworkCore.Migrations.IMigrationsModelDiffer, Microsoft.EntityFramew
orkCore.Migrations.IMigrationsSqlGenerator)'.
at Microsoft.EntityFrameworkCore.Storage.Internal.NpgsqlDatabaseCreator..ctor(NpgsqlRelationalConnection connection, IMigrationsModelDiffer modelDiffer, IMig
rationsSqlGenerator migrationsSqlGenerator, IModel model, IRawSqlCommandBuilder rawSqlCommandBuilder)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite.Invoke(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite.Invoke(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.ScopedCallSite.Invoke(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetService[T](IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.TransientCallSite.Invoke(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ConstructorCallSite.Invoke(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.TransientCallSite.Invoke(ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.EntityFrameworkCore.Design.MigrationsOperations.AddMigration(String name, String outputDir, String contextType)
at Microsoft.EntityFrameworkCore.Tools.Cli.MigrationsAddCommand.Execute(CommonOptions commonOptions, String name, String outputDir, String context, String st
artupProject, String environment, Action`1 reporter)
at Microsoft.EntityFrameworkCore.Tools.Cli.MigrationsAddCommand.<>c__DisplayClass0_0.<Configure>b__0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Cli.Program.Main(String[] args)
It seems, it is not an easy task for me to fix the constructor parameters. It ends up with dependency problems (rc2->rc3).
from efcore.pg.
Am not 100% sure about this, but I think you may still be using rc3 packages cached inside .nuget in your home directory... Can you try specifying rc2 explicitly in your project.json? Another option is deleting your .nuget dir and restoring again after having changed your NuGet.Config.
from efcore.pg.
Replaced all version names with explicit rc2 ones (1.0.0-rc2-*) in project.json.
Deleted all packages under home .nuget directory (more than 12GB).
Restored again (still using aspnetrelease feed in Nuget.Config.)
Error :
Unable to resolve 'Microsoft.EntityFrameworkCore.Tools (>= 1.0.0-rc2-3002543)' for '.NETCoreApp,Version=v1.0'.
I uninstalled my dotnet/cli (it was 1.0.0.2543) and installed the latest one (1.0.0.2697).
Again deleted all the packages under home .nuget directory.
Restored with success.
Migration files were created without any problem.
I login as admin and edit the records from the sample. It works like a charm!
Thanks @roji ! I am closing this issue.
from efcore.pg.
Ah, the pleasures of fighting with Microsoft prerelease software :)
Glad it worked out.
from efcore.pg.
Related Issues (20)
- Injecting a DBContext with AddDbContext and UseNpgsql causes it to remain in memory after the scope has been disposed of HOT 4
- GenerateNonNullSqlLiteral not supported on NpgsqlRowValueTypeMapping after ef core 8 upgrade HOT 2
- migration on changed includedPropertyNames for IsGeneratedTsVectorColumn creates up/down code in wrong order
- "integer out of range" error when using date_part in where clause with another conditional HOT 1
- Writing values of 'NpgsqlTypes.NpgsqlRange`1[[System.TimeSpan, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]][]' is not supported for parameters having NpgsqlDbType '-2147483608'. HOT 3
- Error : ''failure to parse near offset 7489. expected an ascii digit,, when runing from EF core .Net 8 HOT 2
- Error : ''failure to parse near offset 7489. expected an ascii digit,, when runing from EF core .Net 8 HOT 5
- Feature Request: protect connection string literal in memory HOT 2
- Support value conversion with generated properties HOT 4
- Running simultaneous queries on different DbContext instances leads to `NpgsqlOperationInProgressException` HOT 3
- Map User Defined Function return table value with parameter timestamp without time zone HOT 3
- Cannot rename system column "xmin" HOT 3
- Reverse engineering for view does not preserve nullability of columns HOT 4
- ISSUE: A PostgreSQL type with the oid '0' was not found in the current database info HOT 1
- SQL translation error when using LEFT JOIN in `Where` HOT 6
- Upgrading INpgsqlArrayConverter to PrimitiveCollection
- EF.Functions support for json_array_length HOT 2
- Npgsql.PostgresException (0x80004005): 42883: function st_contains(deployment.geometry, deployment.geometry) does not exist HOT 4
- ISet<EnumType>.Contains() does not translate in EF Core 8 HOT 1
- EF.Functions.JsonContains() occurs issue after upgrade to .net 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efcore.pg.