jonwagner / Insight.Database

Fast, lightweight .NET micro-ORM
Other
861 stars 145 forks source link

FIXES #459 - fields with no setter and not used in constructor should… #461

Closed jonwagner closed 3 years ago

jonwagner commented 3 years ago

This fixes Issue #459.

It cleans up which columns are mapped and transformed when deserializing an object. I think it's a simple change, but since it's such a core method, I'd appreciate a second set of eyes before I do a build

resnikb commented 3 years ago

Hi John, The main logic looks good to me, but there may be an additional change that would be good to make on line 284, from:

if (constructor != null && constructor.GetParameters().Any(p => p.Name.IsIEqualTo(mapping.Member.Name)))

to

if (constructorMappings.Contains(index))

Cheers, Bojan

jonwagner commented 3 years ago

This is fixed in 6.3.7 (one small modification from this PR for old .net versions)