예제 #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();
 }