Git Product home page Git Product logo

Comments (4)

FSou1 avatar FSou1 commented on July 29, 2024

Entities.Requirement. See the inner exception for details. ---> System.MissingMethodException: No parameterless constructor defined for this object.

Are you sure that you don't have constructor for a Requirement entity? It's declared with a partial keyword.

from expressmapper.

SuheylZ avatar SuheylZ commented on July 29, 2024

that is a class generated by Entity Framework, hence the partial keyword. but No, it cab be instantiated on its own and that's how I have used it in the code.
that's exactly what's problem that i can't figure out even after spending hours. why does it complain about not having a default constructor.
and here is what i call brain fuck. the two classes when combined with other classes, expressmapper does not complain about any default constructor for either of them and they work. so what's so special about this combination? do these classes hate each other?

from expressmapper.

SuheylZ avatar SuheylZ commented on July 29, 2024

from the documentation I tried this so that it would not have to create the object itself but it still gives the same error.

            p.Register<EquipmentRequirementEditModel, Requirement>()
                    .InstantiateFunc((s) => {
                        var t = new Requirement();
                        t.IsPrimary = true;
                        return t;
                    })
                    .Member(t => t.RequirementTitle, s => s.Title)
                    .Member(t => t.Requirement1, s => s.Maintanence)
                    .Member(t => t.Requirement2, s => s.Tools)
                    .Member(t => t.Notes, s => s.Notes)
                    .After((s, t) =>
                    {
                        t.FacilityId = s.Facility.Selection;
                        t.FrequencyId = s.Frequency.Selection;
                        t.PostId = s.Position.Selection;
                    })
                    .CompileTo(CompilationTypes.Destination);

from expressmapper.

Calabonga avatar Calabonga commented on July 29, 2024

Looks like my issue already described, but I want confirm that issue exists. I have a sample which works perfectly
image

And have a PagedListConverter used in previous screenshot
image

Now I want to use generic method (in generic class) for selecting paged list collection (I'm using PagedList )
image

But the error occurs like mentioned in title of the issue
image

I don't understand why it happens because in first screenshot code this mapping works perfectly. Furthermore, all used Models and ViewModels have default constructor. Concerning PagedList, a specilficallly for that is used PagedListResolver (it works great in second screenshot).

I'm trying to use your mapper instead if my favorite (for this time) AutoMapper. If I can resolve this issue, your mapper become my favorite (for many reasons). Please help!

from expressmapper.

Related Issues (20)

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.