Comments (4)
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.
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.
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.
Looks like my issue already described, but I want confirm that issue exists. I have a sample which works perfectly
And have a PagedListConverter used in previous screenshot
Now I want to use generic method (in generic class) for selecting paged list collection (I'm using PagedList )
But the error occurs like mentioned in title of the issue
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)
- Problem with mapping nested objects having the same property names as parent object HOT 1
- Benchmarks HOT 3
- RegisterCustom and MapExists HOT 1
- Floating issue with mapping enum to class return null HOT 1
- Naming Case Convention
- Does not work with .NET Core 1.1 HOT 7
- "No parameterless constructor defined for this object" when map inherited class
- Need a small improvement to the flatten name matching HOT 6
- manage conditional mapping simply for merging
- Performance difference between v1.8.3 and v1.9.1 HOT 2
- The cache used by CompileNonGenericCustomTypeMapper is not thread-safe HOT 2
- Circular referencing leading to stackoverflow exception while converting my dbcontext object into DTO object
- Add to Benchmarks AgileMapper HOT 1
- After hook not setting property?
- ExpressMapper .net core production ready? HOT 1
- can I map only null or stringEmpty propety?
- Corrupting dictionary in multi-threaded environment HOT 1
- how to get the different fields/properies when before/after mapped ?
- Merge objects similarly to JS spread operator
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from expressmapper.