This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
Mapper.CreateMap<class1, iclass1DTO>().Include<class2, iclass2DTO>().Include<class3, iclass3DTO>().Include<class4, iclass4DTO>() | |
.ConstructUsing((ResolutionContext _)=>new class1DTO()).As<class1DTO>(); | |
Mapper.CreateMap<class2, iclass2DTO>().As<class2DTO>(); | |
Mapper.CreateMap<class3, iclass3DTO>().As<class3DTO>(); | |
Mapper.CreateMap<class4, iclass4DTO>().As<class4DTO>(); | |
try | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
Mapper.CreateMap<class1, iclass1DTO>().As<class1DTO>(); | |
Mapper.CreateMap<class2, iclass2DTO>().IncludeBase<class1, class1DTO>().As<class2DTO>(); | |
Mapper.CreateMap<class3, iclass3DTO>().IncludeBase<class2, class2DTO>().As<class3DTO>(); | |
Mapper.CreateMap<class4, iclass4DTO>().IncludeBase<class3, class3DTO>().As<class4DTO>(); | |
try | |
{ | |
Mapper.Configuration.Seal(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
Mapper.CreateMap<iclass1, iclass1DTO>(); | |
Mapper.CreateMap<iclass2, iclass2DTO>(); | |
try | |
{ | |
Mapper.AssertConfigurationIsValid(); | |
var bo = new class2 { prop1 = "PROP1", prop2 = "PROP2" }; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "3.38.1-*", | |
"description": "AutoFixture Class Library", | |
"authors": [ "" ], | |
"tags": [ "" ], | |
"projectUrl": "", | |
"licenseUrl": "", | |
"frameworks": { | |
"net451": { | |
"frameworkAssemblies": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var source = new PaginatedList<Source> { PageNumber = 13, PageSize = 5 }; | |
source.AddRange(Enumerable.Range(1, 10).Reverse().Select(i=>new Source(i))); | |
var result = AutoMapperConfig.Mapper.Map<PaginatedList<Destination>>(source).Dump(); | |
result.PageNumber.Dump(); | |
result.PageSize.Dump(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Data.Entity; | |
using System.Text; | |
using System.Threading.Tasks; | |
using AutoMapper; | |
using System.Collections.Generic; | |
namespace SelfReferencingWithViewModel | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace AutoMapper_Sample | |
{ | |
class Program | |
{ | |
abstract class DTOParent | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var interfaceType = typeof(IQueryableInterface); | |
new[]{interfaceType} | |
.RecursiveSelect(i=>i.GetTypeInfo().ImplementedInterfaces) | |
.Distinct() | |
.Select(i=>i.GetMember("PropertyInterface").FirstOrDefault()) | |
.FirstOrDefault(m=>m!=null) | |
.Dump(); | |
typeof(IQueryableInterface).GetMember("PropertyInterface").Dump(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var config = new AutoMapper.MapperConfiguration(c => | |
{ | |
c.CreateMap<B, A>(); | |
c.CreateMap<A, AB>(); | |
c.CreateMap<B, AB>(); | |
}); | |
var mapper = config.CreateMapper(); | |
var runtimeMapper = (IRuntimeMapper) mapper; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Query Kind="Statements"> | |
<Reference Relative="..\TestConsole\TestConsole\bin\Debug\Newtonsoft.Json.dll">C:\Projects\TestConsole\TestConsole\bin\Debug\Newtonsoft.Json.dll</Reference> | |
<Reference Relative="..\TestConsole\TestConsole\bin\Debug\TestConsole.exe">C:\Projects\TestConsole\TestConsole\bin\Debug\TestConsole.exe</Reference> | |
<Namespace>Newtonsoft.Json</Namespace> | |
<Namespace>OGL_Library</Namespace> | |
</Query> | |
var dir = Path.GetDirectoryName(LINQPad.Util.CurrentQueryPath); | |
var jsonText = File.ReadAllText(dir+"\\Saved Places.json"); | |
dynamic json = JsonConvert.DeserializeObject(jsonText); |