Generic Add Method for Dynamic Parameters#963
Generic Add Method for Dynamic Parameters#963roend83 wants to merge 4 commits intoDapperLib:mainfrom
Conversation
|
Unfortunately this would be a breaking change. While we can add the generic versions, removing the previous ones is not an option until the next major release. Can you please add them back and a test that shows these fixing the issue? |
|
We actually noticed an issue with the missing non-generic Add methods and added them back. I'm fine adding a test for the generic methods. Can you tell me what I have to do to run the tests? |
|
@roend83 Ah yes, git is just doing a horrible job of diffing here - to run the tests just push :) Take advantage of the build server running them for you on this PR :) |
|
@NickCraver I added a couple tests that call the 2 new generic methods. Let me know if these look ok. |
NickCraver
left a comment
There was a problem hiding this comment.
Looking good to me, poking @mgravell for eyes as well.
| { | ||
| Name = name, | ||
| Value = value, | ||
| Type = value?.GetType() ?? typeof(T), |
There was a problem hiding this comment.
It feels like this should be typeof(T) always, since we're explicitly supplying the type information. In the case of a base type and a child type, T can be the base type and value can be of the child type in a valid generic call...so these can differ.
Thoughts?
|
@NickCraver & @mgravell Are there any plans to pull this in soon? |
|
Hey all, I just ran across this PR which looks to resolve an issue I've just run into: DateTime? dateParam = default;
var params = new { dateParam = dateParam };
var result = connection.ExecuteScalar<object>("SELECT 1 FROM table WHERE date = @dateParam", params);I'm using a Postgres database, and receive an exception: Of course this is a silly example, but it gets the point across. Are there any plans for this PR to make it into the code base soon? |
|
@NickCraver @mgravell |
Addresses #958