当前位置: 动力学知识库 > 问答 > 编程问答 >

entity framework 6 - EF6 Code First ODP.NET Parameters are objects

问题描述:

We just recently migrated one of our apps from EF4 model first to EF6 Code First using ODP.NET 12.1. We are seeing queries that previously used index lookups do full table scans. Our DBA has updated the statistics but the queries are still doing table scans. We see in the logs that the parameters are being passed as objects rather than as the native data types. Could this be causing the issue and how do we force EF/ODP.NET to type the parameters the same as the db column?

网友答案:

The issue is .NET treats strings as Unicode but our columns are VARCHAR so there is a type conversion that has to happen on each query which forces the database to do full table scans instead of using the indexes.

Our solution was to explicitly type the column as non-Unicode:

Property(p => p.VARCHAR_COLUMN).IsUnicode(false);
分享给朋友:
您可能感兴趣的文章:
随机阅读: