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 2018-02-10-publishingnugetotvsts_003.cmd
nuget.exe push -Source "MyFeedName" -ApiKey VSTS Subfolder\bin\Release\MyProject.nupkg
View 2018-02-10-publishingnugetotvsts_002.cmd
start nuget.exe pack Subfolder\MyProject.csproj -OutputDirectory Subfolder\bin\Release -symbols -IncludeReferencedProjects -Prop Configuration=Release
View 2018-02-10-publishingnugetotvsts_001.xml
<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release'">
<Exec Command="$(SolutionDir)\NuGet.exe pack $(ProjectPath) -IncludeReferencedProjects -Prop Configuration=Release">
</Exec>
</Target>
View 2016-05-29-working-with-files-with-powershell_007.ps1
param([string]$parameter1, [string]$parameter2)
Write-Host $parameter1 $parameter2
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_003bis.xml
<layout type="log4net.Layout.PatternLayout">
<converter>
<name value="HTTPUser" />
<type value="hbulens.Logging.HttpContextUserPatternConverter" />
</converter>
<conversionPattern value="%level %date - %message - [%property{Category}] - [%HTTPUser] %newline" />
</layout>
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 2015-10-04-create-lambda-expressions-on-the-fly-in-c_008.cs
public Expression<Func<T, bool>> GetExpressionForType<TEntity>(string field, string operation, object value, string ignoreCase)
{
Expression<Func<T, bool>> whereClause = default(Expression<Func<T, bool>>);
ParameterExpression param = Expression.Parameter(typeof(T), "x");
MemberExpression member = Expression.Property(param, field);
Type propertyType = member.Type;
TypeConverter converter = TypeDescriptor.GetConverter(propertyType);
var result = converter.ConvertFrom(value.ToString());
ConstantExpression constant = Expression.Constant(result);
View 2015-10-04-create-lambda-expressions-on-the-fly-in-c_005.cs
static void QueryByYear(string level)
{
GradeLevel year = (GradeLevel)Convert.ToInt32(level);
IEnumerable<Student> studentQuery = null;
switch (year)
{
case GradeLevel.FirstYear:
studentQuery = from student in students
where student.Year == GradeLevel.FirstYear
View 2015-10-04-create-lambda-expressions-on-the-fly-in-c_006.cs
[HttpGet]
public class SomeApiController : Controller
{
public async Task<dynamic> Get(
int page,
int start,
int limit,
string sort = null,
string group = null,
string filter = null)
You can’t perform that action at this time.