本文整理汇总了C#中IHttpContext.GetCheckReferencesInIndexes方法的典型用法代码示例。如果您正苦于以下问题:C# IHttpContext.GetCheckReferencesInIndexes方法的具体用法?C# IHttpContext.GetCheckReferencesInIndexes怎么用?C# IHttpContext.GetCheckReferencesInIndexes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHttpContext
的用法示例。
在下文中一共展示了IHttpContext.GetCheckReferencesInIndexes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Respond
public override void Respond(IHttpContext context)
{
if (string.IsNullOrEmpty(context.Request.QueryString["no-op"]) == false)
{
// this is a no-op request which is there just to force the client HTTP layer to handle the authentication
// only used for legacy clients
return;
}
if("generate-single-use-auth-token".Equals(context.Request.QueryString["op"],StringComparison.InvariantCultureIgnoreCase))
{
// using windows auth with anonymous access = none sometimes generate a 401 even though we made two requests
// instead of relying on windows auth, which require request buffering, we generate a one time token and return it.
// we KNOW that the user have access to this db for writing, since they got here, so there is no issue in generating
// a single use token for them.
var token = server.RequestAuthorizer.GenerateSingleUseAuthToken(Database, context.User);
context.WriteJson(new
{
Token = token
});
return;
}
if (HttpContext.Current != null)
{
HttpContext.Current.Server.ScriptTimeout = 60*60*6; // six hours should do it, I think.
}
var options = new BulkInsertOptions
{
CheckForUpdates = context.GetCheckForUpdates(),
CheckReferencesInIndexes = context.GetCheckReferencesInIndexes()
};
var operationId = ExtractOperationId(context);
var sp = Stopwatch.StartNew();
var status = new BulkInsertStatus();
int documents = 0;
var mre = new ManualResetEventSlim(false);
var currentDatbase = Database;
var task = Task.Factory.StartNew(() =>
{
currentDatbase.BulkInsert(options, YieldBatches(context, mre, batchSize => documents += batchSize), operationId);
status.Documents = documents;
status.Completed = true;
});
long id;
Database.AddTask(task, status, out id);
mre.Wait(Database.WorkContext.CancellationToken);
context.Log(log => log.Debug("\tBulk inserted received {0:#,#;;0} documents in {1}, task #: {2}", documents, sp.Elapsed, id));
context.WriteJson(new
{
OperationId = id
});
}
示例2: Respond
public override void Respond(IHttpContext context)
{
if (string.IsNullOrEmpty(context.Request.QueryString["no-op"]) == false)
{
// this is a no-op request which is there just to force the client HTTP layer
// to handle the authentication
return;
}
var options = new BulkInsertOptions
{
CheckForUpdates = context.GetCheckForUpdates(),
CheckReferencesInIndexes = context.GetCheckReferencesInIndexes()
};
var sp = Stopwatch.StartNew();
var documents = Database.BulkInsert(options, YieldBatches(context));
context.Log(log => log.Debug("\tBulk inserted {0:#,#;;0} documents in {1}", documents, sp.Elapsed));
context.WriteJson(new
{
Documents = documents
});
}
示例3: Respond
public override void Respond(IHttpContext context)
{
if (string.IsNullOrEmpty(context.Request.QueryString["no-op"]) == false)
{
// this is a no-op request which is there just to force the client HTTP layer
// to handle the authentication
return;
}
if (HttpContext.Current != null)
{
HttpContext.Current.Server.ScriptTimeout = 60*60*6; // six hours should do it, I think.
}
var options = new BulkInsertOptions
{
CheckForUpdates = context.GetCheckForUpdates(),
CheckReferencesInIndexes = context.GetCheckReferencesInIndexes()
};
var sp = Stopwatch.StartNew();
var status = new RavenJObject
{
{"Documents", 0},
{"Completed", false}
};
int documents = 0;
var mre = new ManualResetEventSlim(false);
var currentDatbase = Database;
var task = Task.Factory.StartNew(() =>
{
documents = currentDatbase.BulkInsert(options, YieldBatches(context, mre));
status["Documents"] = documents;
status["Completed"] = true;
});
long id;
Database.AddTask(task, status, out id);
mre.Wait(Database.WorkContext.CancellationToken);
context.Log(log => log.Debug("\tBulk inserted received {0:#,#;;0} documents in {1}, task #: {2}", documents, sp.Elapsed, id));
context.WriteJson(new
{
OperationId = id
});
}