本文整理汇总了C#中Microsoft.SqlServer.Server.SqlDataRecord.SetSqlXml方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDataRecord.SetSqlXml方法的具体用法?C# SqlDataRecord.SetSqlXml怎么用?C# SqlDataRecord.SetSqlXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.SqlServer.Server.SqlDataRecord
的用法示例。
在下文中一共展示了SqlDataRecord.SetSqlXml方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PushSingleRecordResult
internal static void PushSingleRecordResult(object result, System.Data.SqlDbType sqlDBType)
{
//SqlContext.Pipe.Send("Response output:\n");
//SqlContext.Pipe.Send(result.ToString());
SqlDataRecord record = null;
switch (sqlDBType)
{
case System.Data.SqlDbType.NVarChar:
case System.Data.SqlDbType.VarChar:
record = new SqlDataRecord(new SqlMetaData[] { new SqlMetaData("Result", sqlDBType, -1) });
record.SetString(0, result.ToString());
break;
case System.Data.SqlDbType.Xml:
record = new SqlDataRecord(new SqlMetaData[] { new SqlMetaData("Result", sqlDBType) });
SqlXml xml;
using (System.Xml.XmlReader reader = System.Xml.XmlReader.Create(new System.IO.StringReader(result.ToString())))
{
xml = new SqlXml(reader);
}
record.SetSqlXml(0, xml);
break;
case System.Data.SqlDbType.Int:
record = new SqlDataRecord(new SqlMetaData[] { new SqlMetaData("Result", sqlDBType) });
record.SetInt32(0, (Int32)result);
break;
default:
throw new ArgumentException("SqlDbType " + sqlDBType.ToString() + " is not supported by PushSingleRecordResult.");
}
SqlContext.Pipe.SendResultsStart(record);
SqlContext.Pipe.SendResultsRow(record);
SqlContext.Pipe.SendResultsEnd();
}
示例2: ToSqlDataRecord
private SqlDataRecord ToSqlDataRecord(Guid aggregateId, int expectedVersion, int snapshotVersion, object @event, ref int currentVersion)
{
using (var serializedData = this.serializationMethod.Serialize(@event))
{
var record = new SqlDataRecord(
new SqlMetaData("EventStreamId", SqlDbType.UniqueIdentifier),
new SqlMetaData("ExpectedVersion", SqlDbType.Int),
new SqlMetaData("SnapshotVersion", SqlDbType.Int),
new SqlMetaData("Version", SqlDbType.Int),
new SqlMetaData("EventTypeId", SqlDbType.UniqueIdentifier),
new SqlMetaData("Payload", SqlDbType.Xml));
var column = 0;
record.SetGuid(column++, aggregateId);
record.SetInt32(column++, expectedVersion);
record.SetInt32(column++, snapshotVersion);
record.SetInt32(column++, ++currentVersion);
record.SetGuid(column++, serializedData.TypeId);
record.SetSqlXml(column++, new SqlXml(((XmlSerializedData)serializedData).Reader)); // TODO: May be a memory leak here.
return record;
}
}
示例3: ListQueuesProc
public static void ListQueuesProc(
SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
SqlString prefix,
SqlBoolean IncludeMetadata,
SqlInt32 timeoutSeconds,
SqlGuid xmsclientrequestId)
{
ITPCfSQL.Azure.AzureQueueService aqs = new AzureQueueService(accountName.Value, sharedKey.Value, useHTTPS.Value);
//SqlContext.Pipe.Send("Created " + aqs);
List<ITPCfSQL.Azure.Queue> lQueues = aqs.ListQueues(
prefix != null ? prefix.Value : null,
IncludeMetadata.Value,
timeoutSeconds.Value,
xmsclientrequestId.IsNull ? (Guid?)null : xmsclientrequestId.Value);
for (int i = 0; i < lQueues.Count; i++)
{
SqlDataRecord record = new SqlDataRecord(new SqlMetaData[] {
new SqlMetaData("Name", System.Data.SqlDbType.NVarChar, 4000),
new SqlMetaData("Url", System.Data.SqlDbType.NVarChar, 4000),
new SqlMetaData("Metadata", System.Data.SqlDbType.Xml)
});
record.SetString(0, lQueues[i].Name);
record.SetString(1, lQueues[i].Url.ToString());
if (IncludeMetadata)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
using (System.Xml.XmlWriter wr = System.Xml.XmlWriter.Create(ms))
{
wr.WriteStartElement("MetadataList");
foreach (string s in lQueues[i].Metadata.Keys)
{
wr.WriteStartElement(s);
wr.WriteString(lQueues[i].Metadata[s]);
wr.WriteEndElement();
}
wr.WriteEndElement();
wr.Flush();
wr.Close();
}
ms.Seek(0, System.IO.SeekOrigin.Begin);
record.SetSqlXml(2, new SqlXml(ms));
}
if (i == 0)
SqlContext.Pipe.SendResultsStart(record);
SqlContext.Pipe.SendResultsRow(record);
if ((i + 1) >= lQueues.Count)
SqlContext.Pipe.SendResultsEnd();
}
}