Code Monkey home page Code Monkey logo

moo's People

Contributors

dclucas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

moo's Issues

Issue: Convention mapper should prioritize direct conversion over property unfolding

Given the classes:
public class SampleClassA
{
public OtherClass Other { get; set }
public int OtherId { get; set; }
}

public class SampleClassB
{
public int OtherId { get; set; }
}

public class OtherClass
{
public int Id { get; set; }
}

A call to sampleObjA.Map() should map the two OtherId properties, instead of Other.Id to OtherId, as sometimes happens in the current code.

Current workaround is to create a manual mapping to override the convention.

Task: verify dynamic support

Check which level of coverage for dynamic objects Moo already has, through TDD. If functionalities are lacking, comment the tests and add defects for each one.

Issue with Mapping DateTime? to DateTime?

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.

Feature: Create base mapper class, for custom mapping extension

Keep BaseMapper for coders who are expanding the library, but provide developers a way to inherit mapping functionality and specialize it through code.

As in:

public class CustomerMVMMapper : Mapper<Customer, CustomerMVVM)
{
    public CustomerMVMMapper()
    {
        // this guy should inherit from composite mapper and upon this constructor call already have all the mapper stack ready.
        AddMapping( /* magic mapping here */);
    }
}

Feature: Add unit-test friendly features

Add features to help on client code unit tests. For example:

  1. Add events to:
  • When a property mapping is discovered;
  • When an object mapping begins/ends;
  • When a property is mapped;
    1. Add auxiliary methods to help determine:
  • Which source and target properties have been touched by the mapper;
  • Which haven't.

For the time being, this issue is a placeholder for the functionalities we can think of. Once we figure out which ones we want to implement, specific items will be created for them.

Feature: Create mapping provider interface and handling code

A user should be able to provide custom mapping for a given Source/Target combination by implementing a simple interface:

public class PersonPersonEditModelMappingProvider : MappingProvider<Person, PersonEditModel>
{
      public void AddMappings()
      {
            this.AddMapping()
               .From(s => s.Name + s.LastName)
               .To(t => t.FullName)
      }
}

The design needs to either have a base class that provides an AddMapping method or to provide an interface that receives a repo (or a new MappingAdder class or such) and uses it. While the interface is more easily testable, the base class enforces a segregation by source/target more easily.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.