本文整理汇总了C#中QueryParameters类的典型用法代码示例。如果您正苦于以下问题:C# QueryParameters类的具体用法?C# QueryParameters怎么用?C# QueryParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueryParameters类属于命名空间,在下文中一共展示了QueryParameters类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:ranade80,项目名称:Authorization-Samples,代码行数:25,代码来源:OAuth2_0Server.cs
示例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;
}
开发者ID:tamilstreetboy,项目名称:socialauth-net,代码行数:33,代码来源:OAuth1_0Hybrid.cs
示例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;
}
开发者ID:ggeurts,项目名称:nhibernate-core,代码行数:60,代码来源:NativeSQLQueryPlan.cs
示例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());
}
开发者ID:mikgam,项目名称:MusicBrainz,代码行数:8,代码来源:QueryParametersTests.cs
示例5: AddQueryNameAlreadyExistsTest
public void AddQueryNameAlreadyExistsTest()
{
var parameters = new QueryParameters { Name = "Test" };
parameters.Fields.Add(new QueryField { Value = 6606 });
_model.AddQuery(parameters);
_model.AddQuery(parameters);
}
开发者ID:kszysiu,项目名称:hfm-net,代码行数:8,代码来源:HistoryPresenterModelTests.cs
示例6: QueryDialog
public QueryDialog()
{
InitializeComponent();
SetupDataGridViewColumns();
dataGridView1.CellValueChanged += dataGridView1_CellValueChanged;
Query = new QueryParameters();
}
开发者ID:kszysiu,项目名称:hfm-net,代码行数:8,代码来源:QueryDialog.cs
示例7: TestNegateSimpleQuery
public void TestNegateSimpleQuery()
{
var query = new QueryParameters<Artist>();
query.Add("arid", "1", true);
Assert.AreEqual("NOT arid:1", query.ToString());
}
开发者ID:mikgam,项目名称:MusicBrainz,代码行数:8,代码来源:QueryParametersTests.cs
示例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));
}
开发者ID:harlam357,项目名称:hfm-net,代码行数:8,代码来源:HistoryPresenterModelTests.cs
示例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;
}
开发者ID:ranade80,项目名称:Authorization-Samples,代码行数:8,代码来源:Constants.cs
示例10: TestAlreadyQuotedSimpleQuery
public void TestAlreadyQuotedSimpleQuery()
{
var query = new QueryParameters<Artist>();
query.Add("artist", "\"rolling stones\"");
Assert.AreEqual("artist:\"rolling stones\"", query.ToString());
}
开发者ID:mikgam,项目名称:MusicBrainz,代码行数:8,代码来源:QueryParametersTests.cs
示例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());
}
开发者ID:mikgam,项目名称:MusicBrainz,代码行数:9,代码来源:QueryParametersTests.cs
示例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());
}
开发者ID:mikgam,项目名称:MusicBrainz,代码行数:9,代码来源:QueryParametersTests.cs
示例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
}
开发者ID:tamilstreetboy,项目名称:socialauth-net,代码行数:10,代码来源:OAuth2_0Server.cs
示例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;
}
开发者ID:renefc3,项目名称:nhibernate,代码行数:56,代码来源:NativeSQLQueryPlan.cs
示例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();
}
开发者ID:fizikci,项目名称:Cinar,代码行数:11,代码来源:OAuth1_0a.cs
示例16: HistoryPresenterModel_AddQuery_Test
public void HistoryPresenterModel_AddQuery_Test()
{
// Arrange
var parameters = new QueryParameters { Name = "Test" };
parameters.Fields.Add(new QueryField { Value = 6606 });
// Act
Assert.AreEqual(1, _model.QueryBindingSource.Count);
_model.AddQuery(parameters);
// Assert
Assert.AreEqual(2, _model.QueryBindingSource.Count);
}
开发者ID:harlam357,项目名称:hfm-net,代码行数:11,代码来源:HistoryPresenterModelTests.cs
示例17: BindPositionalParameters
/// <summary>
/// Bind positional parameter values to the <tt>PreparedStatement</tt>
/// (these are parameters specified by a JDBC-style ?).
/// </summary>
private int BindPositionalParameters(IDbCommand st, QueryParameters queryParameters, int start, ISessionImplementor session)
{
object[] values = queryParameters.FilteredPositionalParameterValues;
IType[] types = queryParameters.FilteredPositionalParameterTypes;
int span = 0;
for (int i = 0; i < values.Length; i++)
{
types[i].NullSafeSet(st, values[i], start + span, session);
span += types[i].GetColumnSpan(session.Factory);
}
return span;
}
开发者ID:ray2006,项目名称:WCell,代码行数:16,代码来源:NativeSQLQueryPlan.cs
示例18: GetData
public object GetData(ControllerContext context, QueryParameters parameters)
{
var repositoryName = context.GetControllerName() + "repository";
var repository =
Locator.GetAllInstances(typeof(IDynamicRepository)).FirstOrDefault(
o => o.GetType().Name.ToLowerInvariant() == repositoryName);
if (repository == null)
{
throw new Exception(string.Format("Could not locate a repository named '{0}'", repositoryName));
}
return repository.GetType().GetMethod("All").Invoke(repository, null);
}
开发者ID:ryanohs,项目名称:DynamicServices,代码行数:12,代码来源:DynamicQuery.cs
示例19: 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 = GetParameterTypes(queryParameters, session);
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;
}
int col = 0; // NH Different (initialized to 1 in JAVA)
col += BindPositionalParameters(ps, queryParameters, col, session);
BindNamedParameters(ps, queryParameters.NamedParameters, col, 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;
}
开发者ID:zibler,项目名称:zibler,代码行数:53,代码来源:NativeSQLQueryPlan.cs
示例20: GetLoginUrl
public override string GetLoginUrl(string returnUrl)
{
var ub = new UriBuilder(provider.UserLoginEndpoint);
var oauthParams = new QueryParameters();
oauthParams.Add("client_id", provider.Consumerkey);
oauthParams.Add("redirect_uri", returnUrl);
oauthParams.Add("response_type", "code");
oauthParams.Add("scope", provider.GetScope());
BeforeDirectingUserToServiceProvider(oauthParams);
return ub.ToString() + "?" + oauthParams.ToEncodedString();
}
开发者ID:tamilstreetboy,项目名称:socialauth-net,代码行数:13,代码来源:OAuth2_0Server.cs
注:本文中的QueryParameters类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论