/// <summary> /// /// </summary> /// <param name="configurationScope">The scope of the configuration</param> override internal void Initialize(ConfigurationScope configurationScope) { // the propertyName attribute on the selectKey node is optional if (PropertyName.Length > 0) { // Id is equal to the parent <select> node's "id" attribute IMappedStatement insert = configurationScope.SqlMapper.GetMappedStatement(Id); Type insertParameterClass = insert.Statement.ParameterClass; // make sure the PropertyName is a valid settable property of the <insert> node's parameterClass if (insertParameterClass != null && ObjectProbe.IsSimpleType(insertParameterClass) == false) { configurationScope.ErrorContext.MoreInfo = String.Format("Looking for settable property named '{0}' on type '{1}' for selectKey node of statement id '{2}'.", PropertyName, // 0 insert.Statement.ParameterClass.Name, // 1 Id); // 2 // we expect this to throw an exception if the property cannot be found; GetSetter is // called instead of HasWriteableProperty becuase we want the same wording for // property not found exceptions; GetSetter and HasWritableProperty both use the // same internal cache for looking up the ProperyInfo object ReflectionInfo.GetInstance(insert.Statement.ParameterClass).GetSetter(PropertyName); } } base.Initialize(configurationScope); }
internal override void Initialize(ConfigurationScope configurationScope) { if (this.PropertyName.Length > 0) { IMappedStatement mappedStatement = configurationScope.SqlMapper.GetMappedStatement(base.Id); Type parameterClass = mappedStatement.Statement.ParameterClass; if ((parameterClass != null) && !ObjectProbe.IsSimpleType(parameterClass)) { configurationScope.ErrorContext.MoreInfo = string.Format("Looking for settable property named '{0}' on type '{1}' for selectKey node of statement id '{2}'.", this.PropertyName, mappedStatement.Statement.ParameterClass.Name, base.Id); ReflectionInfo.GetInstance(mappedStatement.Statement.ParameterClass).GetSetter(this.PropertyName); } } base.Initialize(configurationScope); }