mausch/SolrNet — pull request #69 by Gonyoda (2013-03-27 19:11:10+00:00)
Title: Pull request: MappingManager bug fix, SolrFieldModel immutable

Hi mausch,

We use SolrNet extensively here at my job. We recently update to the very latest code base and found a few issues that I'd like to correct in the main branch.

1) The ISolrBasicOperations could use both overloads of the Delete method.
(we had lots of code that I could avoid changing if I kept the original Delete method that takes two parameters)

2) MappingManager recently had some changes to support setting properties for base classes. It sort of worked if you set fields in the parent class first, then the child class later (you had to skip over pre-existing fields or an exception would be thrown). It only worked if you did the child class first, but then the parent class wouldn't have any fields mapped. I fixed this by using DeclaringType instead of ReflectedType.

I feel the exception thrown if you happened to set the parent and child fields separately i unnecessary. Since the end result is the same, and it doesn't hurt anything to set fields, I don't feel that the exception should exist/be thrown. This is especially confusing when the code was built so that you can change the field name for a property on the same type, but not if it's on a inherited type (now you can).

I updated the unit tests to support this change confirm that the order of adding fields didn't matter, the results are still the same. Using DeclaringType allows child classes to override parent properties by using the new keyboard for the property if they need that ability. It does not support a parent class having one solr field name and the child class having a different solr field name for the same property.

3) I made SolrFieldModel immutable and changed coded throughout to support this change. I don't like the fact that I could change field settings outside of using an existing field mapper. (All I had to do was get at the SolrFieldModel instance and I could change field names at will - now you can't).

Thanks for your consideration.

-John Gonyo

PS: This is my first git pull request, so forgive me if it's poorly written/formatted/explained.