C# 从本地化数据库获取数据的最佳方法

C# 从本地化数据库获取数据的最佳方法,c#,sql-server,entity-framework,database-design,entity-framework-6,C#,Sql Server,Entity Framework,Database Design,Entity Framework 6,我创建了表结构,以便在数据库中本地化状态: Status {StatusId, Value} -- Value in this table is status value in default language StatusTranslation {StatusId, Language, TrasnlationValue} -- StatusId and Language are combined key 但我在实体框架中很难做到这一点。 当使用默认语言时,它是easy Status.ToLi

我创建了表结构,以便在数据库中本地化状态:

Status {StatusId, Value} -- Value in this table is status value in default language
StatusTranslation {StatusId, Language, TrasnlationValue} -- StatusId and Language are combined key
但我在实体框架中很难做到这一点。 当使用默认语言时,它是easy Status.ToList,但当我需要翻译时,我会传递给get方法dech,但我无法返回翻译后的状态。 使用实体框架映射此对象的最佳方法是什么? 我原以为我的一些方法对这种情况有效,但最终我发现它们不起作用。 这是代码中的对象:

public class Status 
    {
        public int StatusId{ get; set; }
        public string Value{ get; set; }
        public virtual ICollection<StatusTranslation > StatusTranslations { get; set; }
    }
public class StatusTranslation 
    {
        public int StatusId{ get; set; }
        public string Language{ get; set; }
        public string TrasnlationValue{ get; set; }

        public virtual Status Status { get; set; }
    }
这两个函数都以默认形式和默认语言返回me状态 返回参数应该是IEnumerable,因为这是不可能的。
所以我可以返回earthier IEnumerable或IEnumerable,但这不能是一个函数,或者有希望

这对我来说似乎有点不清楚。向我们展示您遇到问题的这些方法,并提供任何异常/错误/意外行为的详细信息。”从数据库中获取数据本身不应该是您的问题,因为您使用的是EF,所以我认为在某些地方存在误解。我添加了有疑问的查询。我无法获得所需语言的状态。也许我的设计错了什么的。没有错误的问题是,我不知道如何从这个结构中获取转换后的状态,EF结果应该绑定在下拉列表StatusId/Value中。
var statuses = from c in context.Statuses
           join t in context.StatusTranslations
               on c.StatusId equals t.StatusId
           where t.Language == language

var statuses = from t in context.StatusTranslations
           where t.Language == language
           select t.Status;