我正在尝试用 vb 实现一个通用接口。
Public Interface IGenericRepository(Of T)
Function getAll() As IQueryable(Of T)
Function [get](ByVal id As Integer) As T
Sub saveOrUpdate(BaseDTO As T)
Sub delete(BaseDTO As T)
End Interface
Public Interface IWorkItemRepository
Inherits IGenericRepository(Of WorkItem)
Function getWorkItemsByRequestor(ByVal username As String) As IList(Of WorkItem)
End Interface
Public Class WorkItemRepository
Inherits genericRepository(Of WorkItem)
Implements IWorkItemRepository
End Class
我不想在 Iworkitemrepository 中复制共享方法的具体实现。
如何通过继承实现这一目标?