protected virtual object CreateValue() { if (this.Type == null) { return(null); } try { object result = PluginUtility.BuildType(this.Type, (Type parameterType, string parameterName, out object parameterValue) => { return(PluginUtility.ObtainParameter(this.Plugin, parameterType, parameterName, out parameterValue)); }); if (result == null) { throw new PluginException(string.Format("Can not build instance of '{0}' type, Maybe that's cause type-generator not found matched constructor with parameters. in '{1}' plugin.", this.Type.FullName, this.Plugin)); } return(result); } catch (Exception ex) { throw new PluginException(string.Format("Occurred an exception on create a fixed-element instance of '{0}' type, at '{1}' plugin.", this.Type.FullName, this.Plugin), ex); } }
public static object BuildBuiltin(Builtin builtin, IEnumerable <string> ignoredProperties = null) { if (builtin == null) { throw new ArgumentNullException("builtin"); } var result = PluginUtility.BuildType(builtin); //设置更新目标对象的属性集 if (result != null) { UpdateProperties(result, builtin, ignoredProperties); } return(result); }