英文:
A way to configure Entity Framework Core to use brackets instead of quotes for identifiers?
问题
我试图使用EF Core 7和Oracle.EntityFrameworkCore提供程序连接到Oracle数据库。
显然,所有查询中的标识符都是使用双引号引用的(例如,"Schema"."Table"),这在Oracle中意味着它们是区分大小写的。对于我正在进行的特定项目,我更喜欢使用方括号(例如,[Schema].[Table]),这是不区分大小写的。
是否有一种配置方式可以实现这一点?
英文:
I'm trying to connect to an Oracle database using EF Core 7 and the Oracle.EntityFrameworkCore provider.
Apparently, identifiers in all the queries are quoted using double quotes (e.g. "Schema"."Table"), which on Oracle means that they are case-sensitive. For this specific project I'm working on, I'd prefer to use brackets (e.g. [Schema].[Table]), which are case-insensitive.
Is there a way to configure this?
答案1
得分: 2
Oracle RDBMS不支持括号语法,因此生成括号将导致在数据库解析时生成无效查询。
您可以使用带引号的标识符 "schema"."table",它们区分大小写,或者不带引号的标识符 schema.table,它们实际上是不区分大小写的,因为SQL引擎会隐式将它们转换为大写(所以与使用 "SCHEMA"."TABLE" 相同)。
有关标识符和命名规则的更多信息,您可以查看Database Object Names and Qualifiers 文档。
英文:
Oracle RDBMS does not support the bracket syntax so generating brackets would result in invalid queries when they are parsed by the database.
You either use quoted identifiers "schema"."table", which are case-senstive, or unquoted identifiers schema.table, which are effectively case-insensitive as the SQL engine will implicitly convert them to upper-case (so it is the same as using "SCHEMA"."TABLE").
For more information on identifiers and naming rules you can look at the Database Object Names and Qualifiers documentation.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论