当前位置: 首页>>代码示例>>C#>>正文


C# SqlDataRecord.SetSqlXml方法代码示例

本文整理汇总了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();
        }
开发者ID:DomG4,项目名称:sqlservertoazure,代码行数:37,代码来源:Utils.cs

示例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;
     }
 }
开发者ID:TheSoftweyrGroup,项目名称:Softweyr.EventStore,代码行数:21,代码来源:SqlServer2008PersistenceSession.cs

示例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();
            }
        }
开发者ID:DomG4,项目名称:sqlservertoazure,代码行数:61,代码来源:Queue.cs


注:本文中的Microsoft.SqlServer.Server.SqlDataRecord.SetSqlXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。