I'm trying to build an API to exploit data of an existing DB2 database for a company using asp.net . I want to use reverse engineering to create my models base on the existing database structure. I used the Scaffold-Dbcontext method with IBM.EntityFrameworkCore package and i got this error
Scaffold-DbContext "Server=CAMDLA20;Database=S21106ew;User=DB2READER;Password=DB2READER;Trusted_Connection=True;MultipleActiveResultSets=true" IBM.EntityFrameworkCore -OutputDir Models -Context DataBaseContext
Build started...
Build succeeded.
To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
System.ArgumentException: Invalid argument
at IBM.Data.Db2.DB2ConnPool.ReplaceConnectionStringParms(DB2Connection connection, String szValue, DB2ConnSettings& pSettings, DB2ConnSettingsInternal& pSettingsInternal, Boolean bAttach, Boolean pushDownStrAppended)
at IBM.Data.Db2.DB2Connection.set_ConnectionString(String value)
at IBM.Data.Db2.DB2Connection..ctor(String connectionString)
at IBM.EntityFrameworkCore.Scaffolding.Internal.Db2DatabaseModelFactory.Create(String connectionString, DatabaseModelFactoryOptions options)
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, DatabaseModelFactoryOptions databaseOptions, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions)
at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluralize)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String outputDbContextDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluralize)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Invalid argument
my questions are
- why did i get "invalid argument"? my DB2 informations are correct
- what are the valid argument for the Scaffold-Dbcontext using IBM.EntityFrameworkCore
- is there any other method to do reverse engineering with the IBM.EntityFrameworkCore Package?
------------------------------
Borel MBA
------------------------------