Hi all,

I'm having a bizarre problem with the QueryForDictionary<T,T2> method. Specifically, the "keyProperty" parameter to the method.

I have a "Product" object with a "Sku" property that I would like to use as a key. If I specify "Sku" as the keyProperty, I get a "ProbeException" saying that "There is no Get member named 'Sku' in class 'Object'".

What's weird is that if I specify a keyProperty that does not exist in "Product", such as "SkuNotReallyAProperty", I get a "ProbeException" saying that "There is no Get member named 'SkuNotReallyAProperty' in class 'Product'".

It seems odd that when I specify a property that doesn't exist, the ObjectProbe is searching the correct type ("Product"), but when I specify a property that DOES exist, the ObjectProbe is searching the wrong type ("Object").

I've even tried using other properties as keys, ("Name", "Description", etc, which are all valid properties on the "Product" type) but still no joy. When using QueryForList<> on this same select statement, it works fine.

This is using DataMapper 1.6.1. Here's the invocation (search is just a string):

              products =
                  LocalSqlMap.QueryForDictionary<Sku, Product>(
"Product.GetProductsByManufacturerId", search + "%", "Sku");

Here's the line from the products data mapper:

  <select
    id="GetProductsByManufacturerId"
    parameterClass="string"
    resultMap="ResultMapProduct">
    SELECT
    <include refid="FragmentSelectProduct" />
    WHERE p.Active = 'Y'
    AND p.TheirId LIKE #value#
    ORDER BY p.SalesVolume DESC, p.DateAdded DESC
  </select>

Finally, here's a snippet from ResultMapProduct:

  <resultMap
    id="ResultMapProduct"
    class="Product"
    groupBy="Sku">
    <result
      column="ProductSku"
      property="Sku" />
    <!-- Stripped out miscellaneous other result mappings -->
  </resultMap>

What am I doing wrong? Thanks for any insight!

V/R,
Nicholas Piasecki

Reply via email to