简体   繁体   中英

Dapper - pass whole entity as query parameter or anonymous object

I want to know if there are any recommendations with query parameters

Is it ok to pass the whole object or is it better to create a lightweight anonymous object with properties I need?

Query<SomeObj>("Select * from SomeObjs where Id = @Id", someObj);

or

Query<SomeObj>("Select * from SomeObjs where Id = @Id", new {someObj.Id});

Are there any performance or memory implications for one over other?

对于Dapper的工作方式,通过在首次使用时动态创建和缓存映射代码,就没关系了。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM