如何使用 'database first approach' 使用 Firebird 数据库实现 Entity Framework Core 3.1.2
How to implement Entity Framework Core 3.1.2 with Firebird database using 'database first approach'
我目前正在开发 .NET Core 3.1 Web API,它应该与 Firebird 数据库(storing/retrieving 数据)通信。我想使用 Microsoft.EntityFrameworkCore
3.1.2 处理该通信。 Entity Framework 对我来说是全新的,如果这个问题太简单,请原谅。但是我在网上找不到答案。
因为数据库真的很大我想使用 EF Core 自动生成我需要的所有模型。
我尝试在数据包管理器控制台中使用 Scaffold-DbContext
命令:
Scaffold-DbContext "user id=USER;password=PASSWORD;database=DATABASE;data source=SOURCE;port number=PORT;character set=UNICODE_FSS;pooling=False;server type=Default" FirebirdSql.EntityFrameworkCore.Firebird -OutputDir Models
Entity Framework Core 正在生成 Context.cs
但不是任何模型。
我必须指定要导入的模型吗?我该怎么做?
总结对 the question you posted on the firebird-net-provider group, support for scaffolding the model in EntityFrameworkCore is currently not available for Firebird. The improvement ticket for this is DNET-798 的回复。
您也可以将其用于 MSSQL:Scaffold-DbContext "Server=ServerName;Database=DBName;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir 模型。
对于 Firebird DB FirebirdSql.EntityFrameworkCore.Firebird 版本 7 不支持 DbContext。您应该为 Firebird 使用版本 8。
我目前正在开发 .NET Core 3.1 Web API,它应该与 Firebird 数据库(storing/retrieving 数据)通信。我想使用 Microsoft.EntityFrameworkCore
3.1.2 处理该通信。 Entity Framework 对我来说是全新的,如果这个问题太简单,请原谅。但是我在网上找不到答案。
因为数据库真的很大我想使用 EF Core 自动生成我需要的所有模型。
我尝试在数据包管理器控制台中使用 Scaffold-DbContext
命令:
Scaffold-DbContext "user id=USER;password=PASSWORD;database=DATABASE;data source=SOURCE;port number=PORT;character set=UNICODE_FSS;pooling=False;server type=Default" FirebirdSql.EntityFrameworkCore.Firebird -OutputDir Models
Entity Framework Core 正在生成 Context.cs
但不是任何模型。
我必须指定要导入的模型吗?我该怎么做?
总结对 the question you posted on the firebird-net-provider group, support for scaffolding the model in EntityFrameworkCore is currently not available for Firebird. The improvement ticket for this is DNET-798 的回复。
您也可以将其用于 MSSQL:Scaffold-DbContext "Server=ServerName;Database=DBName;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir 模型。
对于 Firebird DB FirebirdSql.EntityFrameworkCore.Firebird 版本 7 不支持 DbContext。您应该为 Firebird 使用版本 8。