Coder Social home page Coder Social logo

Comments (3)

kfinley avatar kfinley commented on July 29, 2024

Good catch. I've never run into this issue. Feel free to add a PR with the fix if you'd like.

I don't use this utility for anything anymore but I can make the change at some point.

from typemerger.

prince272 avatar prince272 commented on July 29, 2024

I use the utility for merging data alot instead of building a whole duplicate of a model in come causes where model are not needed. Take a look at this code:

   [HttpGet("")]
    public async Task<IActionResult> Populate(int? limit, [FromQuery] CourseFilter filter)
    {
        var result = await courseService.PopulateAsync(limit, filter);

        if (!result.Success) return StatusCode(result.Code, result);

        var courseList = (Page<Course>)result.Data;

        result.Data = TypeMerger.Ignore(() => courseList.Items).Merge(new
        {
            Items = courseList.Items.Select(course => TypeMerger.Merge(new
            { ImageUrl = assetService.GetPublicUrl(course.Image) }, course))
        }, courseList);

        return StatusCode(result.Code, result);
    }

You'll notice that TypeMerger was used to merge image url into the data and return result.

from typemerger.

kfinley avatar kfinley commented on July 29, 2024

This is exactly what I used this for as well. I'm glad to hear you get use out of it.

I'll push out an update with the fix today or tomorrow. Thanks again for reporting the issue.

from typemerger.

Related Issues (6)

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.