firebird 4 scaffolding error

119 views
Skip to first unread message

Tibor Vatai

unread,
Feb 17, 2023, 3:54:22 AM2/17/23
to firebird-net-provider
Hello,

I am using FirebirdSql.EntityFramworkCore.Firebird (9.1.1) in a .NET 6 (6.0.4) Microsoft.EntityFrameworkCore (7.0.3)
I would like to scaffolding, but i get error.

What i've tried:
dotnet ef dbcontext scaffold "User Id=sysdba;Password=masterkey;Data Source=127.0.0.1;Database=employee;port=3051"  FirebirdSql.EntityFrameworkCore.Firebird -o Models

The error message:
System.MissingMethodException: Method not found: 'System.Collections.Generic.IEnumerable`1<Microsoft.EntityFrameworkCore.Metadata.IColumnMapping> Microsoft.EntityFrameworkCore.Metadata.IColumn.get_PropertyMappings()'

I welcome any ideas.

Thank you very much and kind regards,
Tibor

Jiří Činčura

unread,
Feb 17, 2023, 3:56:27 AM2/17/23
to 'Mr. John' via firebird-net-provider

Marcel Lorenz

unread,
Nov 24, 2023, 10:04:21 AM11/24/23
to firebird-net-provider
The provider version 10.0.0 is now published but the error still occurs:

System.MissingMethodException: Method not found: 'System.Collections.Generic.IEnumerable`1<Microsoft.EntityFrameworkCore.Metadata.IColumnMapping> Microsoft.EntityFrameworkCore.Metadata.IColumn.get_PropertyMappings()'.
   at FirebirdSql.EntityFrameworkCore.Firebird.Metadata.Internal.FbRelationalAnnotationProvider.For(IColumn column, Boolean designTime)+MoveNext()
   at Microsoft.EntityFrameworkCore.Infrastructure.AnnotatableBase.AddAnnotations(AnnotatableBase annotatable, IEnumerable`1 annotations)
   at Microsoft.EntityFrameworkCore.Infrastructure.AnnotatableBase.AddAnnotations(IEnumerable`1 annotations)
   at Microsoft.EntityFrameworkCore.Metadata.Internal.RelationalModel.Create(IModel model, IRelationalAnnotationProvider relationalAnnotationProvider, IRelationalTypeMappingSource relationalTypeMappingSource, Boolean designTime)
   at Microsoft.EntityFrameworkCore.Metadata.Internal.RelationalModel.Add(IModel model, IRelationalAnnotationProvider relationalAnnotationProvider, IRelationalTypeMappingSource relationalTypeMappingSource, Boolean designTime)
   at Microsoft.EntityFrameworkCore.Infrastructure.RelationalModelRuntimeInitializer.InitializeModel(IModel model, Boolean designTime, Boolean prevalidation)
   at Microsoft.EntityFrameworkCore.Infrastructure.ModelRuntimeInitializer.Initialize(IModel model, Boolean designTime, IDiagnosticsLogger`1 validationLogger)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.Create(DatabaseModel databaseModel, ModelReverseEngineerOptions 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)
Method not found: 'System.Collections.Generic.IEnumerable`1<Microsoft.EntityFrameworkCore.Metadata.IColumnMapping> Microsoft.EntityFrameworkCore.Metadata.IColumn.get_PropertyMappings()'.

Executed command:

dotnet-ef dbcontext scaffold "User=user; Password=password; Database=C:\path\to\db\DB.FDB; DataSource=server; Port=3050; Pooling=true;" FirebirdSql.EntityFrameworkCore.Firebird -o C:\path\to\models --context-dir C:\path\to\context -n Namespace.Models --context-namespace Namespace.Contexts -c DbContext --framework net7.0 --no-onconfiguring --no-build --force

Jiří Činčura

unread,
Nov 26, 2023, 4:24:48 AM11/26/23
to 'Mr. John' via firebird-net-provider
Works for me without an issue.

```
$ dotnet ef dbcontext scaffold "User=sysdba;Password=masterkey;Database=localhost:test.fdb" FirebirdSql.EntityFrameworkCore.Firebird
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 http://go.microsoft.com/fwlink/?LinkId=723263.

~\source\repos\ConsoleApp3\ConsoleApp3
$ cat .\ConsoleApp3.csproj
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FirebirdSql.EntityFrameworkCore.Firebird" Version="10.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
```

Marcel Lorenz

unread,
Nov 27, 2023, 7:05:35 AM11/27/23
to firebird-net-provider
Which version of firebird do you use in the test database? Our Database is Firebird 3.0.9 and it does not work as shown above. Neither using net.7.0 or net8.0:

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<LangVersion>11</LangVersion>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;PROD;TEST;LOCAL</Configurations>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CliWrap" Version="3.6.0" />
<PackageReference Include="CommandLineParser" Version="2.9.0-preview1" />
<PackageReference Include="EntityFrameworkCore.Scaffolding.Handlebars" Version="7.0.0" />

<PackageReference Include="FirebirdSql.EntityFrameworkCore.Firebird" Version="10.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.10" />

<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
</ItemGroup>

</Project>

Jiří Činčura

unread,
Nov 27, 2023, 8:03:57 AM11/27/23
to 'Mr. John' via firebird-net-provider
Firebird 4, but server version is not important regarding the exception you posted.

Marcel Lorenz

unread,
Nov 27, 2023, 8:13:21 AM11/27/23
to firebird-net-provider
With the consent of Mr. Heymann from Consic Software Engineering I will send you an SQL script to create the database schema of Consic CAPS. Can you please try to reproduce the error using this schema and the project config I shared?

Jiří Činčura

unread,
Nov 27, 2023, 8:16:00 AM11/27/23
to 'Mr. John' via firebird-net-provider
> With the consent of Mr. Heymann from Consic Software Engineering I will
> send you an SQL script to create the database schema of Consic CAPS.
> Can you please try to reproduce the error using this schema and the
> project config I shared?

Sure.

Jiří Činčura

unread,
Jan 14, 2024, 8:33:02 AMJan 14
to 'Mr. John' via firebird-net-provider
> With the consent of Mr. Heymann from Consic Software Engineering I will
> send you an SQL script to create the database schema of Consic CAPS.
> Can you please try to reproduce the error using this schema and the
> project config I shared?

The script you provided completed with some errors, but I see some structure created. But even with your script, the scaffolding completed without exception and I see about 30 entities generated. I've sent you the output privately.
Reply all
Reply to author
Forward
0 new messages