Ejemplo n.º 1
0
        private ResourcePropertyCache InitializeResourcePropertyCache(DataServiceProviderWrapper provider, System.Data.Services.Providers.ResourceType type)
        {
            ResourcePropertyCache cache;

            if (!this.resourcePropertyCache.TryGetValue(type, out cache))
            {
                cache = new ResourcePropertyCache {
                    Properties = new List <ResourceProperty>()
                };
                foreach (ResourceProperty property in type.Properties)
                {
                    if ((property.TypeKind != ResourceTypeKind.EntityType) || (provider.GetContainer(this, type, property) != null))
                    {
                        cache.Properties.Add(property);
                    }
                }
                cache.PropertiesDeclaredOnTheType = new List <ResourceProperty>();
                foreach (ResourceProperty property2 in type.PropertiesDeclaredOnThisType)
                {
                    if ((property2.TypeKind != ResourceTypeKind.EntityType) || (provider.GetContainer(this, type, property2) != null))
                    {
                        cache.PropertiesDeclaredOnTheType.Add(property2);
                    }
                }
                this.resourcePropertyCache.Add(type, cache);
            }
            return(cache);
        }
Ejemplo n.º 2
0
        internal ResourceSetWrapper GetTargetSet(DataServiceProviderWrapper provider, ResourceSetWrapper bindingSet)
        {
            ResourceSetWrapper sourceContainer = bindingSet;

            for (int i = 0; (sourceContainer != null) && (i < this.pathSegments.Length); i++)
            {
                PathSegment segment = this.pathSegments[i];
                if (segment.Property != null)
                {
                    sourceContainer = provider.GetContainer(sourceContainer, segment.SourceType, segment.Property);
                }
            }
            return(sourceContainer);
        }