Skip to content

Instantly share code, notes, and snippets.

@SlowLogicBoy
Last active November 29, 2017 10:26
Show Gist options
  • Save SlowLogicBoy/715e30af169383e4e8ed95419d333ca9 to your computer and use it in GitHub Desktop.
Save SlowLogicBoy/715e30af169383e4e8ed95419d333ca9 to your computer and use it in GitHub Desktop.
#! "netcoreapp2.0"
#r "nuget:NetStandard.Library,2.0.0"
#r "nuget:LanguageExt.Core,*"
#r "nuget:AgileObjects.AgileMapper,*"
#r "nuget:Microsoft.Extensions.DependencyInjection,*"
#r "nuget:Microsoft.Extensions.Logging,*"
#r "nuget:Serilog,*"
#r "nuget:Serilog.Extensions.Logging,*"
using AgileObjects.AgileMapper;
using LanguageExt;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog;
class RandomModel {
public string PropertyOne { get; set; }
public override string ToString () => RecordType<RandomModel>.ToString(this); //Annoying Line
}
class AnotherModel {
public string AnotherProperty { get; set; }
public override string ToString () => RecordType<AnotherModel>.ToString (this); //Annoying Line
}
Mapper.WhenMapping
.From<RandomModel>().To<AnotherModel>()
.Map(ctx => ctx.Source.PropertyOne).To(anotherModel => anotherModel.AnotherProperty); //Annoying Line
var sc = new ServiceCollection().AddLogging(lb => lb.AddSerilog(dispose: true)); //Annoying line
var model = new RandomModel { PropertyOne = "Hi I'm property one" };
Console.WriteLine (model);
Console.WriteLine (Mapper.Map(model).ToANew<AnotherModel>());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment