This project has moved and is read-only. For the latest updates, please go here.

Null reference exception in MapperBase.cs


Hello, and thank you for sharing this project under a BSD license.

Please refer to Commit 32724. I have made (very minor) adjustments to add support fro EF 6.1.3, with the exception of Spatial types which are failing but not my main focus. MapperBase is throwing a null reference exception on the "Precision" facet when I test with Postgres backing EF. The exception is not thrown with SQL Server backing EF. I speculate that the Npgsql provider for EF6 may not be as robust as Microsoft's SqlServer provider. That said, it is desirable for EF.MappingAPI to "fail gracefully" when a provider fails to fulfill a contract. I'm not saying that's happening in this case. but I do think it's a possibility.

I made a quick change to set the byte to 0 if the Precision facet is null. This prevents the exception and appears to work well in our application, but I do not know if this choice is appropriate in general. Other facets have the potential to be null also, but so far I have only seen it happen with Precision.

This project is valuable to us, because it is consumed by tracker-enabled-dbcontext, which is very easy to use and unobtrusive.