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


C# Providers.ResourceProperty类代码示例

本文整理汇总了C#中System.Data.Services.Providers.ResourceProperty的典型用法代码示例。如果您正苦于以下问题:C# ResourceProperty类的具体用法?C# ResourceProperty怎么用?C# ResourceProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ResourceProperty类属于System.Data.Services.Providers命名空间,在下文中一共展示了ResourceProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetPropertyNameAndValue

		public static bool GetPropertyNameAndValue(BinaryExpression binaryExpr, out ResourceProperty property, out object value)
		{
			property = null;
			value = null;
			UnaryExpression left = binaryExpr.Left as UnaryExpression;
			MethodCallExpression operand = null;
			if (left != null)
			{
				operand = left.Operand as MethodCallExpression;
			}
			if (operand != null && binaryExpr.Left.NodeType == ExpressionType.Convert && operand.NodeType == ExpressionType.Call && binaryExpr.Right.NodeType == ExpressionType.Constant && (operand.Method == ExpressionHelper.GetValueMethodInfo || operand.Method == ExpressionHelper.GetSequenceValueMethodInfo))
			{
				ConstantExpression item = operand.Arguments[1] as ConstantExpression;
				if (item != null)
				{
					property = item.Value as ResourceProperty;
				}
				ConstantExpression right = binaryExpr.Right as ConstantExpression;
				if (right != null)
				{
					value = right.Value;
				}
			}
			return property != null;
		}
开发者ID:nickchal,项目名称:pash,代码行数:25,代码来源:ExpressionHelper.cs

示例2: GetReadStream40

        //Named Resource using .NET Framework 4.0
        public Stream GetReadStream40(object entity, ResourceProperty resourceProperty, string etag, bool? checkETagForEquality, DataServiceOperationContext operationContext)
        {
            vProductCatalog image = entity as vProductCatalog;

            //ThumbnailPhoto and LargePhoto
            string imageFilePath = HostingEnvironment.MapPath("~/ProductImages/" + resourceProperty.Name);

            if (checkETagForEquality != null)
            {
                // This stream provider implementation does not support 
                // ETag headers for media resources. This means that we do not track 
                // concurrency for a media resource and last-in wins on updates.
                throw new DataServiceException(400, "This sample service does not support the ETag header for a media resource.");
            }

            if (image == null)
            {
                throw new DataServiceException(500, "Internal Server Error.");
            }

            // Build the full path to the stored image file, which includes the entity key.
            string fullImageFilePath = string.Format(@"{0}\{1}.gif", imageFilePath, this.ProductPhotoID(image.ProductID));

            if (!File.Exists(fullImageFilePath))
            {
                throw new DataServiceException(500, "The image could not be found.");
            }

            // Return a stream that contains the requested file.
            return new FileStream(fullImageFilePath, FileMode.Open);
        }
开发者ID:EdiCarlos,项目名称:MyPractices,代码行数:32,代码来源:ProductCatalogStreamProvider.cs

示例3: GetPropertyInfo

        /// <summary>
        /// Gets the property info for the resource property declared on this type.
        /// </summary>
        /// <param name="resourceType">The resource type to get the property on.</param>
        /// <param name="resourceProperty">Resource property instance to get the property info for.</param>
        /// <returns>Returns the PropertyInfo object for the specified resource property.</returns>
        internal PropertyInfo GetPropertyInfo(ResourceType resourceType, ResourceProperty resourceProperty)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(resourceType != null, "resourceType != null");
            Debug.Assert(resourceProperty != null, "resourceProperty != null");
            Debug.Assert(resourceProperty.CanReflectOnInstanceTypeProperty, "resourceProperty.CanReflectOnInstanceTypeProperty");
            Debug.Assert(resourceType.Properties.Contains(resourceProperty), "The resourceType does not define the specified resourceProperty.");

            if (this.propertyInfosDeclaredOnThisType == null)
            {
                this.propertyInfosDeclaredOnThisType = new Dictionary<ResourceProperty, PropertyInfo>(ReferenceEqualityComparer<ResourceProperty>.Instance);
            }

            PropertyInfo propertyInfo;
            if (!this.propertyInfosDeclaredOnThisType.TryGetValue(resourceProperty, out propertyInfo))
            {
                BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.Instance;
                propertyInfo = resourceType.InstanceType.GetProperty(resourceProperty.Name, bindingFlags);
                if (propertyInfo == null)
                {
                    throw new ODataException(Strings.PropertyInfoResourceTypeAnnotation_CannotFindProperty(resourceType.FullName, resourceType.InstanceType, resourceProperty.Name));
                }

                this.propertyInfosDeclaredOnThisType.Add(resourceProperty, propertyInfo);
            }

            Debug.Assert(propertyInfo != null, "propertyInfo != null");
            return propertyInfo;
        }
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:35,代码来源:PropertyInfoResourceTypeAnnotation.cs

示例4: PrimitiveTypeSerializer

		public PrimitiveTypeSerializer(ResourceType resourceType, ResourceProperty resourceProperty) : base(resourceType)
		{
			object defaultValue;
			object[] resourceTypeKind = new object[2];
			resourceTypeKind[0] = resourceType.ResourceTypeKind;
			resourceTypeKind[1] = ResourceTypeKind.Primitive;
			ExceptionHelpers.ThrowArgumentExceptionIf("resourceType", resourceType.ResourceTypeKind != ResourceTypeKind.Primitive, new ExceptionHelpers.MessageLoader(SerializerBase.GetInvalidArgMessage), resourceTypeKind);
			this.defaultValue = null;
			if (resourceProperty != null)
			{
				if ((resourceProperty.Kind & ResourcePropertyKind.Primitive) != ResourcePropertyKind.Primitive || resourceProperty.ResourceType.InstanceType != resourceType.InstanceType)
				{
					throw new ArgumentException("resourceProperty");
				}
				else
				{
					PropertyCustomState customState = resourceProperty.GetCustomState();
					PrimitiveTypeSerializer primitiveTypeSerializer = this;
					if (customState != null)
					{
						defaultValue = customState.DefaultValue;
					}
					else
					{
						defaultValue = null;
					}
					primitiveTypeSerializer.defaultValue = defaultValue;
					this.name = resourceProperty.Name;
				}
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:31,代码来源:PrimitiveTypeSerializer.cs

示例5: ReferenceTypeSerializer

		public ReferenceTypeSerializer(ResourceType referringResourceType, ResourceProperty resourceProperty) : base(resourceProperty.ResourceType)
		{
			if (resourceProperty.ResourceType.ResourceTypeKind == ResourceTypeKind.EntityType)
			{
				object[] name = new object[1];
				name[0] = resourceProperty.Name;
				referringResourceType.ThrowIfNull("referringResourceType", new ParameterExtensions.MessageLoader(SerializerBase.GetReferringResourceTypeCannotNullMessage), name);
				DataContext currentContext = DataServiceController.Current.GetCurrentContext();
				if (currentContext != null)
				{
					PSEntityMetadata entityMetadata = currentContext.UserSchema.GetEntityMetadata(referringResourceType) as PSEntityMetadata;
					PSEntityMetadata.ReferenceSetCmdlets referenceSetCmdlet = null;
					if (!entityMetadata.CmdletsForReferenceSets.TryGetValue(resourceProperty.Name, out referenceSetCmdlet))
					{
						this.referencePropertyType = PSEntityMetadata.ReferenceSetCmdlets.ReferencePropertyType.Instance;
					}
					else
					{
						this.referencePropertyType = referenceSetCmdlet.PropertyType;
						return;
					}
				}
				return;
			}
			else
			{
				throw new ArgumentException("resourceType");
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:29,代码来源:ReferenceTypeSerializer.cs

示例6: GetResourceAssociationSet

 public ResourceAssociationSet GetResourceAssociationSet(
     ResourceSet resourceSet,
     ResourceType resourceType,
     ResourceProperty resourceProperty)
 {
     // resourceProperty.GetAnnotation().ResourceAssociationSet;
     return resourceProperty.CustomState as ResourceAssociationSet;
 } 
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:8,代码来源:DataServiceMetadataProvider.cs

示例7: ProjectionNode

        /// <summary>Creates new instance of <see cref="ProjectionNode"/> which represents a simple projected property.</summary>
        /// <param name="propertyName">The name of the property to project.</param>
        /// <param name="property">The <see cref="ResourceProperty"/> for the property to project. If an open property
        /// is to be projected, specify null.</param>
        internal ProjectionNode(string propertyName, ResourceProperty property)
        {
            Debug.Assert(propertyName != null, "propertyName != null");
            Debug.Assert(property == null || property.Name == propertyName, "If the property is specified its name must match.");

            this.propertyName = propertyName;
            this.property = property;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:12,代码来源:ProjectionNode.cs

示例8: GetPropertyInfo

        /// <summary>
        /// Gets the property info for the resource property on the specified resource type.
        /// </summary>
        /// <param name="resourceType">The resource type to get the property on.</param>
        /// <param name="resourceProperty">Resource property instance to get the property info for.</param>
        /// <returns>Returns the PropertyInfo object for the specified resource property.</returns>
        /// <remarks>The method searches this type as well as all its base types for the property.</remarks>
        internal static PropertyInfo GetPropertyInfo(this ResourceType resourceType, ResourceProperty resourceProperty)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(resourceType != null, "resourceType != null");
            Debug.Assert(resourceProperty != null, "resourceProperty != null");
            Debug.Assert(resourceProperty.CanReflectOnInstanceTypeProperty, "resourceProperty.CanReflectOnInstanceTypeProperty");
            Debug.Assert(resourceType.Properties.Contains(resourceProperty), "The resourceType does not define the specified resourceProperty.");

            return PropertyInfoResourceTypeAnnotation.GetPropertyInfoResourceTypeAnnotation(resourceType).GetPropertyInfo(resourceType, resourceProperty);
        }
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:17,代码来源:PropertyInfoExtensionMethods.cs

示例9: ResourceAssociationTypeEnd

        /// <summary>
        /// Creates a new instance of EndInfo.
        /// </summary>
        /// <param name="name">name of the end.</param>
        /// <param name="resourceType">resource type that the end refers to.</param>
        /// <param name="resourceProperty">property of the end.</param>
        /// <param name="fromProperty">Property on the related end that points to this end. The multiplicity of this end is determined from the fromProperty.</param>
        internal ResourceAssociationTypeEnd(string name, ResourceType resourceType, ResourceProperty resourceProperty, ResourceProperty fromProperty)
        {
            Debug.Assert(!String.IsNullOrEmpty(name), "!String.IsNullOrEmpty(name)");
            Debug.Assert(resourceType != null, "type != null");

            this.name = name;
            this.resourceType = resourceType;
            this.resourceProperty = resourceProperty;
            this.fromProperty = fromProperty;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:17,代码来源:ResourceAssociationTypeEnd.cs

示例10: GetResourceAssociationTypeEnd

 internal ResourceAssociationTypeEnd GetResourceAssociationTypeEnd(ResourceType resourceType, ResourceProperty resourceProperty)
 {
     foreach (ResourceAssociationTypeEnd end in new ResourceAssociationTypeEnd[] { this.end1, this.end2 })
     {
         if ((end.ResourceType == resourceType) && (end.ResourceProperty == resourceProperty))
         {
             return end;
         }
     }
     return null;
 }
开发者ID:nickchal,项目名称:pash,代码行数:11,代码来源:ResourceAssociationType.cs

示例11: GetPropertyValue

 public override object GetPropertyValue(object target, ResourceProperty resourceProperty)
 {
     if (target is DSPResource)
     {
         return (target as DSPResource).GetValue(resourceProperty.Name);
     }
     else
     {
         throw new NotSupportedException("Unrecognized resource type.");
     }
 }
开发者ID:victorantos,项目名称:MongOData,代码行数:11,代码来源:MongoDSPResourceQueryProvider.cs

示例12: IsReference

		internal static bool IsReference(ResourceProperty property)
		{
			if (property.Kind == ResourcePropertyKind.ResourceReference)
			{
				return true;
			}
			else
			{
				return property.Kind == ResourcePropertyKind.ResourceSetReference;
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:11,代码来源:PropertyReferenceFinder.cs

示例13: ExpandSegment

 internal ExpandSegment(string name, Expression filter, int maxResultsExpected, ResourceSetWrapper container, ResourceType targetResourceType, ResourceProperty expandedProperty, System.Data.Services.Providers.OrderingInfo orderingInfo)
 {
     WebUtil.CheckArgumentNull<string>(name, "name");
     CheckFilterType(filter);
     this.name = name;
     this.filter = filter;
     this.container = container;
     this.maxResultsExpected = maxResultsExpected;
     this.expandedProperty = expandedProperty;
     this.orderingInfo = orderingInfo;
     this.targetResourceType = targetResourceType;
 }
开发者ID:nickchal,项目名称:pash,代码行数:12,代码来源:ExpandSegment.cs

示例14: ExpandedProjectionNode

 internal ExpandedProjectionNode(string propertyName, ResourceProperty property, System.Data.Services.Providers.ResourceType targetResourceType, System.Data.Services.Providers.ResourceSetWrapper resourceSetWrapper, System.Data.Services.Providers.OrderingInfo orderingInfo, Expression filter, int? skipCount, int? takeCount, int? maxResultsExpected) : base(propertyName, property, targetResourceType)
 {
     this.resourceSetWrapper = resourceSetWrapper;
     this.orderingInfo = orderingInfo;
     this.filter = filter;
     this.skipCount = skipCount;
     this.takeCount = takeCount;
     this.maxResultsExpected = maxResultsExpected;
     this.nodes = new List<ProjectionNode>();
     this.operations = new List<OperationWrapper>();
     this.hasExpandedPropertyOnDerivedType = false;
 }
开发者ID:nickchal,项目名称:pash,代码行数:12,代码来源:ExpandedProjectionNode.cs

示例15: GetValue

		public void GetValue ()
		{
			var rt = new ResourceType (typeof (string), ResourceTypeKind.ComplexType, null, "System", "String", false);
			var rp = new ResourceProperty ("Length", ResourcePropertyKind.ComplexType, rt);
			AssertExtensions.Throws<NotImplementedException> (() => {
				DataServiceProviderMethods.GetValue ("test", rp);
			}, "#A1");

			AssertExtensions.Throws<NotImplementedException> (() => {
				DataServiceProviderMethods.GetValue (null, null);
			}, "#A2");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:12,代码来源:DataServiceProviderMethodsTest.cs


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