Skip to content

Instantly share code, notes, and snippets.

public static class AutoMapperExtensions
{
public static IMappingExpression<TSource, TDestination>
IgnoreAllNonExisting<TSource, TDestination>(this IMappingExpression<TSource, TDestination> expression)
{
var sourceType = typeof(TSource);
var destinationType = typeof(TDestination);
var existingMaps = Mapper.GetAllTypeMaps().First(x => x.SourceType.Equals(sourceType) && x.DestinationType.Equals(destinationType));
foreach (var property in existingMaps.GetUnmappedPropertyNames())
{
@janierdavila
janierdavila / RestSharpLoadRequest.cs
Created May 19, 2012 16:41 — forked from shawnoster/RestSharpLoadRequest.cs
An AgFx LoadRequest that uses RestSharp to make the actual request, supports passing in OAuth tokens
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Text;
using AgFx;
using RestSharp;
using RestSharp.Authenticators;
namespace Librarian.AgFx