I have an interface:
public interface ILanguageEntity
{
int Id { get; set; }
string Name { get; set; }
string Code { get; set; }
string Culture { get; set; }
string LocalName { get; set; }
bool IsRightToLeft { get; set; }
}
And I've implemented that as a Entity like this:
public class LanguageEntity : ILanguageEntity
{
public int Id { get; set; }
public string Name { get; set; }
public string Code { get; set; }
public string Culture { get; set; }
public string LocalName { get; set; }
public bool IsRightToLeft { get; set; }
}
In my service I want to have a property for this entity which returns its DbSet like this:
public class LanguageService : ILanguageService
{
public ApplicationContext Context { get; set; }
public DbSet<ILanguageEntity> DbSet { get { return Context.Set<LanguageEntity>(); } }
}
But it's not possible because I'm returning a DbSet<LanguageEntity>
type while I must return a DbSet<ILanguageEntity>
type as compiler says. What should I do?