In sqlserver DB, for the string, we have types: NVARCHR, VARCHAR.
In mapping class, if you use default set the type to "string" but the column type is varchar in DB, that will cause a transfer in DB side when searching comparing, if unfortunately you have a huge data in the table, the DB transer will be more huge, it will deadblock you DB.
To solve it if in DB its type is VARCHAR, in Mapping class should use:
[Property(Type = "AnsiString")] instead.

本文探讨了在SQL Server中VARCHAR类型与映射类中字符串类型的匹配问题。当映射类默认使用string类型而数据库字段为VARCHAR时,可能会导致搜索对比时的数据传输增加,甚至造成数据库死锁。为了避免这一问题,文章建议在映射类中使用[Property(Type= AnsiString)]来对应数据库中的VARCHAR类型。
3367

被折叠的 条评论
为什么被折叠?



