@@ -41,7 +41,7 @@ public EntityResourceService(
41
41
_logger = loggerFactory . CreateLogger < EntityResourceService < T , TId > > ( ) ;
42
42
}
43
43
44
- public async Task < IEnumerable < T > > GetAsync ( )
44
+ public virtual async Task < IEnumerable < T > > GetAsync ( )
45
45
{
46
46
var entities = _entities . Get ( ) ;
47
47
@@ -58,7 +58,7 @@ public async Task<IEnumerable<T>> GetAsync()
58
58
return pagedEntities ;
59
59
}
60
60
61
- public async Task < T > GetAsync ( TId id )
61
+ public virtual async Task < T > GetAsync ( TId id )
62
62
{
63
63
T entity ;
64
64
if ( _jsonApiContext . QuerySet ? . IncludedRelationships != null )
@@ -78,13 +78,13 @@ private async Task<T> GetWithRelationshipsAsync(TId id)
78
78
return await query . FirstOrDefaultAsync ( e => e . Id . Equals ( id ) ) ;
79
79
}
80
80
81
- public async Task < object > GetRelationshipsAsync ( TId id , string relationshipName )
81
+ public virtual async Task < object > GetRelationshipsAsync ( TId id , string relationshipName )
82
82
{
83
83
_jsonApiContext . IsRelationshipData = true ;
84
84
return await GetRelationshipAsync ( id , relationshipName ) ;
85
85
}
86
86
87
- public async Task < object > GetRelationshipAsync ( TId id , string relationshipName )
87
+ public virtual async Task < object > GetRelationshipAsync ( TId id , string relationshipName )
88
88
{
89
89
relationshipName = _jsonApiContext . ContextGraph
90
90
. GetRelationshipName < T > ( relationshipName ) ;
@@ -93,7 +93,7 @@ public async Task<object> GetRelationshipAsync(TId id, string relationshipName)
93
93
throw new JsonApiException ( 422 , "Relationship name not specified." ) ;
94
94
95
95
_logger . LogTrace ( $ "Looking up '{ relationshipName } '...") ;
96
-
96
+
97
97
var entity = await _entities . GetAndIncludeAsync ( id , relationshipName ) ;
98
98
if ( entity == null )
99
99
throw new JsonApiException ( 404 , $ "Relationship { relationshipName } not found.") ;
@@ -104,18 +104,18 @@ public async Task<object> GetRelationshipAsync(TId id, string relationshipName)
104
104
return relationship ;
105
105
}
106
106
107
- public async Task < T > CreateAsync ( T entity )
107
+ public virtual async Task < T > CreateAsync ( T entity )
108
108
{
109
109
return await _entities . CreateAsync ( entity ) ;
110
110
}
111
111
112
- public async Task < T > UpdateAsync ( TId id , T entity )
112
+ public virtual async Task < T > UpdateAsync ( TId id , T entity )
113
113
{
114
114
var updatedEntity = await _entities . UpdateAsync ( id , entity ) ;
115
115
return updatedEntity ;
116
116
}
117
117
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 )
119
119
{
120
120
relationshipName = _jsonApiContext . ContextGraph
121
121
. GetRelationshipName < T > ( relationshipName ) ;
@@ -138,7 +138,7 @@ public async Task UpdateRelationshipsAsync(TId id, string relationshipName, List
138
138
await _entities . UpdateRelationshipsAsync ( entity , relationship , relationshipIds ) ;
139
139
}
140
140
141
- public async Task < bool > DeleteAsync ( TId id )
141
+ public virtual async Task < bool > DeleteAsync ( TId id )
142
142
{
143
143
return await _entities . DeleteAsync ( id ) ;
144
144
}
0 commit comments