This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Microsoft.SqlServer.Server.SqlFunction] | |
public static SqlString Unzip(byte[] zipBytes, string encoding) | |
{ | |
using (MemoryStream inputStream = new MemoryStream(zipBytes)) | |
{ | |
using (DeflateStream deflateStream = new DeflateStream(inputStream, CompressionMode.Decompress)) | |
{ | |
using (StreamReader reader = new StreamReader(deflateStream, System.Text.Encoding.GetEncoding(encoding))) | |
{ | |
return new SqlString(reader.ReadToEnd()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Things to think about | |
Columns over 8000 character in total cannot be reindex without taking the table off line. | |
In our studies compression saved close to 70% versus not compressing | |
Xml can easily be used (replace the ISerilize implementation JsonSerialize with a XmlSerializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ConfigurationManagerExtension | |
{ | |
public static int GetFromConfigurationFileWithDefaultHandling(string setting, int defaultIfNotFound) | |
{ | |
try | |
{ | |
var status = ConfigurationManager.AppSettings[setting]; | |
int result; | |
if (int.TryParse(status, out result)) | |
return result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Simple MVC/WebApi authentication model using json authentication schema basic. | |
Simply create the files below to use and you are good to go. The only TODO section is the user and database call | |
Have provided a unit test to show the conversion to and from base 64 strings (json standard) | |
Also a example echo controller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ISerialize | |
{ | |
string Serialize<T>(T data, bool prettyPrint = false); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net.Http.Headers; | |
namespace Choco.Common | |
{ | |
public interface IHttpClient | |
{ | |
string Post(Uri requestUri, string data, AuthenticationHeaderValue authenticationHeader, string applicationType); | |
string Get(Uri requestUri); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
using System.Web; | |
using NLog; | |
namespace Choco.Shared.Web.App_Start | |
{ | |
public class LogSoapModule : IHttpModule | |
{ | |
public void Init(HttpApplication context) |