Skip to content

Instantly share code, notes, and snippets.

Hendrik Bulens hbulens

Block or report user

Report or block hbulens

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 2015-08-03-c-and-the-strava-web-api_002.cs
public class Athlete
{
[JsonProperty("id")]
public int ? Id {get;set;}
[JsonProperty("resource_state")]
public int ? ResourceState {get;set;}
[JsonProperty("profile_medium")]
public string ProfileMedium {get;set;}
View 2015-08-03-c-and-the-strava-web-api_002.cs
public class Athlete
{
[JsonProperty("id")]
public int ? Id {get;set;}
[JsonProperty("resource_state")]
public int ? ResourceState {get;set;}
[JsonProperty("profile_medium")]
public string ProfileMedium {get;set;}
View 2014-12-14-repository-pattern-sharepoint_001.cs
public class SSOMRepositoryBase
{
#region Constructor
public SSOMRepositoryBase(string contextUrl)
{
// Set the Context Url
this.ContextUrl = contextUrl;
}
View 2014-12-14-repository-pattern-sharepoint_002.cs
public class CountryRepository : SSOMRepositoryBase<Country>, ICountryRepository
{
#region Constructor
public CountryRepository(string contextUrl) : base(contextUrl)
{
}
#endregion
View 2014-12-14-repository-pattern-sharepoint_003.cs
public static Country ConvertToCountry(sp.SPListItem item)
{
  Country newCountry = new Country();
  try
  {
    if (item != null)
    {
      newCountry.Id = int.Parse(item[Resources.Fields_Id].ToString());
      newCountry.Title = item.Fields.ContainsField(Resources.Fields_Title1&& item[Resources.Fields_Title1!= null ? item[Resources.Fields_Title1].ToString() : string.Empty;
      newCountry.BusinessUnit = item.Fields.ContainsField(Resources.Fields_Title&& item[Resources.Fields_Title!= null ? item[Resources.Fields_Title].ToString() : string.Empty;
View 2016-01-14-custom-properties-in-log4net-logging_001.cs
public interface ILogger
{
void LogDebug(string message);
void LogDebug(string message, string category);
void LogDebug(string message, Exception ex);
void LogDebug(string message, string category, Exception ex);
void LogInformation(string message);
void LogInformation(string message, string category);
void LogWarning(string message);
void LogWarning(string message, string category);
View 2016-01-14-custom-properties-in-log4net-logging_002.cs
public partial class Logger: ILogger
{
#region Constructor
public Logger()
{
log4net.Config.XmlConfigurator.Configure();
this.Log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
}
View 2016-01-14-custom-properties-in-log4net-logging_003.xml
<appender name="TracingAppenderFile" type="log4net.Appender.RollingFileAppender">
<file value=".\\\App_Data\\\Logs\" />
<datePattern value="yyyy-MM-dd'-TracingLogs.log'" />
<appendToFile value="true" />
<maximumFileSize value="256KB" />
<maxSizeRollBackups value="20" />
<rollingStyle value="Date" />
<staticLogFileName value="false" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
View 2016-01-14-custom-properties-in-log4net-logging_004.cs
using log4net.Core;
using log4net.Layout.Pattern;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
View 2016-01-14-custom-properties-in-log4net-logging_005.xml
<parameter>
<parameterName value="@Category" />
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{Category}" />
</layout>
</parameter>
You can’t perform that action at this time.