index attribute not honored by entity framework?

65 Views Asked by At

I'm using a model first approach. So, I got a generated class namespace XXX.GlobalDatabaseModel { using System; using System.Collections.Generic;

    public partial class LocalizedFoodGroup
    {
        public int FoodGroupId { get; set; }
        public string Culture { get; set; }
        public string LocalizedName { get; set; }

        public virtual FoodGroup FoodGroup { get; set; }
    }
}

and, in another file in the same solution I want to add an index to it:

namespace XITASO.GlobalDatabaseModel
{
    [MetadataType(typeof(LocalNameLocalizedFoodGroup))]
    public partial class LocalizedFoodGroup
    {
    }
    public class LocalNameLocalizedFoodGroup
    {
        [Index("UX_LocalizedFoodGroup",IsUnique = true)]
        public string Culture { get; set; }

    }
}

Only, when I click "generate database from model" and look at the sql file, no index shows up.

Does anybody know what I'm doing wrong?

Lots of Greetings! Volker

0

There are 0 best solutions below