使用EntityFrameworkCore和Scaffold-DbContext命令从数据库反向工程实体框架模型时,我收到以下错误:
Npgsql.PostgresException(0x80000405):42703:column" start_value"不存在
为什么我收到此错误?不应该让Scaffold命令只给我数据库中的列吗?
编辑3/29/2017
这是Scaffold-DbContext错误:
Npgsql.PostgresException(0x80004005):42703:column" start_value"不存在
在Npgsql.NpgsqlConnector.DoReadMessage(DataRowLoadingMode dataRowLoadingMode,Boolean isPrependedMessage)
在Npgsql.NpgsqlConnector.ReadMessageWithPrepended(DataRowLoadingMode dataRowLoadingMode)
在Npgsql.NpgsqlConnector.ReadExpectingT
在Npgsql.NpgsqlDataReader.NextResultInternal()
在Npgsql.NpgsqlDataReader.NextResult()
在Npgsql.NpgsqlCommand.Execute(CommandBehavior行为)
在Npgsql.NpgsqlCommand.ExecuteDbDataReaderInternal(CommandBehavior行为)
在Npgsql.NpgsqlCommand.ExecuteReader()
在Microsoft.EntityFrameworkCore.Scaffolding.Internal.NpgsqlDatabaseModelFactory.GetSequences()
在Microsoft.EntityFrameworkCore.Scaffolding.Internal.NpgsqlDatabaseModelFactory.Create(DbConnection连接,TableSelectionSet tableSelectionSet)
在Microsoft.EntityFrameworkCore.Scaffolding.Internal.NpgsqlDatabaseModelFactory.Create(String connectionString,TableSelectionSet tableSelectionSet)
在Microsoft.EntityFrameworkCore.Scaffolding.RelationalScaffoldingModelFactory.Create(String connectionString,TableSelectionSet tableSelectionSet)
在Microsoft.EntityFrameworkCore.Scaffolding.Internal.NpgsqlScaffoldingModelFactory.Create(String connectionString,TableSelectionSet tableSelectionSet)
在Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineeringGenerator.GetMetadataModel(ReverseEngineeringConfiguration配置)
在Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineeringGenerator.GenerateAsync(ReverseEngineeringConfiguration配置,CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContextAsync(String provider,String connectionString,String outputDir,String dbContextClassName,IEnumerable 1 schemas, IEnumerable
1个表,Boolean useDataAnnotations,Boolean overwriteFiles,CancellationToken cancellationToken)
在Microsoft.EntityFrameworkCore.Design.OperationExecutor.d__22.MoveNext()
在System.Linq.Buffer 1..ctor(IEnumerable
1来源)
在System.Linq.Enumerable.ToArray [TSource](IEnumerable 1 source)
1.b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass4_0
在Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
42703:column&#34; start_value&#34;不存在
这是PostgresSQL的日志文件:
错误:列&#34; start_value&#34;字符58中不存在
声明:
SELECT
sequence_schema,sequence_name,data_type,start_value :: bigint,minimum_value :: bigint,maximum_value :: bigint,increment :: int,
例如,cycle_option =&#39;是&#39;然后是真的错误结束,
ownerns.nspname AS owner_schema,
tblcls.relname AS owner_table,
attname AS owner_column
来自information_schema.sequences
JOIN pg_namespace AS seqns ON seqns.nspname = sequence_schema
JOIN pg_class AS seqcls ON seqcls.relnamespace = seqns.oid AND seqcls.relname = sequence_name AND seqcls.relkind =&#39; S&#39;
LEFT OUTER JOIN pg_depend AS dep on dep.objid = seqcls.oid AND deptype =&#39; a&#39;
LEFT OUTER JOIN pg_class AS tblcls ON tblcls.oid = dep.refobjid
LEFT OUTER JOIN pg_attribute AS att ON attrelid = dep.refobjid AND attnum = dep.refobjsubid
LEFT OUTER JOIN pg_namespace AS所有者ON ownerns.oid = tblcls.relnamespace
由于