NHibernate's Setresulttransformer method bug fixes under Oracle

Source: Internet
Author: User

The Setresulttransformer method of NHibernate will appear under Oracle "Could not find a setter-for-property" error, which is a bug that NHibernate uses under Oracle. I can fix it myself for this bug.

Download the NHibernate source code, the property under the "ChainedPropertyAccessor.cs" minor changes will fix this bug, the codes are as follows:

using system;namespace nhibernate.properties{    using  System.text.regularexpressions;    [serializable]    public class  ChainedPropertyAccessor : IPropertyAccessor    {         private readonly IPropertyAccessor[] chain;         public chainedpropertyaccessor (Ipropertyaccessor[] chain)          {             this.chain = chain;        }          #region  IPropertyAccessor Members         Public igetter getgetter (System.type theclass, string propertyname)          {            for  (int i = 0; i <  chain. length; i++)             {                 ipropertyaccessor candidate  = chain[i];                 try                 {                     return candidate. Getgetter (Theclass, propertyname);                 }                 catch  (propertynotfoundexception) &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&Nbsp;          {                     // ignore                 }             }             throw new propertynotfoundexception (theclass, propertyname,  "getter");         }        public ISetter  Getsetter (System.type theclass, string propertyname)          {            for  (int i =  0; i < chain. length; i++)             {                 ipropertyaccessor  candidate = chain[i];                 try                 {                     return candidate. Getsetter (Theclass, tomodelname (PropertyName));                 }                 catch  (propertynotfoundexception)                  {                     //                }             }             throw new propertynotfoundexception (theclass, propertyname,  "setter");         }        public bool  CanAccessThroughReflectionOptimizer        {             get { return false; }         }         #endregion          private static string tomodelname (STRING&NBSP;STR)          {             str = str. ToloweR ();            var temp =  Regex.Replace (str, @ "_[a-z"?, M=>m.tostring (). Substring (1). ToUpper ());             var result =  regex.replace (temp, @ "^[a-z"?,  m => m.tostring (). ToUpper ());            return result;         }    }}


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.