Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Dejan Milicic DejanMilicic

🎯
Focusing
View GitHub Profile
@DejanMilicic
DejanMilicic / Model.cs
Created Feb 2, 2020 — forked from ayende/Model.cs
Code for lesser known ravendb
View Model.cs
using System;
using System.Collections.Generic;
using Raven.Client.Documents.Session.Loaders;
namespace LesserKnownFeatures
{
public class Company
{
public string Id { get; set; }
public string ExternalId { get; set; }
View gist:f699edd987f79d0d7f86d6cf00461906
using System.Collections.Generic;
using System.Linq;
public static class IEnumerableExtensions
{
public static bool IsEmpty<T>(this IEnumerable<T> enumerable)
{
if (enumerable == null) return true;
// If this is a list, use the Count property for efficiency.
View ClaimExtensions.cs
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
namespace Infrastructure.Claims
{
public static class ClaimExtensions
{
public static void AddUpdateClaim(this IPrincipal currentPrincipal, string key, string value)
View MediatrErrorHandlingMiddleware.cs
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
using System;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
namespace Infrastructure.Middleware
{
public class MediatrErrorHandlingMiddleware
View PolicyTagHelper.cs
using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Authorization;
using Microsoft.AspNetCore.Authorization;
using System.Threading.Tasks;
@DejanMilicic
DejanMilicic / RequiredClaimsTagHelper.cs
Last active Feb 13, 2017
Tag Helper : required-claims
View RequiredClaimsTagHelper.cs
using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace Infrastructure.MVC
{
[HtmlTargetElement(Attributes = "required-claim")]
public class RequiredClaimsTagHelper : TagHelper
{
private readonly IHttpContextAccessor httpContextAccessor;
@DejanMilicic
DejanMilicic / N2Extensions.cs
Created May 15, 2012
N2CMS : Link for sharing content on LinkedIn
View N2Extensions.cs
public static class N2Extensions
{
public static string FullUrl(this N2.ContentItem item)
{
return HttpContext.Current.Request.Url.GetBaseUri().OriginalString + item.Url;
}
}
You can’t perform that action at this time.