protected virtual void VisitIndexType(IndexType type)
 {
     if (type.HasFlag(IndexType.Unique))
     {
         Append("UNIQUE");
     }
     Append(type.HasFlag(IndexType.Clustered) ? "CLUSTERED" : "NONCLUSTERED");
 }
        //将IndexAttribute添加到IndexAnnotation
        private static void AddIndexColumn(string indexName, IndexType indexOptions, int column, PrimitivePropertyConfiguration propertyConfiguration)
        {
            var indexAttribute = new IndexAttribute(indexName, column)
            {
                IsClustered = indexOptions.HasFlag(IndexType.Clustered),
                IsUnique    = indexOptions.HasFlag(IndexType.Unique)
            };

            var annotation = GetIndexAnnotation(propertyConfiguration);

            if (annotation != null)
            {
                var attributes = annotation.Indexes.ToList();
                attributes.Add(indexAttribute);
                annotation = new IndexAnnotation(attributes);
            }
            else
            {
                annotation = new IndexAnnotation(indexAttribute);
            }

            propertyConfiguration.HasColumnAnnotation(IndexAnnotation.AnnotationName, annotation);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Loads an IndexFile from a remote CDN
        /// </summary>
        /// <param name="stream"></param>
        public IndexFile(CDNClient client, string path, IndexType type) : this(IndexType.Unknown)
        {
            if (!path.EndsWith(".index", StringComparison.OrdinalIgnoreCase))
            {
                path += ".index";
            }

            string endpoint = type.HasFlag(IndexType.Data) ? "data" : "patch";
            string url      = Helpers.GetCDNUrl(path, endpoint);

            using (var stream = client.OpenStream(url).Result)
                Read(stream);

            Type = DetermineType(type);
        }
 protected virtual void VisitIndexType(IndexType type)
 {
     if (type.HasFlag(IndexType.Unique)) Append("UNIQUE");
     Append(type.HasFlag(IndexType.Clustered) ? "CLUSTERED" : "NONCLUSTERED");
 }