Result mappings should work with interfaces when QueryForObject is passed an existing object --------------------------------------------------------------------------------------------
Key: IBATISNET-283 URL: https://issues.apache.org/jira/browse/IBATISNET-283 Project: iBatis for .NET Issue Type: Bug Components: DataMapper Affects Versions: DataMapper 1.6.1 Reporter: Richard Banks In the IBatisNet.DataMapper.DataExchange.DotNetObjectDataExchange class the method public override void SetData(ref object target, ResultProperty mapping, object dataBaseValue) does a check against types using this statement: if ((type != this._parameterClass) && !type.IsSubclassOf(this._parameterClass)) The problem here is that IsSubclassOf doesn't check for interface implementations. When _parameterClass is an interface you also need to check using type.GetInterfaces().Contains(this._parameterClass) This would then allow for result mappings to use interfaces, which is really useful when you are using an IoC container to instantiate the class being populated, for example: ISale sale = Container.Resolve<ISale>(); ... Mapper.Instance().QueryForObject<ISale>("uspSelectSale", saleNumber, sale); Thanks -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.