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
| class Program | |
| { | |
| static DateTime GetDateTime(string dateTime) | |
| { | |
| return new DateTime(1970, 1, 1, 0, 0, 0).AddSeconds(double.Parse(dateTime.Substring(0, dateTime.Length-6))); | |
| } | |
| [STAThread] | |
| static void Main(string[] args) | |
| { |
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 StringDictionary = IDictionary<string, object>; | |
| Mapper.CreateMap<StringDictionary, Destination>().AfterMap(AfterMap); | |
| dynamic source = new ExpandoObject(); | |
| source.Foo = "Foo"; | |
| source.Bar = "Bar"; | |
| var destination = new Destination(); | |
| Mapper.Map<StringDictionary, Destination>(source, destination); |
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
| static void Main(string[] args) | |
| { | |
| Database.SetInitializer(new Initializer()); | |
| Mapper.Initialize(cfg => { | |
| cfg.CreateMap<TrainingCourse, TrainingCourseDto>().Include<TrainingCourse, ParentTrainingCourseDto>(); | |
| cfg.CreateMap<TrainingCourse, ParentTrainingCourseDto>(); | |
| cfg.CreateMap<TrainingContent, TrainingContentDto>(); | |
| }); | |
| Mapper.AssertConfigurationIsValid(); |
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(typeof(MyClass), typeof(IMyInterface)); | |
| Mapper.AssertConfigurationIsValid(); | |
| var myClassInstance = new MyClass { Container = 3 }; | |
| var implementedClassInstance = new ImplementedClass(); |
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<Source, DestinationBase>().ForAllMembers(e => e.Ignore()); | |
| Mapper.CreateMap<Source, Destination>().IncludeBase<Source, DestinationBase>(); | |
| Mapper.Configuration.Seal(); | |
| Mapper.AssertConfigurationIsValid(); | |
| Mapper.Map<Destination>(new Source { Value = 3 }).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
| static void Main(string[] args) | |
| { | |
| Database.SetInitializer(new Initializer()); | |
| Mapper.Initialize(cfg => { | |
| cfg.CreateMap<TrainingCourse, TrainingCourseDto>().Include<TrainingCourse, ParentTrainingCourseDto>().ForMember(d=>d.Value, o=>o.MapFrom(d=>d.Content.Count())); | |
| cfg.CreateMap<TrainingCourse, ParentTrainingCourseDto>(); | |
| cfg.CreateMap<TrainingContent, TrainingContentDto>(); | |
| }); | |
| Mapper.AssertConfigurationIsValid(); |
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 json = JsonConvert.SerializeObject(new Item(5)); | |
| var item = JsonConvert.DeserializeObject<Item>(json).Dump(); | |
| } | |
| class Item | |
| { | |
| public Item(int integer = 5) | |
| { |
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.Data.SqlClient; | |
| using System.Diagnostics; | |
| using System.Security.Principal; | |
| using System.Threading; | |
| using System.Web.Mvc; | |
| public class HomeController : Controller | |
| { | |
| static Timer timer = new Timer(_ => |
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
| static void Main(string[] args) | |
| { | |
| Mapper.Initialize(config => | |
| { | |
| config.CreateMap<Category, CategoryDto>(); | |
| config.CreateMap<Article, ArticleDto>(); | |
| }); | |
| Mapper.AssertConfigurationIsValid(); | |
| var context = new AppDbContext(); |
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
| Test Name: AutoMapper.UnitTests.Bug.ExpressionMapping.When_Using_Non_TypeMapped_Class_Method_Against_Constant | |
| Test FullName: AutoMapper.UnitTests.Bug.ExpressionMapping.When_Using_Non_TypeMapped_Class_Method_Against_Constant | |
| Test Source: C:\Projects\AutoMapper\src\UnitTests\Bug\ExpressionMapping.cs : line 272 | |
| Test Outcome: Failed | |
| Test Duration: 0:00:00.000645 | |
| Result StackTrace: | |
| Assert.Contains() failure: Not found: AutoMapper.UnitTests.Bug.ExpressionMapping+Parent | |
| at AutoMapper.UnitTests.AssertionExtensions.ShouldContain(IEnumerable items, Object item) in C:\Projects\AutoMapper\src\UnitTests\AssertionExtensions.cs:line 34 | |
| at AutoMapper.UnitTests.Bug.ExpressionMapping.Should_Validate() in C:\Projects\AutoMapper\src\UnitTests\Bug\ExpressionMapping.cs:line 117 |
OlderNewer