Skip to content
Wayne edited this page Jul 30, 2015 · 5 revisions

Repository

Repository 是非必需的,ServiceBase中已有默认实现,如不满足,可按实际情况添加


public interface IExampleRepository : IRepository<Example>
{
}
public class ExampleRepository : RepositoryBase<Example>, IExampleRepository
{
}

引入到Service

public class ExampleService : ServiceBase<Example>, IExampleService
{
    private readonly IExampleRepository _exampleRepository;

    public ExampleService(IExampleRepository exampleRepository)
    {
        _exampleRepository = exampleRepository;
    }
}

Clone this wiki locally