An example about your question
public class MyEntity : Entity<string>
{
[NotMapped]
public override string Id
{
get { return MyIntField + "-" + MyStringField ; }
set { /* no need set */ }
}
[Key]
[Column(Order = 1)]
public virtual int MyIntField { get; set; }
[Key]
[Column(Order = 2)]
public virtual string MyStringField { get; set; }
public virtual string OtherField { get; set; }
}
And then use your repository like this
public class MyEntityAppService: IMyEntityAppService {
private readonly IRepository < MyEntity, string > _myEntityRepository;
public AccountAppService(IRepository < MyEntity, string > myEntityRepository) {
_myEntityRepository = myEntityRepository;
}
public void Test() {
_myEntityRepository.Insert(new MyEntity {
MyIntField = 1,
MyStringField = "test",
OtherField = "Alper Ebicoglu"
});
var myAllEntities = _myEntityRepository.GetAllList();
var myFilteredEntity = _myEntityRepository.Single(s => s.MyIntField == 1 &&
s.MyStringField == "test");
}
// ...
}
PS: some repository methods may not work as expected. so before implementing the solution test all repository methods