本文整理汇总了C#中JsonTextWriter.writeSharedJSONEpilog方法的典型用法代码示例。如果您正苦于以下问题:C# JsonTextWriter.writeSharedJSONEpilog方法的具体用法?C# JsonTextWriter.writeSharedJSONEpilog怎么用?C# JsonTextWriter.writeSharedJSONEpilog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonTextWriter
的用法示例。
在下文中一共展示了JsonTextWriter.writeSharedJSONEpilog方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Contracts
//IEnumerable<T> WhereActiveOrderBy(
//REFACTOR: we're building things up in memory, and inefficiently as well...
//MESS: NAIVE: these are nasty messes of code as well.
public ActionResult Contracts()
{
//get a list with the newest employees/offices for each employee/office code.
var newestOffices = db.newestOffices();
var newestEmployees = db.newestEmployees();
return authenticatedAction(new String[] { "UT", "UR" }, () => {
content:
var result = makeJSONResult();
using (JsonTextWriter w = new JsonTextWriter()) {
w.WriteStartArray();
foreach (Contract c in db.Contracts.WAOBTL()) {
w.writeSharedJSONMembers(c);
w.writeSharedJSONProlog();
foreach (Company co in db.Companies.Where(tco => tco.contractCode == c.code).WAOBTL()) {
w.writeSharedJSONMembers(co);
w.WriteMember("offices");
w.WriteStartArray();
foreach (Office o in newestOffices
.Where(o => o.companyCode == co.code)
.Where(o => o.contractCode == c.code)
.WAOBTL()
) {
w.WriteStartObject();
//LOOK AT THIS! WE'RE NOT JUST SENDING OVER THE CODE, BUT THE VERSION AS WELL!
w.WriteMember("code");
w.WriteString(o.code + "?" + o.version.ToString());
w.WriteMember("description");
w.WriteString(o.description);
w.WriteEndObject();
}
w.WriteEndArray();
w.WriteMember("employees");
w.WriteStartArray();
foreach (Employee e in newestEmployees
.Where(e => e.companyCode == co.code)
.Where(e => e.contractCode == c.code)
.WAOBTL()) {
w.WriteStartObject();
//LOOK AT THIS! WE'RE NOT JUST SENDING OVER THE CODE, BUT THE VERSION AS WELL!
w.WriteMember("code");
w.WriteString(e.code + "?" + e.version.ToString());
w.WriteMember("description");
w.WriteString(e.firstName + " " + e.lastName);
w.WriteEndObject();
}
w.WriteEndArray();
w.WriteEndObject();
}
w.writeSharedJSONEpilog();
}
w.WriteEndArray();
result.Content = w.ToString();
}
logger.Debug("TreesController.Contracts accessed.");
return result;
});
}
示例2: Sources
public ActionResult Sources()
{
return authenticatedAction(new String[] { "UT", "UR" }, () => {
var result = makeJSONResult();
using (JsonTextWriter w = new JsonTextWriter()) {
w.WriteStartArray();
foreach (IssueSourceLvl1 i in db.IssueSourceLvl1s.WAOBTL()) {
w.writeSharedJSONMembers(i);
w.writeSharedJSONProlog();
foreach (IssueSourceLvl2 i2 in db.IssueSourceLvl2s.Where(ti2 => ti2.parentCode == i.code).WAOBTL()) {
w.writeSharedJSONMembers(i2);
w.writeSharedJSONProlog();
foreach (IssueSourceLvl3 i3 in db.IssueSourceLvl3s
.Where(ti3 => ti3.grandparentCode == i.code)
.Where(ti3 => ti3.parentCode == i2.code)
.WAOBTL()) {
w.writeSharedJSONMembers(i3);
w.WriteEndObject();
}
w.writeSharedJSONEpilog();
}
w.writeSharedJSONEpilog();
}
w.WriteEndArray();
result.Content = w.ToString();
}
logger.Debug("TreesController.Sources accessed.");
return result;
});
}