Skip to content

Instantly share code, notes, and snippets.

using Microsoft.TeamFoundation.Build.Client;
using Microsoft.TeamFoundation.Client;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
public class EWayOffsitePaymentSettings : IPaymentSettings
{
public string PaymentType
{
get { return "Sale"; }
set { }
}
public string[] ProcessorCreditCards
{
#requires -version 2.0
param (
[parameter(Mandatory=$true)]
[string]
$Path
)
$tool= "e:\tools\NuGet.exe"
$files = Get-ChildItem -Path $Path -Filter Microsoft.TeamFoundation.*.dll -recurse
using Microsoft.TeamFoundation.TestManagement.Controller;
using Microsoft.VisualStudio.TestTools.Common;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Framework.Client;
using Microsoft.TeamFoundation.Framework.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
foreach (var child in source.ChildCollection)
{
var targetChild = target.ChildCollection.SingleOrDefault(c => c.Equals(child)); //overwrite Equals or replace comparison with an Id comparison
if (targetChild == null)
target.ChildCollection.Add(Mapper.Map<SourceChildType, TargetChildType>(child));
else
Mapper.Map(child, targetChild);
}
public ActionResult View(int id)
{
var entity = LoadFromDatabase(id);
return AutoMap<ViewResult>(View(entity));
}
[AutoMap(typeof(ViewModel)]
public ActionResult View(int id)
{
var entity = LoadFromDatabase(id);
return View(entity);
}
public ActionResult View(int id)
{
var entity = LoadFromDatabase(id);
var viewModel = Mapper.Map<ViewModel>(entity);
return View(viewModel);
}
public class PaginationMapper : IObjectMapper
{
private IMappingEngineRunner _mapper;
public T Map<T>(object source)
{
TypeMap typeMap = _mapper.ConfigurationProvider.FindTypeMapFor(source, source.GetType(), typeof(T));
MappingOperationOptions mappingOperationOptions = new MappingOperationOptions();
ResolutionContext resolutionContext = new ResolutionContext(typeMap, source, source.GetType(), typeof(T), mappingOperationOptions);
return (T)_mapper.Map(resolutionContext);
}