Skip to content

Instantly share code, notes, and snippets.

@wullemsb
wullemsb / TimeOutonICriteria.cs
Created February 16, 2013 08:48
Set TimeOut on NHibernate ICriteria
var products=unitOfWork
.Session
.CreateCriteria<Product>()
.SetTimeout(120)
.List<Product>();
@wullemsb
wullemsb / TimeoutOnQueryOver.cs
Created February 16, 2013 08:49
Set Timeout on NHibernate QueryOver
var products=unitOfWork
.Session
.QueryOver<Product>()
.UnderlyingCriteria.SetTimeout(120)
.List<Product>();
@wullemsb
wullemsb / ExcludePropertyFromSerialization.cs
Created February 16, 2013 09:15
Exclude property from serialization, not working solution
[Serializable]
public class Product
{
[NonSerialized] //NonSerialized works on field values
private int _id;
public int Id
{
get{return _id;}
set{_id=value;}
@wullemsb
wullemsb / ExcludePropertyFromSerialization.cs
Last active December 13, 2015 19:58
Exclude property from serialization, working solution
public class Product
{
[XmlIgnore]
public int Id{get;set;}
[XmlIgnore]
public string Name{get;set;}
}
@wullemsb
wullemsb / categories.xml
Created February 16, 2013 11:23
Altered categories.xml to enable Microsoft Feedback Client
<?xml version="1.0" encoding="utf-8"?>
<cat:CATEGORIES xmlns:cat="http://schemas.microsoft.com/VisualStudio/2008/workitemtracking/categories">
<CATEGORY refname="Microsoft.BugCategory" name="Bug Category">
<DEFAULTWORKITEMTYPE name="Bug" />
</CATEGORY>
<CATEGORY refname="Microsoft.RequirementCategory" name="Requirement Category">
<DEFAULTWORKITEMTYPE name="User Story" />
</CATEGORY>
<CATEGORY refname="Microsoft.SharedStepCategory" name="Shared Step Category">
<DEFAULTWORKITEMTYPE name="Shared Steps" />
var message = @"c:\message.xml";
var xslTransformation = @"c:\messagetransformation.xsl";
var xslDocument = new XslCompiledTransform();
xslDocument.Load(xslTransformation);
var stringWriter = new StringWriter();
var xmlWriter = new XmlTextWriter(stringWriter);
xslDocument.Transform(message, xmlWriter);
//Load the transformed output in a WPF WebBrowser control
webBrowser.NavigateToString(stringWriter.ToString());
@wullemsb
wullemsb / Win8ReadFileFromInstallLocation.cs
Created March 3, 2013 08:11
Windows 8: read a file from a unit test project
var folder = Package.Current.InstalledLocation;
var stream= folder.OpenStreamForReadAsync("Filename.txt")
@wullemsb
wullemsb / JsonCompression.xml
Created March 3, 2013 09:11
Enable json compression in IIS
<system.webServer>
<urlCompression doDynamicCompression="true" />
<httpCompression>
<dynamicTypes>
<add mimeType="application/json" enabled="true" />
<add mimeType="application/json; charset=utf-8" enabled="true" />
</dynamicTypes>
</httpCompression>
</system.webServer>
@wullemsb
wullemsb / resources.designer.cs
Last active December 15, 2015 00:49
Sample xml for string resources in Mono for Android Generated designer file based on the XML
public partial class String
{
// aapt resource value: 0x7f070001
public const int ApplicationName = 2131165185;
// aapt resource value: 0x7f07000f
public const int DataLoadingError = 2131165199;
// aapt resource value: 0x7f07000e
public const int ImageLoadingError = 2131165198;
@wullemsb
wullemsb / getstring.cs
Created March 16, 2013 10:51
Read the value from a string resource in Mono for Android
string applicationName = Resources.GetString(Resource.String.ApplicationName);