public static void SetDirectoryConvention(Type itemType, ConventionTemplateDirectoryAttribute instance)
		{
			if (itemType == null) throw new ArgumentNullException("itemType");

			if (string.IsNullOrEmpty(instance.virtualDirectory))
				instance.virtualDirectory = "~/";
			else if (!instance.virtualDirectory.EndsWith("/"))
				instance.virtualDirectory += "/";

			SingletonDictionary<Type, ConventionTemplateDirectoryAttribute>.Instance[itemType] = instance;
		}
Пример #2
0
        public PathData GetPath(ContentItem item, string remainingUrl)
        {
            if (string.IsNullOrEmpty(remainingUrl))
            {
                Type   itemType         = item.GetContentType();
                string virtualDirectory = ConventionTemplateDirectoryAttribute.GetDirectory(itemType);

                string templateName = otherTemplateName ?? itemType.Name;
                return(new PathData(item, virtualDirectory + templateName + ".aspx"));
            }
            return(null);
        }
Пример #3
0
        public static void SetDirectoryConvention(Type itemType, ConventionTemplateDirectoryAttribute instance)
        {
            if (itemType == null)
            {
                throw new ArgumentNullException("itemType");
            }

            if (string.IsNullOrEmpty(instance.virtualDirectory))
            {
                instance.virtualDirectory = "~/";
            }
            else if (!instance.virtualDirectory.EndsWith("/"))
            {
                instance.virtualDirectory += "/";
            }

            SingletonDictionary <Type, ConventionTemplateDirectoryAttribute> .Instance[itemType] = instance;
        }