Return-Path: Delivered-To: apmail-ibatis-dev-archive@www.apache.org Received: (qmail 9321 invoked from network); 11 Oct 2008 21:28:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Oct 2008 21:28:05 -0000 Received: (qmail 73992 invoked by uid 500); 11 Oct 2008 21:28:04 -0000 Delivered-To: apmail-ibatis-dev-archive@ibatis.apache.org Received: (qmail 73981 invoked by uid 500); 11 Oct 2008 21:28:04 -0000 Mailing-List: contact dev-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ibatis.apache.org Delivered-To: mailing list dev@ibatis.apache.org Received: (qmail 73970 invoked by uid 99); 11 Oct 2008 21:28:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Oct 2008 14:28:04 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Oct 2008 21:27:07 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 456A4234C219 for ; Sat, 11 Oct 2008 14:27:44 -0700 (PDT) Message-ID: <1877685132.1223760464283.JavaMail.jira@brutus> Date: Sat, 11 Oct 2008 14:27:44 -0700 (PDT) From: "Gilles Bayon (JIRA)" To: dev@ibatis.apache.org Subject: [jira] Closed: (IBATISNET-283) Result mappings should work with interfaces when QueryForObject is passed an existing object In-Reply-To: <1723176821.1223366264391.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/IBATISNET-283?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gilles Bayon closed IBATISNET-283. ---------------------------------- Resolution: Fixed Fix Version/s: DataMapper 3.0 DataMapper 1.6.2 in SVN > 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 > Assignee: Gilles Bayon > Fix For: DataMapper 1.6.2, DataMapper 3.0 > > > 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(); > ... > Mapper.Instance().QueryForObject("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.