我目前正在学习接口和存储库模式,并且遇到困难。我有域类 “VehicleMake” public class VehicleMake
{
public VehicleMake()
{
}
[Key]
[Column(Order = 1)]
public int Id { get; set; }
[Required]
的ID我有一个通用的存储库这样的,它允许标识要关闭不同类型(TKEY的) public interface IGenericRepository<TEntity, TKey> where TEntity : class
{
Task<TEntity> GetByIdAsync(TKey id);
Task<IEnumerable<TEntity>> ListAllAsync(
我目前正在学习接口和存储库模式,并在我的简单项目中遇到与CRUD操作有关的问题。 我有域类 “VehicleMake” public class VehicleMake
{
public VehicleMake()
{
}
[Key]
[Column(Order = 1)]
public int Id { get; set; }
我只想弄清楚我是否想使用存储库模式。 的三大优势,我能找到: 1. Testability (repositories can be injected into the controller)
2. Abstraction (complex eloquent queries can be refactored into repository functions)
3. Decoupling (