当前位置: 首页>>代码示例>>C#>>正文


C# IValueProvider.GetValue方法代码示例

本文整理汇总了C#中IValueProvider.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# IValueProvider.GetValue方法的具体用法?C# IValueProvider.GetValue怎么用?C# IValueProvider.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IValueProvider的用法示例。


在下文中一共展示了IValueProvider.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Desrialize

        private ODataQueryCriteria Desrialize(IValueProvider values)
        {
            var criteria = new ODataQueryCriteria();

            var orderBy = values.GetValue("$orderby");
            if (orderBy != null)
            {
                criteria.OrderBy = orderBy.AttemptedValue;
            }

            var filter = values.GetValue("$filter");
            if (filter != null)
            {
                criteria.Filter = filter.AttemptedValue;
            }

            ParsePagingInfo(values, criteria);

            var expand = values.GetValue("$expand");
            if (expand != null)
            {
                criteria.Expand = expand.AttemptedValue;
            }

            return criteria;
        }
开发者ID:zidanfei,项目名称:Dot.Utility,代码行数:26,代码来源:ODataQueryCriteriaBinder.cs

示例2: ParsePagingInfo

        private static void ParsePagingInfo(IValueProvider values, ODataQueryCriteria criteria)
        {
            var pn = values.GetValue("$pageNumber");
            var tc = values.GetValue("$inlinecount");
            if (pn != null || tc != null)
            {
                var pageNumber = pn != null ? (int)pn.ConvertTo(typeof(int)) : 1;
                var needCount = tc != null && !string.IsNullOrWhiteSpace(tc.AttemptedValue);

                var ps = values.GetValue("$pageSize");
                int pageSize = ps != null ? (int)ps.ConvertTo(typeof(int)) : 10;

                var pagingInfo = new PagingInfo(pageNumber, pageSize, needCount);
                criteria.PagingInfo = pagingInfo;
            }
        }
开发者ID:zidanfei,项目名称:Dot.Utility,代码行数:16,代码来源:ODataQueryCriteriaBinder.cs

示例3: GetModel

        public object GetModel(ControllerContext controllerContext, Type modelType, IValueProvider valueProvider, string key)
        {
            if (!valueProvider.ContainsPrefix(key))
            {
                return null;
            }
            ModelMetadata modelMetadata = ModelMetadataProviders.Current.GetMetadataForType(null, modelType);
            if (!modelMetadata.IsComplexType)
            {
                return valueProvider.GetValue(key).ConvertTo(modelType);
            }

            if (modelType.IsArray)
            {
                return GetArrayModel(controllerContext, modelType, valueProvider,key);
            }

            Type enumerableType = ExtractGenericInterface(modelType, typeof(IEnumerable<>));
            if (null != enumerableType)
            {
                return GetCollectionModel(controllerContext, modelType, valueProvider, key);
            }         
           
            if (modelMetadata.IsComplexType)
            {
                return GetComplexModel(controllerContext, modelType, valueProvider, key);
            }
            return null;
        }
开发者ID:xiaohong2015,项目名称:.NET,代码行数:29,代码来源:DefaultModelBinder.cs

示例4: QuestionSelected

 private bool QuestionSelected(IValueProvider provider, int idx)
 {
     var valResult = provider.GetValue(ResultName(idx));
     return ((valResult != null)
         && !string.IsNullOrEmpty(valResult.AttemptedValue)
         && valResult.AttemptedValue.Contains("true"));
 }
开发者ID:simonb65,项目名称:SurveyTest,代码行数:7,代码来源:MultiSelectQuestionDef.cs

示例5: GetModel

 public object GetModel(ControllerContext controllerContext, Type modelType, IValueProvider valueProvider, string key)
 {
     if (!valueProvider.ContainsPrefix(key))
     {
         return null;
     }
     return valueProvider.GetValue(key).ConvertTo(modelType);
 }
开发者ID:xiaohong2015,项目名称:.NET,代码行数:8,代码来源:DefaultModelBinder.cs

示例6: GetFormField

		string GetFormField(string key, IValueProvider provider) {
			ValueProviderResult result = provider.GetValue(key);

			if(result != null) {
				return (string)result.ConvertTo(typeof(string));
			}

			return null;
		}
开发者ID:pmccowat,项目名称:SagePayMvc,代码行数:9,代码来源:SagePayBinder.cs

示例7: UpdatePageStatus

 private void UpdatePageStatus(CmsPage page, IValueProvider valueProvider)
 {
     int pageStatusId;
     if (Int32.TryParse(valueProvider.GetValue("Page.Status.Id").AttemptedValue, out pageStatusId))
     {
         Status pageStatus = pageService.LoadPageType(pageStatusId);
         page.Status = pageStatus;
     }
 }
开发者ID:MasroorKhalid,项目名称:AtomicCms,代码行数:9,代码来源:CmsPageController.cs

示例8: BindValue

 private static void BindValue(dynamic shape, IValueProvider valueProvider, string prefix) {
     // if the shape has a Name property, look for a value in
     // the ValueProvider
     var name = shape.Name;
     if (name != null) {
         ValueProviderResult value = valueProvider.GetValue(prefix + name);
         if (value != null) {
             shape.Value = value.AttemptedValue;
         }
     }
 }
开发者ID:rupertwhitlock,项目名称:IncreasinglyAbsorbing,代码行数:11,代码来源:DefaultFormManager.cs

示例9: GetCurrentValue

        public static string GetCurrentValue(this IGridDataKey dataKey, IValueProvider valueProvider)
        {
            var value = valueProvider.GetValue(dataKey.RouteKey);

            if (value != null)
            {
                return value.AttemptedValue;
            }

            return null;
        }
开发者ID:vialpando09,项目名称:RallyPortal2,代码行数:11,代码来源:GridDataKeyExtensions.cs

示例10: GetSupportedUavs

        private static IEnumerable<UavTypeDTO> GetSupportedUavs(IValueProvider valueProvider)
        {
            if (valueProvider.GetValue("UavType") == null)
                throw new Exception("UavTypes is NULL");

            var types = (string[]) valueProvider.GetValue("UavType").ConvertTo(typeof (string[]));

            return types.Select(item => new UavTypeDTO()
            {
                Id = int.Parse(item)
            }).ToList();
        }
开发者ID:sweexxik,项目名称:Uav-Site,代码行数:12,代码来源:GcuEditModelBinder.cs

示例11: GetArrayModel

 protected virtual object GetArrayModel( ControllerContext controllerContext, Type modelType, IValueProvider valueProvider, string prefix)
 {
     if (valueProvider.ContainsPrefix(prefix) && !string.IsNullOrEmpty(prefix))
     {
         ValueProviderResult result = valueProvider.GetValue(prefix);
         if (null != result)
         {
             return result.ConvertTo(modelType);
         }
     }
     return null;
 }  
开发者ID:xiaohong2015,项目名称:.NET,代码行数:12,代码来源:DefaultModelBinder.cs

示例12: ApplyValues

        /// <summary>
        /// 在表单上应用指定值提供程序的值
        /// </summary>
        /// <param name="form">要应用的表单</param>
        /// <param name="valueProvider">提供值的 ValueProvider 实例</param>
        /// <returns>返回表单,便于链式调用</returns>
        public static HtmlForm ApplyValues( this HtmlForm form, IValueProvider valueProvider )
        {
            foreach ( var key in form.InputControls.Select( c => c.Name ) )
              {
            if ( valueProvider.ContainsPrefix( key ) )
            {
              form[key].TrySetValue( valueProvider.GetValue( key ).AttemptedValue );
            }
              }

              return form;
        }
开发者ID:neo2018,项目名称:Jumony,代码行数:18,代码来源:MvcFormExtensions.cs

示例13: ApplyValues

    /// <summary>
    /// 在表单上应用指定值提供程序的值
    /// </summary>
    /// <param name="form">要应用的表单</param>
    /// <param name="valueProvider">提供值的 ValueProvider 实例</param>
    /// <returns>返回表单,便于链式调用</returns>
    public static HtmlForm ApplyValues( this HtmlForm form, IValueProvider valueProvider )
    {

      foreach ( var control in form.Controls )
      {
        if ( valueProvider.ContainsPrefix( control.Name ) )
          control.Value = valueProvider.GetValue( control.Name ).AttemptedValue;
      }

      return form;

    }
开发者ID:ajayumi,项目名称:Jumony,代码行数:18,代码来源:MvcFormExtensions.cs

示例14: BindDataSource

		private static IValueSet BindDataSource(IValueProvider provider)
		{
			ValueDictionary values = new ValueDictionary();
			foreach (string key in provider.Keys)
			{
				ValueProviderResult result = provider.GetValue(key);
				if (result == null)
					continue;

				values.Add(key, result.Value);
			}
			return values;
		}
开发者ID:radischevo,项目名称:Radischevo.Wahha,代码行数:13,代码来源:FormCollectionBinder.cs

示例15: TestInit

        public void TestInit()
        {
            _actionContext = new HttpActionContext();

            _valueProvider = Mock.Create<IValueProvider>(Behavior.Loose);
            Mock.Arrange(() => _valueProvider.GetValue("process")).Returns(new ValueProviderResult(ProcessName, ProcessName, null));

            _bindingContext = new ModelBindingContext
                                  {
                                      ValueProvider = _valueProvider,
                                      ModelMetadata =
                                          new ModelMetadata(new EmptyModelMetadataProvider(), null, null, typeof(SearchParameters), null)
                                  };
        }
开发者ID:mparsin,项目名称:Elements,代码行数:14,代码来源:SearchParametersBinderTests.cs


注:本文中的IValueProvider.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。