本文整理汇总了C#中QueryParameters类的典型用法代码示例。如果您正苦于以下问题:C# QueryParameters类的具体用法?C# QueryParameters怎么用?C# QueryParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
QueryParameters类属于命名空间,在下文中一共展示了QueryParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DirectUserToServiceProvider
public void DirectUserToServiceProvider()
{
UriBuilder ub = new UriBuilder(provider.UserLoginEndpoint);
try
{
QueryParameters oauthParams = new QueryParameters();
oauthParams.Add("client_id", provider.Consumerkey);
oauthParams.Add("redirect_uri", connectionToken.ProviderCallbackUrl);
oauthParams.Add("response_type", "code");
oauthParams.Add("scope", provider.GetScope());
//ub.SetQueryparameter("client_id", provider.Consumerkey);
//ub.SetQueryparameter("redirect_uri", connectionToken.ProviderCallbackUrl);
//ub.SetQueryparameter("response_type", "code");
//ub.SetQueryparameter("scope", provider.GetScope());
BeforeDirectingUserToServiceProvider(oauthParams);
logger.Debug("Redirecting user for login to " + ub.ToString() + "?" + oauthParams.ToEncodedString());
SocialAuthUser.Redirect(ub.ToString() + "?" + oauthParams.ToEncodedString());
}
catch (Exception ex)
{
logger.Error(ErrorMessages.UserLoginRedirectionError(ub.ToString()), ex);
throw new OAuthException(ErrorMessages.UserLoginRedirectionError(ub.ToString()), ex);
}
}
示例2: GetLoginUrl
public override string GetLoginUrl(string returnUrl)
{
var oauthParameters = new QueryParameters();
string processedUrl = "";
if(string.IsNullOrEmpty(provider.UserLoginEndpoint))
PerformDiscovery();
oauthParameters.Add("openid.ns", "http://specs.openid.net/auth/2.0");
oauthParameters.Add("openid.claimed_id", "http://specs.openid.net/auth/2.0/identifier_select");
oauthParameters.Add("openid.identity", "http://specs.openid.net/auth/2.0/identifier_select");
oauthParameters.Add("openid.return_to", returnUrl);
oauthParameters.Add("openid.realm", ConnectionToken.Domain);
oauthParameters.Add("openid.mode", "checkid_setup");
oauthParameters.Add("openid.ns.pape", "http://specs.openid.net/extensions/pape/1.0");
oauthParameters.Add("openid.ns.max_auth_age", "0");
oauthParameters.Add("openid.ns.ax", "http://openid.net/srv/ax/1.0");
oauthParameters.Add("openid.ax.mode", "fetch_request");
oauthParameters.Add("openid.ax.type.country", "http://axschema.org/contact/country/home");
oauthParameters.Add("openid.ax.type.email", "http://axschema.org/contact/email");
oauthParameters.Add("openid.ax.type.firstname", "http://axschema.org/namePerson/first");
oauthParameters.Add("openid.ax.type.language", "http://axschema.org/pref/language");
oauthParameters.Add("openid.ax.type.lastname", "http://axschema.org/namePerson/last");
oauthParameters.Add("openid.ax.required", "country,email,firstname,language,lastname");
//ADDING OAUTH PROTOCOLS
oauthParameters.Add("openid.ns.oauth", "http://specs.openid.net/extensions/oauth/1.0");
oauthParameters.Add("openid.oauth.consumer", provider.Consumerkey);
BeforeDirectingUserToServiceProvider(oauthParameters);
processedUrl = oauthParameters.ToEncodedString();
return provider.UserLoginEndpoint + "?" + processedUrl;
}
示例3: PerformExecuteUpdate
// DONE : H3.2 Executable query (now can be supported for named SQL query/ storedProcedure)
public int PerformExecuteUpdate(QueryParameters queryParameters, ISessionImplementor session)
{
CoordinateSharedCacheCleanup(session);
if (queryParameters.Callable)
{
throw new ArgumentException("callable not yet supported for native queries");
}
RowSelection selection = queryParameters.RowSelection;
int result;
try
{
var parametersSpecifications = customQuery.CollectedParametersSpecifications.ToList();
SqlString sql = ExpandDynamicFilterParameters(customQuery.SQL, parametersSpecifications, session);
// After the last modification to the SqlString we can collect all parameters types.
parametersSpecifications.ResetEffectiveExpectedType(queryParameters);
var sqlParametersList = sql.GetParameters().ToList();
SqlType[] sqlTypes = parametersSpecifications.GetQueryParameterTypes(sqlParametersList, session.Factory);
IDbCommand ps = session.Batcher.PrepareCommand(CommandType.Text, sql, sqlTypes);
try
{
if (selection != null && selection.Timeout != RowSelection.NoValue)
{
// NH Difference : set Timeout for native query
ps.CommandTimeout = selection.Timeout;
}
foreach (IParameterSpecification parameterSpecification in parametersSpecifications)
{
parameterSpecification.Bind(ps, sqlParametersList, queryParameters, session);
}
result = session.Batcher.ExecuteNonQuery(ps);
}
finally
{
if (ps != null)
{
session.Batcher.CloseCommand(ps, null);
}
}
}
catch (HibernateException)
{
throw;
}
catch (Exception sqle)
{
throw ADOExceptionHelper.Convert(session.Factory.SQLExceptionConverter, sqle,
"could not execute native bulk manipulation query:" + sourceQuery);
}
return result;
}
示例4: TestInlineSimpleQuery
public void TestInlineSimpleQuery()
{
var query = new QueryParameters<Artist>();
query.Add("artist", "\"rolling stones\" OR jagger");
Assert.AreEqual("artist:(\"rolling stones\" OR jagger)", query.ToString());
}
示例5: AddQueryNameAlreadyExistsTest
public void AddQueryNameAlreadyExistsTest()
{
var parameters = new QueryParameters { Name = "Test" };
parameters.Fields.Add(new QueryField { Value = 6606 });
_model.AddQuery(parameters);
_model.AddQuery(parameters);
}
示例6: QueryDialog
public QueryDialog()
{
InitializeComponent();
SetupDataGridViewColumns();
dataGridView1.CellValueChanged += dataGridView1_CellValueChanged;
Query = new QueryParameters();
}
示例7: TestNegateSimpleQuery
public void TestNegateSimpleQuery()
{
var query = new QueryParameters<Artist>();
query.Add("arid", "1", true);
Assert.AreEqual("NOT arid:1", query.ToString());
}
示例8: HistoryPresenterModel_AddQuery_NameAlreadyExists_Test
public void HistoryPresenterModel_AddQuery_NameAlreadyExists_Test()
{
var parameters = new QueryParameters { Name = "Test" };
parameters.Fields.Add(new QueryField { Value = 6606 });
_model.AddQuery(parameters);
Assert.Throws<ArgumentException>(() => _model.AddQuery(parameters));
}
示例9: AccessTokenRequestError
public static string AccessTokenRequestError(string url, QueryParameters collection)
{
string message = "An error occurred while requesting Access Token at " + url;
if (collection != null)
if (collection.Count > 0)
message += Environment.NewLine + "with parameters " + collection.ToString();
return message;
}
示例10: TestAlreadyQuotedSimpleQuery
public void TestAlreadyQuotedSimpleQuery()
{
var query = new QueryParameters<Artist>();
query.Add("artist", "\"rolling stones\"");
Assert.AreEqual("artist:\"rolling stones\"", query.ToString());
}
示例11: TestNegateMultiQuery
public void TestNegateMultiQuery()
{
var query = new QueryParameters<Artist>();
query.Add("artist", "stones");
query.Add("tag", "rock", true);
Assert.AreEqual("artist:stones AND NOT tag:rock", query.ToString());
}
示例12: TestInlineMultiQuery
public void TestInlineMultiQuery()
{
var query = new QueryParameters<Artist>();
query.Add("artist", "\"rolling stones\" OR jagger");
query.Add("tag", "rock", true);
Assert.AreEqual("artist:(\"rolling stones\" OR jagger) AND NOT tag:rock", query.ToString());
}
示例13: LoginCallback
//Called After Directing User
public override void LoginCallback(QueryParameters responseCollection, Action<bool, Token> AuthenticationCompletionHandler)
{
HandleAuthorizationCode(responseCollection); //(C)
RequestForAccessToken(AccessTokenRequestType); // (D)
//HandleAccessTokenResponse(response); //(E) Handled from above
logger.Info("OAuth2.0 server side Authorization flow ends ..");
//Authentication Process is through. Inform Consumer.
AuthenticationCompletionHandler(isSuccess, ConnectionToken); // Authentication process complete. Call final method
}
示例14: PerformExecuteUpdate
// DONE : H3.2 Executable query (now can be supported for named SQL query/ storedProcedure)
public int PerformExecuteUpdate(QueryParameters queryParameters, ISessionImplementor session)
{
CoordinateSharedCacheCleanup(session);
if (queryParameters.Callable)
{
throw new ArgumentException("callable not yet supported for native queries");
}
RowSelection selection = queryParameters.RowSelection;
int result;
try
{
queryParameters.ProcessFilters(customQuery.SQL, session);
SqlString sql = queryParameters.FilteredSQL;
SqlType[] sqlTypes = queryParameters.PrepareParameterTypes(sql, session.Factory, GetNamedParameterLocs, 0, false, false);
IDbCommand ps = session.Batcher.PrepareCommand(CommandType.Text, sql, sqlTypes);
try
{
if (selection != null && selection.Timeout != RowSelection.NoValue)
{
// NH Difference : set Timeout for native query
ps.CommandTimeout = selection.Timeout;
}
// NH Different behavior:
// The inital value is 0 (initialized to 1 in JAVA)
// The responsibility of parameter binding was entirely moved to QueryParameters
// to deal with positionslParameter+NamedParameter+ParameterOfFilters
queryParameters.BindParameters(ps, 0, session);
result = session.Batcher.ExecuteNonQuery(ps);
}
finally
{
if (ps != null)
{
session.Batcher.CloseCommand(ps, null);
}
}
}
catch (HibernateException)
{
throw;
}
catch (Exception sqle)
{
throw ADOExceptionHelper.Convert(session.Factory.SQLExceptionConverter, sqle,
"could not execute native bulk manipulation query:" + sourceQuery);
}
return result;
}
示例15: GetLoginUrl
public override string GetLoginUrl(string returnUrl)
{
if(string.IsNullOrEmpty(ConnectionToken.RequestToken))
RequestForRequestToken();
var oauthParameters = new QueryParameters
{
new QueryParameter("oauth_token", ConnectionToken.RequestToken)
};
BeforeDirectingUserToServiceProvider(oauthParameters);
return provider.UserLoginEndpoint + "?" + oauthParameters.ToString();
}