-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: Revisits the Immutable Classes Instantiation #753
Comments
As part of the enhancement in order for the user to be notified of the ctor arguments problem, we will throw an exception instead, rather than passing the default value. The message below will be thrown System.MissingMemberException: 'The following ctor arguments ('extra') for type 'RepoDb.IntegrationTests.ImmutableTest+ImmutableWithUnmatchedCtorArgumentsFromMultipleCtors' are not matching from any of the resultset fields returned by the data reader object.' If the |
To simplify the things for this library and to avoid the confusion to the users whether which ctor is being called, we will always utilize the ctor with most number of arguments. If there are misalignment between the model properties and the data reader resultset fields, a descriptive exception message will be thrown back to the user. See the sample message below.
Through this descriptive exception message, the user might be able to pinpoint the problem easily. In the sample above, the argument |
Describe the enhancement
As a referenced to this issue #748 and to some various reports via GitterChat, the existing code for the classes with extra ctros were affected when the users upgraded the library from the version below v1.11.x to >= v1.12x. This is because the support to the immutable classes has been supported on this version.
Though we clearly explained it here, but I think, it is good if we can further optimize how the immutable classes instantiation behaved.
It is better if we can support the below.
FYI: @kbilsted
The text was updated successfully, but these errors were encountered: