File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,13 @@ public partial interface IRepository<T> where T : BaseEntity
6767 /// <remarks>Implementors should delegate this to the current <see cref="IDbContext" /></remarks>
6868 void Delete ( T entity ) ;
6969
70+ /// <summary>
71+ /// Marks existing entities to be deleted from the store.
72+ /// </summary>
73+ /// <param name="entities">A list of entity instances that should be deleted from the database.</param>
74+ /// <remarks>Implementors should delegate this to the current <see cref="IDbContext" /></remarks>
75+ void DeleteRange ( IEnumerable < T > entities ) ;
76+
7077 [ Obsolete ( "Use the extension method from 'SmartStore.Core, SmartStore.Core.Data' instead" ) ]
7178 IQueryable < T > Expand ( IQueryable < T > query , string path ) ;
7279
Original file line number Diff line number Diff line change @@ -158,13 +158,24 @@ public void Delete(T entity)
158158 {
159159 this . Entities . Attach ( entity ) ;
160160 }
161-
161+
162162 this . Entities . Remove ( entity ) ;
163163
164164 if ( this . AutoCommitEnabled )
165165 _context . SaveChanges ( ) ;
166166 }
167167
168+ public void DeleteRange ( IEnumerable < T > entities )
169+ {
170+ if ( entities == null )
171+ throw new ArgumentNullException ( "entities" ) ;
172+
173+ this . Entities . RemoveRange ( entities ) ;
174+
175+ if ( this . AutoCommitEnabled )
176+ _context . SaveChanges ( ) ;
177+ }
178+
168179 [ Obsolete ( "Use the extension method from 'SmartStore.Core, SmartStore.Core.Data' instead" ) ]
169180 public IQueryable < T > Expand ( IQueryable < T > query , string path )
170181 {
You can’t perform that action at this time.
0 commit comments