Skip to content

Instantly share code, notes, and snippets.

@weitzhandler
weitzhandler / IdentityStores.cs
Last active July 5, 2017 15:49
Microsoft.AspNetCore.Identity.EntityFramework
using System;
using System.Data.Entity;
using System.Threading;
using System.Threading.Tasks;
using static Microsoft.AspNetCore.Identity.EntityFramework.BaseMethodWrapper;
namespace Microsoft.AspNetCore.Identity.EntityFramework
{
public interface IKeyConverter<TKey>
{
@weitzhandler
weitzhandler / PropertyFilterResolver.cs
Last active May 21, 2017 13:02
Json.NET property map filter resolver
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace Newtonsoft.Json.Serialization
{
public class PropertyFilterResolver : DefaultContractResolver
{
@weitzhandler
weitzhandler / MultiDataTemplateSelector.cs
Created May 10, 2017 22:36
Xamarin DataTemplateSelector TargetType
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Reflection;
namespace Xamarin.Forms
{
[ContentProperty(nameof(Templates))]
@weitzhandler
weitzhandler / AutoCompleteView.cs
Last active October 27, 2018 13:43
Xamarin.Forms AutoCompleteView
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Reflection;
using System.Windows.Input;
namespace Xamarin.Forms
<RelativeLayout HeightRequest="60">
<ListView Rotation="270" ItemsSource="{Binding RespondersList}" RowHeight="60" SeparatorVisibility="None"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.5, Constant=-30}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=-0.5, Constant=30}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=Constant, Constant=60}"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ContentView Rotation="90" Padding="1" TranslationX="60">
@weitzhandler
weitzhandler / DisplayExtension.cs
Last active May 7, 2017 05:55
Xamarin DisplayExtension - Xaml extension that extracts field description
using System.Reflection;
namespace Xamarin.Forms
{
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Xamarin.Forms.Xaml;
public class DisplayExtension : IMarkupExtension<string>
using System.ServiceModel.Channels;
using System.Threading.Tasks;
namespace System.ServiceModel
{
public class ClientProxy<TClient, TChannel> : IDisposable
where TClient : ClientBase<TChannel>
where TChannel : class
{
public TClient Client { get; private set; }
@weitzhandler
weitzhandler / OAuthHttpClient
Created November 2, 2015 02:58
A HttpClient that handles bearer tokens
using Microsoft.Owin.Security.OAuth;
using System.Net.Http.Formatting;
using System.Net.Http.Headers;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
namespace System.Net.Http
{
namespace ConsoleApplication1
{
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using static System.Console;
class Program
{
static void Main(string[] args)
@weitzhandler
weitzhandler / Tenant.cs
Last active March 20, 2016 20:28
Microsoft.AspNet.EntityFramework.Identity.Multitenant
using Microsoft.AspNet.Identity.EntityFramework.Tenant;
using Microsoft.AspNet.Routing;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.AspNet.Identity.EntityFramework.Tenant