Open guillaume86 opened 13 years ago
Good question. I was originally going to support non-default constructors where the user could supply their own activator delegate, with the default being used if the user didn't specify one. However, I decided not to do this for simplicity so there really is no benefit to not using the new constraint with the current implementation.
ok thanks for the answer ;)
Hi,
I was looking at your Mapper.cs source code and was wondering why you didn't just use the "where T : new()" contraint and new T() contructor in place of your CreateActivatorDelegate method, since it will throw an exception if a parameterless constructor is not found anyway.
Actually I wrote myself a small lib for sql access and the my Mapper class looks pretty much like yours (same trick to set properties really fast ^^), the only difference I found is in the constuctor call.