ISpecification

using System; using System.Collections.Generic; namespace Matlock.Core.Specification { public interface ISpecification<T> { bool IsSatisfiedBy(T candidate); ISpecification<T> And(ISpecification<T> other); ISpecification<T> Or(ISpecification<T> other); ISpecification<T> XOr(ISpecification<T> other); ISpecification<T> AndAllOf(IEnumerable<ISpecification<T>>…

Castle Windsor – WCF Endpoint Configuration

const int maxSize = 52428800; var binding = new BasicHttpBinding(); binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows; binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None; binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; binding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default;…

WCF Tracing

In the web.config in between the <configuration></configuration> tags   <system.diagnostics> <sources> <source name=”System.ServiceModel” switchValue=”Information, ActivityTracing” propagateActivity=”true”> <listeners> <add name=”traceListener” type=”System.Diagnostics.XmlWriterTraceListener” initializeData= “WCFTrace.svclog” /> </listeners> </source>…

Enum extension methods

using System; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using System.Linq; using System.Text; namespace Challenger.Global.Util.Extensions { public static class EnumExtensionMethods { public static T ParseAsEnumByDescriptionAttribute<T>(this string…

Log4Net config

<?xml version=”1.0″ encoding=”utf-8″ ?> <configuration> <log4net> <appender name=”WindowsEventAppender” type=”log4net.Appender.EventLogAppender”> <param name=”LogName” value=”Application” /> <applicationName value=”Phoenix” /> <layout type=”log4net.Layout.PatternLayout”> <conversionPattern value=”%date [%thread] %-5level %logger%newline =&gt; %message%newline”…

TIPS

@if (HttpContext.Current.IsDebuggingEnabled) {      <span>Path</span> @this.VirtualPath }   How to add a css class to a Html.TextBox     <% using(Html.BeginForm()) { %> <div style=”width:500px; padding-top:15px;”>…