private static IndexAnnotation CreateIndexAnnotation(string tableName, string propertyName, int count)
        {
            var indexName = IndexNameCreator.CreateIndexName(tableName, propertyName);

            // If there are two Indicies on the same property, the count is added.
            // In SQLite an Index name must be global unique.
            // To be honest, it should never happen. But because its possible by using the API, it should be covered.
            if (count > 0)
            {
                indexName = String.Format(CultureInfo.InvariantCulture, "{0}_{1}", indexName, count);
            }

            var indexAttribute = new IndexAttribute(indexName);

            return(new IndexAnnotation(indexAttribute));
        }
Example #2
0
        public void CreateIndexName()
        {
            string result = IndexNameCreator.CreateIndexName("MyTable", "MyProperty");

            Assert.AreEqual("\"IX_MyTable_MyProperty\"", result);
        }
 private string GetIndexName(IndexAttribute index, EdmProperty property)
 {
     return(index.Name ?? IndexNameCreator.CreateIndexName(entitySet.ElementType.GetTableName(), property.Name));
 }