Project DateTime to DateTimeOffset? #3680
-
Source/destination typesusing System;
using System.Linq;
using AutoMapper;
using AutoMapper.QueryableExtensions;
var mapping = new MapperConfiguration(x =>
{
x.CreateMap<Foo, Bar>();
});
var foos = Enumerable.Empty<Foo>();
var mapped = foos.AsQueryable().ProjectTo<Bar>(mapping);
Console.WriteLine(mapped.Count());
public class Foo
{
public int Id { get; set; }
public DateTime ShiftStart { get; set; }
public DateTime ShiftEnd { get; set; }
}
public class Bar
{
public int Id { get; set; }
public DateTimeOffset? ShiftStart { get; set; }
public DateTimeOffset? ShiftEnd { get; set; }
} Mapping configurationVersion: x.y.z10.1.1 Expected behaviorThis works with 10.0.0 Actual behavior
Steps to reproduce// Your calls to Mapper.Map or ProjectTo here, with source/destination objects constructed |
Beta Was this translation helpful? Give feedback.
Answered by
lbargaoanu
Jul 5, 2021
Replies: 1 comment 2 replies
-
I don't think this needs to be a built in conversion. Just add the needed map. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
cheng93
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't think this needs to be a built in conversion. Just add the needed map.