title: Repository pattern and localized lookup tables
body: <p>I am trying to grabs the idea of the pattern repository and trying to get it implemented in database structures I've already set up in the past. I'm now trying to get the best practice to work with my lookup tables. I've created a test project to play around and this is my database model:</p>
  
  <p><img src="https://i.stack.imgur.com/30qOo.png" alt="enter image description here"></p>
  
  <p>You can see that I have three tables for the lookups: Lookup, Language and LookupLanguage. Language table simply contains the languages.</p>
  
  <p><img src="https://i.stack.imgur.com/cyQA0.png" alt="enter image description here"></p>
  
  <p>Lookup tables holds the different types used throughout the models.
  <img src="https://i.stack.imgur.com/HYM12.png" alt="enter image description here"></p>
  
  <p>And LookupLanguage links the both tables together:
  <img src="https://i.stack.imgur.com/vwOc8.png" alt="enter image description here"></p>
  
  <p>I've created anew project with all the models 1 to 1 to the database tables:
  <img src="https://i.stack.imgur.com/yyeof.png" alt="enter image description here"></p>
  
  <p>I also created a generic repository and a generic CrudService interface:</p>
  
  <pre><code>public interface ICrudService&lt;T&gt; where T : IsActiveEntity, new()
  {
      int Create(T item);
      void Save();
      void Delete(int id);
      T Get(int id);
      IEnumerable&lt;T&gt; GetAll();
      IEnumerable&lt;T&gt; Where(Expression&lt;Func&lt;T, bool&gt;&gt; func, bool showDeleted = false);
      void Restore(int id);
  }
  </code></pre>
  
  <p>Now, according to the following post: <a href="https://stackoverflow.com/questions/1168430/when-implementing-the-repository-pattern-should-lookup-value-tables-get-their">When implementing the repository pattern should lookup value / tables get their own Repository?</a> , the repository should hide the underlying database layer. So I think I need a new implementation of a service and/or repository to get the lookups, but then, where do I have to tell in which language I need to have the lookup?</p>
  
  <p>Let's take the status (new, accepted, refused) from the company as an example.</p>
  
  <p>The company model is as follow:</p>
  
  <pre><code>public partial class Company : IsActiveEntity
  {
      [Required]
      [MaxLength(50)]
      public string CompanyName { get; set; }
      public System.Guid StatusGuid { get; set; }
  
      [ForeignKey("StatusGuid")]
      public virtual Lookup Status { get; set; }
  }
  </code></pre>
  
  <p>I guess I don't need to have a separate implementation of a repository?
  But I need a separate implementation CompanyService.</p>
  
  <pre><code>interface ICompanyService : ICrudService&lt;Company&gt;
  {
      IQueryable&lt;LookupLanguage&gt; GetStatuses(Guid languageguid);
      LookupLanguage GetStatus(Guid statusguid, Guid languageguid);
  }
  </code></pre>
  
  <p>Is this the correct approach, or do I miss something here? </p>