Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for FromSql with DbParameter without name prefix #16362

Merged
merged 1 commit into from
Jul 1, 2019

Conversation

divega
Copy link
Contributor

@divega divega commented Jun 30, 2019

New variations of FromSqlRaw and FromSqlInterpolated specification tests take DbParameter without using a prefix in the name. E.g. "city" instead of "@city" and verify that the prefix is added automatically when the parameter name is added in-line in the SQL.

Also added SQL Server and SQLite overrides that assert the SQL.

Closes #14173

protected override DbParameter CreateDbParameter(string name, object value)
=> new SqliteParameter
{
ParameterName = name,
Value = value
};

private void AssertSql(params string[] expected)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed that so far we are not asserting SQL for other FromSql tests against SQLite. I can revert changes to this file if this is by design.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We assert SQL in Sqlite provider when we expect it to differ from SQL server. Like different server side functions for date time operations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. In this case there aren’t any differences, so I will remove for consistency.

protected override DbParameter CreateDbParameter(string name, object value)
=> new SqliteParameter
{
ParameterName = name,
Value = value
};

private void AssertSql(params string[] expected)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We assert SQL in Sqlite provider when we expect it to differ from SQL server. Like different server side functions for date time operations.

@divega divega force-pushed the divega-issue14173 branch from cf8701d to 5825d04 Compare July 1, 2019 04:53
@divega divega force-pushed the divega-issue14173 branch from 5825d04 to 5f2b7be Compare July 1, 2019 04:55
@divega divega merged commit 9e3b10d into master Jul 1, 2019
@ghost ghost deleted the divega-issue14173 branch July 1, 2019 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DbParameter naming convention for FromSql(FormattableString) broken in 2.2
3 participants