@@ -1130,12 +1130,7 @@ public void Add(T entity)
11301130 {
11311131 if ( entity == null ) throw new ArgumentNullException ( "entity" ) ;
11321132
1133- if ( ! RunAspect ( attribute => attribute . OnAddExecuting ( entity , _repositoryActionContext ) ) )
1134- return ;
1135-
11361133 ProcessAdd ( entity , BatchMode ) ;
1137-
1138- RunAspect ( attribute => attribute . OnAddExecuted ( entity , _repositoryActionContext ) ) ;
11391134 }
11401135 catch ( Exception ex )
11411136 {
@@ -1147,7 +1142,13 @@ public void Add(T entity)
11471142 // used from the Add method above and the Save below for the batch save
11481143 private void ProcessAdd ( T entity , bool batchMode )
11491144 {
1145+ if ( ! RunAspect ( attribute => attribute . OnAddExecuting ( entity , _repositoryActionContext ) ) )
1146+ return ;
1147+
11501148 AddItem ( entity ) ;
1149+
1150+ RunAspect ( attribute => attribute . OnAddExecuted ( entity , _repositoryActionContext ) ) ;
1151+
11511152 if ( batchMode ) return ;
11521153
11531154 Save ( ) ;
@@ -1189,12 +1190,7 @@ public void Delete(T entity)
11891190 {
11901191 if ( entity == null ) throw new ArgumentNullException ( "entity" ) ;
11911192
1192- if ( ! RunAspect ( attribute => attribute . OnDeleteExecuting ( entity , _repositoryActionContext ) ) )
1193- return ;
1194-
11951193 ProcessDelete ( entity , BatchMode ) ;
1196-
1197- RunAspect ( attribute => attribute . OnDeleteExecuted ( entity , _repositoryActionContext ) ) ;
11981194 }
11991195 catch ( Exception ex )
12001196 {
@@ -1206,7 +1202,13 @@ public void Delete(T entity)
12061202 // used from the Delete method above and the Save below for the batch save
12071203 private void ProcessDelete ( T entity , bool batchMode )
12081204 {
1205+ if ( ! RunAspect ( attribute => attribute . OnDeleteExecuting ( entity , _repositoryActionContext ) ) )
1206+ return ;
1207+
12091208 DeleteItem ( entity ) ;
1209+
1210+ RunAspect ( attribute => attribute . OnDeleteExecuted ( entity , _repositoryActionContext ) ) ;
1211+
12101212 if ( batchMode ) return ;
12111213
12121214 Save ( ) ;
@@ -1265,12 +1267,7 @@ public void Update(T entity)
12651267 {
12661268 if ( entity == null ) throw new ArgumentNullException ( "entity" ) ;
12671269
1268- if ( ! RunAspect ( attribute => attribute . OnUpdateExecuting ( entity , _repositoryActionContext ) ) )
1269- return ;
1270-
12711270 ProcessUpdate ( entity , BatchMode ) ;
1272-
1273- RunAspect ( attribute => attribute . OnUpdateExecuted ( entity , _repositoryActionContext ) ) ;
12741271 }
12751272 catch ( Exception ex )
12761273 {
@@ -1282,7 +1279,13 @@ public void Update(T entity)
12821279 // used from the Update method above and the Save below for the batch save
12831280 private void ProcessUpdate ( T entity , bool batchMode )
12841281 {
1282+ if ( ! RunAspect ( attribute => attribute . OnUpdateExecuting ( entity , _repositoryActionContext ) ) )
1283+ return ;
1284+
12851285 UpdateItem ( entity ) ;
1286+
1287+ RunAspect ( attribute => attribute . OnUpdateExecuted ( entity , _repositoryActionContext ) ) ;
1288+
12861289 if ( batchMode ) return ;
12871290
12881291 Save ( ) ;
0 commit comments