private static IQueryable <T> Select <T>(IQueryable <T> data, Dictionary <string, object> filter) where T : class, IGenericSortable { data = data.OrderBy(g => g.LocalOrdering); var dataType = typeof(T); foreach (var kvp in filter) { var propInfo = dataType.GetPropertiesRecursively(p => p.Name == kvp.Key).Single(); var propType = propInfo.PropertyType; var paramExpr = Expression.Parameter(dataType); var propExpr = Expression.Property(paramExpr, propInfo); var value = ValueTypeConverter.Convert(kvp.Value, propType); var valueExpr = Expression.Constant(value); var equalExpr = Expression.Equal(propExpr, valueExpr); var lambda = Expression.Lambda <Func <T, bool> >(equalExpr, paramExpr); data = data.Where(lambda); } return(data); }
private object ExtractKeyValue(string internalDataUrl) { int openBracketIndex = internalDataUrl.IndexOf("(", StringComparison.Ordinal); if (openBracketIndex < 0) { return(null); } int closingBracketOffset = internalDataUrl.IndexOf(")", openBracketIndex + 1, StringComparison.Ordinal); if (closingBracketOffset < 0) { return(null); } string dataIdStr = internalDataUrl.Substring(openBracketIndex + 1, closingBracketOffset - openBracketIndex - 1); object keyValue = ValueTypeConverter.Convert(dataIdStr, _keyType); if (keyValue == null || (keyValue is Guid && (Guid)keyValue == Guid.Empty)) { return(null); } return(keyValue); }
/// <exclude /> public static object Deserialize(XAttribute attribute, Type type) { if (type == typeof(string)) { return((string)attribute); } if (type == typeof(double) || type == typeof(double?)) { return((double)attribute); } if (type == typeof(float) || type == typeof(float?)) { return((float)attribute); } if (type == typeof(decimal) || type == typeof(decimal?)) { return((decimal)attribute); } if (type == typeof(DateTime) || type == typeof(DateTime?)) { return((DateTime)attribute); } if (type == typeof(DateTimeOffset) || type == typeof(DateTimeOffset?)) { return((DateTimeOffset)attribute); } if (type == typeof(TimeSpan) || type == typeof(TimeSpan?)) { return((TimeSpan)attribute); } return(ValueTypeConverter.Convert(attribute.Value, type)); }
internal ForeignPropertyInfo(PropertyInfo sourcePropertyInfo, Type targetType, string targetKeyPropertyName, bool allowCascadeDeletes, object nullReferenceValue, Type nullReferenceValueType, bool isNullableString) : this(sourcePropertyInfo, targetType, targetKeyPropertyName, allowCascadeDeletes, isNullableString) { this.NullReferenceValue = ValueTypeConverter.Convert(nullReferenceValue, sourcePropertyInfo.PropertyType); this.NullReferenceValueType = nullReferenceValueType; this.IsNullReferenceValueSet = true; }
private static Dictionary <string, object> BuildTestParameterInput(IEnumerable <ManagedParameterDefinition> parameters) { Dictionary <string, object> inputValues = new Dictionary <string, object>(); foreach (ManagedParameterDefinition parameterDefinition in parameters) { object value = null; if (string.IsNullOrEmpty(parameterDefinition.TestValueFunctionMarkup) == false) { FunctionRuntimeTreeNode functionNode = (FunctionRuntimeTreeNode)FunctionTreeBuilder.Build(XElement.Parse(parameterDefinition.TestValueFunctionMarkup)); value = functionNode.GetValue(); } else { if (string.IsNullOrEmpty(parameterDefinition.DefaultValueFunctionMarkup) == false) { FunctionRuntimeTreeNode functionNode = (FunctionRuntimeTreeNode)FunctionTreeBuilder.Build(XElement.Parse(parameterDefinition.DefaultValueFunctionMarkup)); value = functionNode.GetValue(); } } if (value != null) { if (parameterDefinition.Type.IsAssignableFrom(value.GetType()) == false) { value = ValueTypeConverter.Convert(value, parameterDefinition.Type); } inputValues.Add(parameterDefinition.Name, value); } } return(inputValues); }
public RelativeRoute GetRoute(TValue fieldValue, bool searchSignificant) { if (!typeof(TValue).IsValueType && fieldValue == null) { return(null); } string stringValue; if (IsGuidField) { stringValue = UrlUtils.CompressGuid((fieldValue as Guid?).Value); } else if (IsStringField) { stringValue = searchSignificant ? UrlUtils.EncodeUrlInvalidCharacters(fieldValue as string) : StringToUrlPart(fieldValue as string); } else { stringValue = ValueTypeConverter.Convert <string>(fieldValue); } return(new RelativeRoute { PathSegments = new[] { stringValue } }); }
public bool RemovePersistedAttachmentPoint(string treeId, Type interfaceType, object keyValue) { string serializedInterfaceType = TypeManager.SerializeType(interfaceType); string serializedKeyValue = ValueTypeConverter.Convert <string>(keyValue); bool removed = false; using (var transactionScope = TransactionsFacade.CreateNewScope()) { IEnumerable <IDataItemTreeAttachmentPoint> dataItemTreeAttachmentPoints = (from d in DataFacade.GetData <IDataItemTreeAttachmentPoint>() where d.InterfaceType == serializedInterfaceType && d.KeyValue == serializedKeyValue && d.TreeId == treeId select d).Evaluate(); if (dataItemTreeAttachmentPoints.Any()) { DataFacade.Delete <IDataItemTreeAttachmentPoint>(dataItemTreeAttachmentPoints); removed = true; } transactionScope.Complete(); } return(removed); }
private XElement SerializeAction(ActionInformation action) { var result = new XElement("Action"); result.Add(new XAttribute(Namespaces.XmlNs + "f", Namespaces.Function10.NamespaceName)); result.Add(new XAttribute("name", action.ConfigurationElement.Name)); foreach (var parameter in action.ParameterValues) { var profile = action.ParameterProfiles.Single(p => p.Name == parameter.Item1); object value = parameter.Item2; if (value == profile.GetDefaultValue()) { continue; } string serializedValue = (string)ValueTypeConverter.Convert(parameter.Item2, typeof(string)); result.Add(new XElement(Namespaces.Function10 + "param", new XAttribute("name", parameter.Item1), new XAttribute("value", serializedValue))); } return(result); }
internal override void Initialize() { this.PropertyInfo = this.OwnerNode.InterfaceType.GetPropertiesRecursively().Where(f => f.Name == this.FieldName).SingleOrDefault(); if (this.PropertyInfo == null) { AddValidationError("TreeValidationError.Common.MissingProperty", this.OwnerNode.InterfaceType, this.FieldName); return; } try { this.ConvertedValue = ValueTypeConverter.Convert(this.FieldValue, this.PropertyInfo.PropertyType); } catch { AddValidationError("TreeValidationError.FieldFilter.ValueCouldNotBeConverted", this.FieldValue, this.PropertyInfo.PropertyType); } if ((this.PropertyInfo.PropertyType == typeof(string)) || (this.PropertyInfo.PropertyType == typeof(Guid))) { if ((this.Operator != FieldFilterNodeOperator.Equal) && (this.Operator != FieldFilterNodeOperator.Inequal)) { AddValidationError("TreeValidationError.FieldFilter.OperatorNotSupportedForType", this.Operator, this.PropertyInfo.PropertyType); } } }
/// <exclude /> public object GetParameterValue(string parameterName, Type targetType) { Verify.ArgumentNotNullOrEmpty(parameterName, "parameterName"); if (_parameterList != null) { return(_parameterList.GetParameter(parameterName, targetType)); } if (_parameterDictionary != null) { Verify.That(_parameterDictionary.ContainsKey(parameterName), "Parameter '{0}' hasn't been defined.", parameterName); object value = _parameterDictionary[parameterName]; if (value != null && !targetType.IsInstanceOfType(value)) { return(ValueTypeConverter.Convert(value, targetType)); } return(value); } throw new InvalidOperationException("Unable to get parameter values. This context has been constructed without parameters."); }
private void SetNewInstanceFieldDefaultValues(IData data) { Type interfaceType = data.DataSourceId.InterfaceType; List <PropertyInfo> properties = interfaceType.GetPropertiesRecursively(); foreach (PropertyInfo propertyInfo in properties) { try { var attribute = propertyInfo.GetCustomAttributesRecursively <NewInstanceDefaultFieldValueAttribute>().SingleOrDefault(); if (attribute == null || !attribute.HasValue) { continue; } if (!propertyInfo.CanWrite) { Log.LogError(LogTitle, string.Format("The property '{0}' on the interface '{1}' has defined a standard value, but no setter", propertyInfo.Name, interfaceType)); continue; } object value = attribute.GetValue(); value = ValueTypeConverter.Convert(value, propertyInfo.PropertyType); PropertyInfo targetPropertyInfo = data.GetType().GetProperties().Single(f => f.Name == propertyInfo.Name); targetPropertyInfo.SetValue(data, value, null); } catch (Exception ex) { Log.LogError(LogTitle, string.Format("Failed to set the standard value on the property '{0}' on the interface '{1}'", propertyInfo.Name, interfaceType)); Log.LogError(LogTitle, ex); } } }
private void LoadParameterValues() { _parameterValues = new List <Tuple <string, object> >(); foreach (XElement parameterNode in _fieldXml.Elements()) { string parameterName = (string)parameterNode.Attribute("name"); var parameterProfile = _parameterProfiles.FirstOrDefault(p => p.Name == parameterName); Verify.IsNotNull(parameterProfile, "Parameter '{0}' hasn't been defined".FormatWith(parameterName)); // TODO: Support for <f:paramelement ... /> string stringValue = (string)parameterNode.Attribute("value"); object value = ValueTypeConverter.Convert(stringValue, parameterProfile.Type); _parameterValues.Add(new Tuple <string, object>(parameterName, value)); } var parametersWithDefaultValues = _parameterProfiles.Where(p => !_parameterValues.Any(pv => pv.Item1 == p.Name)); foreach (var parameterProfile in parametersWithDefaultValues) { var defaultValue = parameterProfile.GetDefaultValue(); _parameterValues.Add(new Tuple <string, object>(parameterProfile.Name, defaultValue)); } }
private static XElement AddData(DataType dataType, CultureInfo cultureInfo) { XElement datasElement = new XElement("Datas"); if (cultureInfo != null) { datasElement.Add(new XAttribute("locale", cultureInfo.Name)); } foreach (XElement addElement in dataType.Dataset) { IData data = DataFacade.BuildNew(dataType.InterfaceType); if (!dataType.InterfaceType.IsInstanceOfType(data)) { dataType.InterfaceType = GetInstalledVersionOfPendingType(dataType.InterfaceType, data); } var properties = GetDataTypeProperties(dataType.InterfaceType); foreach (XAttribute attribute in addElement.Attributes()) { string fieldName = attribute.Name.LocalName; if (IsObsoleteField(dataType, fieldName)) { continue; } PropertyInfo propertyInfo = properties[fieldName]; propertyInfo.SetValue(data, ValueTypeConverter.Convert(attribute.Value, propertyInfo.PropertyType), null); } ILocalizedControlled localizedControlled = data as ILocalizedControlled; if (localizedControlled != null) { localizedControlled.SourceCultureName = LocalizationScopeManager.MapByType(dataType.InterfaceType).Name; } DataFacade.AddNew(data, false, true, false); // Ignore validation, this should have been done in the validation face XElement keysElement = new XElement("Keys"); foreach (PropertyInfo propertyInfo in data.GetKeyProperties()) { string keyName = propertyInfo.Name; object keyValue = propertyInfo.GetValue(data, null); XElement keyElement = new XElement("Key", new XAttribute("name", keyName), new XAttribute("value", keyValue)); keysElement.Add(keyElement); } datasElement.Add(keysElement); } return(datasElement); }
private static void OnDataItemDeleted(object sender, DataEventArgs dataEventArgs) { Type interfaceType = dataEventArgs.Data.DataSourceId.InterfaceType; if (typeof(IPublishControlled).IsAssignableFrom(interfaceType) && !dataEventArgs.Data.DataSourceId.DataScopeIdentifier.Equals(DataScopeIdentifier.Administrated)) { return; // Only remove attachment point if its the admin version of a publishable data item that have been delete } if (typeof(ILocalizedControlled).IsAssignableFrom(interfaceType) && DataFacade.ExistsInAnyLocale(interfaceType, dataEventArgs.Data.DataSourceId.LocaleScope)) { return; // Data exists in other locales, so do not remove this attachment point } PropertyInfo propertyInfo = interfaceType.GetKeyProperties()[0]; string keyValue = ValueTypeConverter.Convert <string>(propertyInfo.GetValue(dataEventArgs.Data, null)); IEnumerable <IDataItemTreeAttachmentPoint> attachmentPoints = from d in DataFacade.GetData <IDataItemTreeAttachmentPoint>() where d.InterfaceType == TypeManager.SerializeType(interfaceType) && d.KeyValue == keyValue select d; DataFacade.Delete <IDataItemTreeAttachmentPoint>(attachmentPoints); }
public Expression <Func <TField, bool> > GetPredicate(Guid pageId, RelativeRoute relativeRoute) { var dataPredicate = _dataTypeMapper.GetPredicate(pageId, relativeRoute); if (dataPredicate == null) { return(null); } var data = DataFacade.GetData <TDataType>(dataPredicate).Evaluate(); if (data.Count == 0) { return(null); } if (data.Count > 1) { throw new DataUrlCollisionException(typeof(TDataType), relativeRoute); } var keyObject = data.First().GetUniqueKey(); var key = ValueTypeConverter.Convert <TField>(keyObject); var paramExpr = Expression.Parameter(typeof(TField)); var body = Expression.Equal(paramExpr, Expression.Constant(key)); return(Expression.Lambda <Func <TField, bool> >(body, paramExpr)); }
private XElement SerializeFormElement() { var result = new XElement("Field"); result.Add(new XAttribute(Namespaces.XmlNs + "f", Namespaces.Function10.NamespaceName)); result.Add(new XAttribute("name", (string)_fieldXml.Attribute("name"))); foreach (var parameter in _parameterValues) { var profile = _parameterProfiles.Single(p => p.Name == parameter.Item1); object value = parameter.Item2; if (value == profile.GetDefaultValue()) { continue; } string serializedValue = (string)ValueTypeConverter.Convert(parameter.Item2, typeof(string)); result.Add(new XElement(Namespaces.Function10 + "param", new XAttribute("name", parameter.Item1), serializedValue != null ? new XAttribute("value", serializedValue) : null)); } return(result); }
/// <exclude /> public object GetDefaultValue() { // Initializing the binding object value = null; try { var fallbackValueProvider = FallbackValueProvider; if (!(fallbackValueProvider is NoValueValueProvider)) { object defaultValue = fallbackValueProvider.GetValue(); if (defaultValue != null) { value = ValueTypeConverter.Convert(defaultValue, this.Type); } } } catch (Exception ex) { Log.LogWarning(typeof(ParameterProfile).Name, ex); } if (value == null) { if (this.Type == typeof(bool)) { value = false; } } return(value); }
public bool AddPersistedAttachmentPoint(string treeId, Type interfaceType, object keyValue, ElementAttachingProviderPosition position = ElementAttachingProviderPosition.Top) { var attachmentPoint = DataFacade.BuildNew <IDataItemTreeAttachmentPoint>(); attachmentPoint.Id = Guid.NewGuid(); attachmentPoint.TreeId = treeId; attachmentPoint.Position = position.ToString(); attachmentPoint.InterfaceType = TypeManager.SerializeType(interfaceType); attachmentPoint.KeyValue = ValueTypeConverter.Convert <string>(keyValue); bool added = false; using (var transactionScope = TransactionsFacade.CreateNewScope()) { bool exist = (from d in DataFacade.GetData <IDataItemTreeAttachmentPoint>() where d.InterfaceType == attachmentPoint.InterfaceType && d.KeyValue == attachmentPoint.KeyValue && d.TreeId == treeId select d).Any(); if (!exist) { DataFacade.AddNew <IDataItemTreeAttachmentPoint>(attachmentPoint); added = true; } transactionScope.Complete(); } return(added); }
private void LoadParameterValues(ActionInformation action) { var parameterValues = new List <Tuple <string, object> >(); if (action.Element != null) { foreach (XElement parameterNode in action.Element.Elements()) { string parameterName = (string)parameterNode.Attribute("name"); var parameterProfile = action.ParameterProfiles.FirstOrDefault(p => p.Name == parameterName); Verify.IsNotNull(parameterProfile, "There's no parameter named '{0}' on the function representing action '{1}'", parameterName, action.ConfigurationElement.Name); // TODO: Support for <f:paramelement ... /> string stringValue = (string)parameterNode.Attribute("value"); object value = ValueTypeConverter.Convert(stringValue, parameterProfile.Type); parameterValues.Add(new Tuple <string, object>(parameterName, value)); } } action.ParameterValues = parameterValues; }
private static DataKeyPropertyCollection CopyFieldValues(DataType dataType, IData data, XElement addElement) { var dataKeyPropertyCollection = new DataKeyPropertyCollection(); var properties = GetDataTypeProperties(dataType.InterfaceType); foreach (XAttribute attribute in addElement.Attributes()) { string fieldName = attribute.Name.LocalName; if (IsObsoleteField(dataType, fieldName)) { continue; } PropertyInfo propertyInfo = properties[fieldName]; object fieldValue = ValueTypeConverter.Convert(attribute.Value, propertyInfo.PropertyType); propertyInfo.SetValue(data, fieldValue, null); if (dataType.InterfaceType.GetKeyPropertyNames().Contains(fieldName)) { dataKeyPropertyCollection.AddKeyProperty(fieldName, fieldValue); } } return(dataKeyPropertyCollection); }
private void PackPageTree(PackageCreator pc, Guid pageId, bool isRoot = false) { var page = PageManager.GetPageById(pageId, true); if (page == null) // Page does not exists in current locale { return; } foreach (var childPageId in PageManager.GetChildrenIDs(pageId)) { if (pc.ExcludedIds.Contains(childPageId)) { continue; } PackPageTree(pc, childPageId); } foreach (var dataScopeIdentifier in DataFacade.GetSupportedDataScopes(typeof(IPage))) { using (new DataScope(dataScopeIdentifier)) { var pageinScope = PageManager.GetPageById(pageId, true); if (pageinScope != null) { pc.AddData(pageinScope); pc.AddData <IPagePlaceholderContent>(dataScopeIdentifier, d => d.PageId == pageId); } } } if (isRoot) { using (new DataScope(DataScopeIdentifier.Public)) { var pageStructure = DataFacade.BuildNew <IPageStructure>(); pageStructure.Id = pageId; pageStructure.ParentId = Guid.Empty; pageStructure.LocalOrdering = PageManager.GetLocalOrdering(pageId); pc.AddData(pageStructure); } } else { pc.AddData <IPageStructure>(d => d.Id == pageId); } if (IncludeData) { pc.AddData <IDataItemTreeAttachmentPoint>(d => d.KeyValue == ValueTypeConverter.Convert <string>(pageId)); pc.AddData <IPageFolderDefinition>(d => d.PageId == pageId); foreach (Type folderType in page.GetDefinedFolderTypes()) { pc.AddData(folderType, d => (d as IPageRelatedData).PageId == pageId); } } }
/// <exclude /> public Dictionary <string, string> BindingsToObject(Dictionary <string, object> bindings, IData dataObject) { var errorMessages = new Dictionary <string, string>(); foreach (var fieldDescriptor in _dataTypeDescriptor.Fields) { if (_readOnlyFields.Contains(fieldDescriptor.Name)) { continue; } var bindingName = GetBindingName(fieldDescriptor); if (!bindings.ContainsKey(bindingName)) { Verify.That(fieldDescriptor.IsNullable, "Missing value for field '{0}'", fieldDescriptor.Name); continue; } var propertyInfo = dataObject.GetType().GetProperty(fieldDescriptor.Name); if (propertyInfo.CanWrite) { var newValue = bindings[bindingName]; if (newValue is string && (newValue as string) == "" && IsNullableStringReference(propertyInfo)) { newValue = null; } try { newValue = ValueTypeConverter.Convert(newValue, propertyInfo.PropertyType); propertyInfo.GetSetMethod().Invoke(dataObject, new[] { newValue }); } catch (Exception ex) { errorMessages.Add(bindingName, ex.Message); } } } if (_showPublicationStatusSelector && _dataTypeDescriptor.SuperInterfaces.Contains(typeof(IPublishControlled))) { var publishControlled = dataObject as IPublishControlled; publishControlled.PublicationStatus = (string)bindings[PublicationStatusBindingName]; } if (errorMessages.Count > 0) { return(errorMessages); } return(null); }
/// <exclude /> public IEnumerable <IData> GetDataList() { Type type = TypeManager.GetType(this.Type); object id = ValueTypeConverter.Convert(this.Id, type.GetKeyProperties()[0].PropertyType); var datas = DataFacade.TryGetDataVersionsByUniqueKey(type, id); return(datas); }
/// <exclude /> public IData GetData() { Type type = TypeManager.GetType(this.Type); object id = ValueTypeConverter.Convert(this.Id, type.GetKeyProperties()[0].PropertyType); IData data = DataFacade.TryGetDataByUniqueKey(type, id); return(data); }
public List <Element> GetChildren(T data, EntityToken parentEntityToken) { var children = new List <Element>(); PropertyInfo idPropertyInfo = typeof(T).GetKeyProperties()[0]; foreach (Type type in PageFolderFacade.GetDefinedFolderTypes((IPage)data).OrderBy(t => t.Name)) { var entityToken = new AssociatedDataElementProviderHelperEntityToken( TypeManager.SerializeType(typeof(T)), _elementProviderContext.ProviderName, ValueTypeConverter.Convert <string>(idPropertyInfo.GetValue(data, null)), TypeManager.SerializeType(type) ); DataTypeDescriptor dataTypeDescriptor = DynamicTypeManager.GetDataTypeDescriptor(type); var element = new Element(_elementProviderContext.CreateElementHandle(entityToken)) { VisualData = new ElementVisualizedData { Label = dataTypeDescriptor.Title ?? type.Name, ToolTip = dataTypeDescriptor.Title ?? type.Name, Icon = this.InterfaceClosedIcon, OpenedIcon = this.InterfaceOpenIcon, HasChildren = true // This is sat to always true to boost performance. } }; element.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Elements.ElementProviderHelpers.AssociatedDataElementProviderHelper.DeleteDataFolderWorkflow"), RemoveAssociatedTypePermissionTypes))) { VisualData = new ActionVisualizedData { Label = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.RemoveAssociatedTypeLabel"), ToolTip = StringResourceSystemFacade.GetString("Composite.Management", "AssociatedDataElementProviderHelper.RemoveAssociatedTypeToolTip"), Icon = this.RemoveDataAssociationTypeIcon, Disabled = false, ActionLocation = new ActionLocation { ActionType = ActionType.Delete, IsInFolder = false, IsInToolbar = false, ActionGroup = AppendedActionGroup } } }); AddAddAssociatedDataAction(element, true); children.Add(element); } return(children); }
private string GetContinuationToken(IData data, PublicationScope publicationScope) { if (_interfaceType.GetKeyProperties().Count > 1) { return(null); // Not supported } var key = data.GetUniqueKey(); string keyStr = ValueTypeConverter.Convert <string>(key); return($"{publicationScope}:{keyStr}"); }
public PageUrlData GetPageUrlData(IDataReference reference) { if (reference == null || !reference.IsSet) { return(null); } Verify.That(reference.ReferencedType == _dataType, "Unexpected type of data reference"); Guid pageId; if (_pageId.HasValue) { pageId = _pageId.Value; } else { if (!typeof(IPageRelatedData).IsAssignableFrom(reference.ReferencedType)) { // Cannot resolve a url for a global data type without a global url mapper return(null); } IData data = reference.Data; if (data == null) { return(null); } pageId = (data as IPageRelatedData).PageId; } string pathInfo = _actionName != null ? "/" + _actionName : string.Empty; if (_isKeyField) { pathInfo += "/" + ValueTypeConverter.Convert <string>(reference.KeyValue); } else { string urlPart = GetUrlPart(reference); if (urlPart == null) { return(null); } pathInfo += "/" + urlPart; } return(new PageUrlData(pageId, DataScopeManager.CurrentDataScope.ToPublicationScope(), LocalizationScopeManager.CurrentLocalizationScope) { PathInfo = pathInfo }); }
private static IHtmlString ConvertFunctionResult(object result) { var resultAsString = ValueTypeConverter.Convert <string>(result); if (resultAsString != null) { return(new HtmlString(resultAsString)); } throw new InvalidOperationException("Function doesn't return string value"); }
/// <exclude /> public T GetParameter <T>(string parameterName) { object value = GetParameter(parameterName); if (value == null || value is T) { return((T)value); } return(ValueTypeConverter.Convert <T>(value)); }
/// <exclude /> public object GetParameter(string parameterName, Type targetType) { object value = GetParameter(parameterName); if (value != null && !targetType.IsInstanceOfType(value)) { return(ValueTypeConverter.Convert(value, targetType)); } return(value); }