Giter Club home page Giter Club logo

batmap's People

Contributors

gitter-badger avatar jtone123 avatar umutozel avatar

Stargazers

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

Watchers

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

batmap's Issues

A bit strange benchmark results

It's a bit strange that HandWritten is not the first. BatMap is a really nice project, but benchmark result looks a bit strange. Looks like HandWrittensample has a bug, yes it's possible to do this kind of mapping but it's a bit inefficient. try to use ConverAll method, it'll remove all ToList methods (except one, IList does not have ConvertAll

like this

public void HandWritten()
{
	var customerDTOs = _customers.Select(c => new CustomerDTO
	{
		Id = c.Id,
		Addresses = c.Addresses.ConvertAll(a => new AddressDTO
		{
			City = new CityDTO
			{
				Id = a.City.Id,
				Name = a.City.Name,
				Population = a.City.Population
			},
			Detail = a.Detail,
			Id = a.Id
		}),
		CompanyName = c.CompanyName,
		Endorsement = c.Endorsement,
		Orders = c.Orders.ConvertAll(o => new OrderDTO
		{
			Id = o.Id,
			OrderDetails = o.OrderDetails.ConvertAll(od => new OrderDetailDTO
			{
				Id = od.Id,
				Count = od.Count,
				UnitPrice = od.UnitPrice
			}),
			OrderNo = o.OrderNo,
			Price = o.Price
		}),
		Phone = c.Phone
	}).ToList();
}

BTW, I think other mappers support collection mapping, so it's possible to map without ToList

For instance, there's no Select

        public void BatMap() {
            var customerDTOs = _customers.Map<Customer, CustomerDTO>().ToList();
        }

but here's Select and ToList

        [Benchmark]
        public void TinyMapper() {
            var customerDTOs = _customers.Select(c => Nelibur.ObjectMapper.TinyMapper.Map<Customer, CustomerDTO>(c)).ToList();
        }

        [Benchmark]
        public void ExpressMapper() {
            var customerDTOs = _customers.Select(c => global::ExpressMapper.Mapper.Map<Customer, CustomerDTO>(c)).ToList();
        }

for any performance comparisonce, it's really impotant compare the same things in an equeal environment.

Map<TIn, TOut>(src, dest)

apply mapping to an existing object.

possible use-case
user posts an update (using a DTO) to an existing object. the service loads the existing object from the DB, and then use the map(dto, entity) to apply the updates as required.

Example Usage

public void Update(PersonDto personDto) {
    var person = _session.Get<Person>(personDto.id);
    _mapper.Map(personDto, person);
}

note that the dto may only contain a subset of the entity properties

"Ambiguous match found" when getting property

Reported by: tungtrungvn

BatMap version

1.1.12

Steps to reproduce

It happens when we use "new" keyword to hide property from parent class

Expected behavior

Should use property from inherited class

Actual behavior

Throws "Ambiguous match found" exception

Doesn't detect ThenInclude navigations from queries

BatMap version

1.1.2

Steps to reproduce

Using ThenInclude with queries

Expected behavior

Should map all Include and ThenInclude navigations

Actual behavior

Only maps Include navigations, skips ThenInclude navigations

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.