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 params object array overload to FromSql #1871

Merged
merged 1 commit into from
Mar 20, 2015
Merged

Add params object array overload to FromSql #1871

merged 1 commit into from
Mar 20, 2015

Conversation

mikary
Copy link
Contributor

@mikary mikary commented Mar 20, 2015

I'm thinking we can normalize the different options (params array, anonymous type, and Dictionary<string, object>) into a named parameter string in relational (where we have the extensions) and convert to the provider-specific format in the SqlQueryGenerator.

This is a first pass with just the FromSql(string, params object[]) extension
@anpete @divega

@ghost ghost added the cla-not-required label Mar 20, 2015

for (var index = 0; index < parameters.Count(); index++)
{
var parameterName = string.Format("P{0}", index);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: small "p"

@anpete
Copy link
Contributor

anpete commented Mar 20, 2015

Approach looks good.

@anpete
Copy link
Contributor

anpete commented Mar 20, 2015

:shipit:

@mikary mikary force-pushed the fromSqlParameters branch from 6c28b76 to d8d9706 Compare March 20, 2015 21:32
@@ -186,7 +186,20 @@ public virtual Expression VisitRawSqlDerivedTableExpression([NotNull] RawSqlDeri

using (_sql.Indent())
{
_sql.AppendLines(rawSqlDerivedTableExpression.Sql);
var substitutions = new List<string>();
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: You could make this an array as it is fixed size. Then you can avoid the alloc below.

@mikary mikary force-pushed the fromSqlParameters branch from d8d9706 to efb25d4 Compare March 20, 2015 21:50
@mikary mikary merged commit efb25d4 into dev Mar 20, 2015
@mikary mikary deleted the fromSqlParameters branch March 20, 2015 21:52
@mikary mikary mentioned this pull request Mar 20, 2015
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.

2 participants