示例#1
0
        private static EntityTagHeaderValue CreateETag(
            EntityInstanceContext entityInstanceContext,
            IETagHandler handler)
        {
            IEdmModel     model     = entityInstanceContext.EdmModel;
            IEdmEntitySet entitySet = entityInstanceContext.NavigationSource as IEdmEntitySet;

            IEnumerable <IEdmStructuralProperty> concurrencyProperties;

            if (model != null && entitySet != null)
            {
                concurrencyProperties = model.GetConcurrencyProperties(entitySet).OrderBy(c => c.Name);
            }
            else
            {
                concurrencyProperties = Enumerable.Empty <IEdmStructuralProperty>();
            }

            IDictionary <string, object> properties = new Dictionary <string, object>();

            foreach (IEdmStructuralProperty etagProperty in concurrencyProperties)
            {
                properties.Add(etagProperty.Name, entityInstanceContext.GetPropertyValue(etagProperty.Name));
            }
            EntityTagHeaderValue etagHeaderValue = handler.CreateETag(properties);

            return(etagHeaderValue);
        }
示例#2
0
        private static EntityTagHeaderValue CreateETag(
            ResourceContext resourceContext,
            IETagHandler handler)
        {
            IEdmModel model = resourceContext.EdmModel;

            IEnumerable <IEdmStructuralProperty> concurrencyProperties;

            if (model != null && resourceContext.NavigationSource != null)
            {
                concurrencyProperties = model.GetConcurrencyProperties(resourceContext.NavigationSource).OrderBy(c => c.Name);
            }
            else
            {
                concurrencyProperties = Enumerable.Empty <IEdmStructuralProperty>();
            }

            IDictionary <string, object> properties = new Dictionary <string, object>();

            foreach (IEdmStructuralProperty etagProperty in concurrencyProperties)
            {
                properties.Add(etagProperty.Name, resourceContext.GetPropertyValue(etagProperty.Name));
            }
            return(handler.CreateETag(properties));
        }
示例#3
0
        private static EntityTagHeaderValue CreateETag(
            EntityInstanceContext entityInstanceContext,
            IETagHandler handler)
        {
            IEnumerable <IEdmStructuralProperty> concurrencyProperties =
                entityInstanceContext.EntityType.GetConcurrencyProperties().OrderBy(c => c.Name);

            IDictionary <string, object> properties = new Dictionary <string, object>();

            foreach (IEdmStructuralProperty etagProperty in concurrencyProperties)
            {
                properties.Add(etagProperty.Name, entityInstanceContext.GetPropertyValue(etagProperty.Name));
            }
            EntityTagHeaderValue etagHeaderValue = handler.CreateETag(properties);

            return(etagHeaderValue);
        }
        private static EntityTagHeaderValue CreateETag(
            EntityInstanceContext entityInstanceContext,
            IETagHandler handler)
        {
            IEdmModel model = entityInstanceContext.EdmModel;
            IEdmEntitySet entitySet = entityInstanceContext.NavigationSource as IEdmEntitySet;

            IEnumerable<IEdmStructuralProperty> concurrencyProperties;
            if (model != null && entitySet != null)
            {
                concurrencyProperties = model.GetConcurrencyProperties(entitySet).OrderBy(c => c.Name);
            }
            else
            {
                concurrencyProperties = Enumerable.Empty<IEdmStructuralProperty>();
            }

            IDictionary<string, object> properties = new Dictionary<string, object>();
            foreach (IEdmStructuralProperty etagProperty in concurrencyProperties)
            {
                properties.Add(etagProperty.Name, entityInstanceContext.GetPropertyValue(etagProperty.Name));
            }
            EntityTagHeaderValue etagHeaderValue = handler.CreateETag(properties);
            return etagHeaderValue;
        }
        private static EntityTagHeaderValue CreateETag(
            EntityInstanceContext entityInstanceContext,
            IETagHandler handler)
        {
            IEnumerable<IEdmStructuralProperty> concurrencyProperties =
                entityInstanceContext.EntityType.GetConcurrencyProperties().OrderBy(c => c.Name);

            IDictionary<string, object> properties = new Dictionary<string, object>();
            foreach (IEdmStructuralProperty etagProperty in concurrencyProperties)
            {
                properties.Add(etagProperty.Name, entityInstanceContext.GetPropertyValue(etagProperty.Name));
            }
            EntityTagHeaderValue etagHeaderValue = handler.CreateETag(properties);
            return etagHeaderValue;
        }