Beispiel #1
0
        protected override bool VerifyEntityTypeCondition(
            [NotNull] string entityPropertyName,
            [NotNull] EntityTypeDefinition entityTypeDefinition,
            [NotNull] EntityProperties entityProperties)
        {
            Assert.ArgumentNotNull(entityPropertyName, "entityPropertyName");
            Assert.ArgumentNotNull(entityTypeDefinition, "entityTypeDefinition");
            Assert.ArgumentNotNull(entityProperties, "entityProperties");

            string entityPropertyValue;

            EntityPropertyValue entityProperty = entityProperties["ows_" + entityPropertyName];

            if (entityProperty != null)
            {
                entityPropertyValue = entityProperty.Value;
            }
            else
            {
                if (entityPropertyName != "ContentTypeId")
                {
                    return(false);
                }

                entityPropertyValue = entityProperties.GetMetaInfoProperty(entityPropertyName);
            }

            if (string.IsNullOrEmpty(entityPropertyValue))
            {
                return(false);
            }

            foreach (string entityTypePropertyValue in entityTypeDefinition.Properties[entityPropertyName])
            {
                if (entityPropertyName == "ContentTypeId" ? entityPropertyValue.StartsWith(entityTypePropertyValue) : entityPropertyValue == entityTypePropertyValue)
                {
                    return(true);
                }
            }

            return(false);
        }