开发者

Can NHibernate produce SQL that is not commented with param names?

开发者 https://www.devze.com 2023-03-08 17:42 出处:网络
Is it possible to configure NHibernate to not show the parameter names in comments, in the SQL it produces?

Is it possible to configure NHibernate to not show the parameter names in comments, in the SQL it produces?

E.g.

WHERE  s开发者_如何学编程hareclass1_.PeerGroupId in (1 /* @p0 */,8 /* @p1 */,7 /* @p2 */,10 /* @p3 */,
                                   20 /* @p4 */,2 /* @p5 */)

It makes the SQL very unreadable.


Try setting "use_sql_comments" to false. Using Fluent NHibernate's configuration:

var factory = Fluently.Configure()
                .Database(configurer)
                .Mappings(m =>  /* etc */)
                .ExposeConfiguration(configuration =>
                                     configuration
                                         .SetProperty(Environment.UseSqlComments, "false"))
                .BuildSessionFactory();
0

精彩评论

暂无评论...
验证码 换一张
取 消