示例#1
0
 public static void AssertEquals(string content, DataTable dt)
 {
     StringWriter sw = new StringWriter();
     dt.SaveToStream(sw);
     string actual = sw.ToString();
     AssertEquals(content, actual);
 }
示例#2
0
        /// <summary>
        /// Save the data table to the given azure blob. This will overwrite an existing blob.
        /// </summary>
        /// <param name="table">instance of table to save</param>
        /// <param name="container">conatiner</param>
        /// <param name="blobName">blob name</param>
        public static void SaveToAzureBlob(this DataTable table, CloudBlobContainer container, string blobName)
        {
            var blob = container.GetBlobReference(blobName);

            using (BlobStream stream = blob.OpenWrite())
                using (TextWriter writer = new StreamWriter(stream))
                {
                    table.SaveToStream(writer);
                }
        }
示例#3
0
        /// <summary>
        /// Save the data table to the given azure blob. This will overwrite an existing blob.
        /// </summary>
        /// <param name="table">instance of table to save</param>
        /// <param name="container">conatiner</param>
        /// <param name="blobName">blob name</param>
        public static void SaveToAzureBlob(this DataTable table, CloudBlobContainer container, string blobName)
        {
            var blob = container.GetBlockBlobReference(blobName);

            using (var stream = new MemoryStream())
                using (TextWriter writer = new StreamWriter(stream))
                {
                    table.SaveToStream(writer);
                    writer.Flush();
                    stream.Seek(0, SeekOrigin.Begin);
                    blob.UploadFromStream(stream);
                }
        }
示例#4
0
 private static string TableToString(DataTable dt)
 {
     StringWriter sw = new StringWriter();
     dt.SaveToStream(sw);
     return sw.ToString();
 }