@@ -41,7 +41,7 @@ public EntityResourceService(
4141 _logger = loggerFactory . CreateLogger < EntityResourceService < T , TId > > ( ) ;
4242 }
4343
44- public async Task < IEnumerable < T > > GetAsync ( )
44+ public virtual async Task < IEnumerable < T > > GetAsync ( )
4545 {
4646 var entities = _entities . Get ( ) ;
4747
@@ -58,7 +58,7 @@ public async Task<IEnumerable<T>> GetAsync()
5858 return pagedEntities ;
5959 }
6060
61- public async Task < T > GetAsync ( TId id )
61+ public virtual async Task < T > GetAsync ( TId id )
6262 {
6363 T entity ;
6464 if ( _jsonApiContext . QuerySet ? . IncludedRelationships != null )
@@ -78,13 +78,13 @@ private async Task<T> GetWithRelationshipsAsync(TId id)
7878 return await query . FirstOrDefaultAsync ( e => e . Id . Equals ( id ) ) ;
7979 }
8080
81- public async Task < object > GetRelationshipsAsync ( TId id , string relationshipName )
81+ public virtual async Task < object > GetRelationshipsAsync ( TId id , string relationshipName )
8282 {
8383 _jsonApiContext . IsRelationshipData = true ;
8484 return await GetRelationshipAsync ( id , relationshipName ) ;
8585 }
8686
87- public async Task < object > GetRelationshipAsync ( TId id , string relationshipName )
87+ public virtual async Task < object > GetRelationshipAsync ( TId id , string relationshipName )
8888 {
8989 relationshipName = _jsonApiContext . ContextGraph
9090 . GetRelationshipName < T > ( relationshipName ) ;
@@ -93,7 +93,7 @@ public async Task<object> GetRelationshipAsync(TId id, string relationshipName)
9393 throw new JsonApiException ( 422 , "Relationship name not specified." ) ;
9494
9595 _logger . LogTrace ( $ "Looking up '{ relationshipName } '...") ;
96-
96+
9797 var entity = await _entities . GetAndIncludeAsync ( id , relationshipName ) ;
9898 if ( entity == null )
9999 throw new JsonApiException ( 404 , $ "Relationship { relationshipName } not found.") ;
@@ -104,18 +104,18 @@ public async Task<object> GetRelationshipAsync(TId id, string relationshipName)
104104 return relationship ;
105105 }
106106
107- public async Task < T > CreateAsync ( T entity )
107+ public virtual async Task < T > CreateAsync ( T entity )
108108 {
109109 return await _entities . CreateAsync ( entity ) ;
110110 }
111111
112- public async Task < T > UpdateAsync ( TId id , T entity )
112+ public virtual async Task < T > UpdateAsync ( TId id , T entity )
113113 {
114114 var updatedEntity = await _entities . UpdateAsync ( id , entity ) ;
115115 return updatedEntity ;
116116 }
117117
118- public async Task UpdateRelationshipsAsync ( TId id , string relationshipName , List < DocumentData > relationships )
118+ public virtual async Task UpdateRelationshipsAsync ( TId id , string relationshipName , List < DocumentData > relationships )
119119 {
120120 relationshipName = _jsonApiContext . ContextGraph
121121 . GetRelationshipName < T > ( relationshipName ) ;
@@ -138,7 +138,7 @@ public async Task UpdateRelationshipsAsync(TId id, string relationshipName, List
138138 await _entities . UpdateRelationshipsAsync ( entity , relationship , relationshipIds ) ;
139139 }
140140
141- public async Task < bool > DeleteAsync ( TId id )
141+ public virtual async Task < bool > DeleteAsync ( TId id )
142142 {
143143 return await _entities . DeleteAsync ( id ) ;
144144 }
0 commit comments