Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Mapping DateTime? to DateTime? #10

Closed
DavidMGardner opened this issue Mar 5, 2014 · 3 comments
Closed

Issue with Mapping DateTime? to DateTime? #10

DavidMGardner opened this issue Mar 5, 2014 · 3 comments

Comments

@DavidMGardner
Copy link

I have a source object with a DateTime? and trying to map to a similar object with DateTime? I am getting this error.

Moo.MappingException : Error mapping from MatchManagement.Data.DomainEntities.Registration.MatchesAndEvents.EventEndDate to MatchManagement.UX.Models.Admin.MatchAndEvents.MatchAndEventViewModel.EventEndDate
----> System.InvalidOperationException : Operation is not valid due to the current state of the object.

@DavidMGardner
Copy link
Author

I should have mentioned that the DateTime? was null...

@dclucas
Copy link
Owner

dclucas commented Mar 13, 2014

Repro'd the issue, found a temporary workaround while I look for a final solution -- you can configure the mapper like this:

   MappingRepository.Default
                .AddMapping<MatchesAndEvents, MatchesAndEvents>()
                    .From(p => p.EventEndDate ?? DateTime.Now)
                    .To(p => p.EventEndDate);

This is definitely not the final solution (I intend to fix it in the following days), but that should unblock you while I do the fix.

@dclucas
Copy link
Owner

dclucas commented Mar 13, 2014

Version 0.9.1 has been released into Nuget, carrying the fix. Just tested it in the project I repro'ed it at first and everything looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants