Revision 759bd3c4 trunk/Pithos.Core/FileState.cs
b/trunk/Pithos.Core/FileState.cs | ||
---|---|---|
44 | 44 |
using System.Threading.Tasks; |
45 | 45 |
using Castle.ActiveRecord; |
46 | 46 |
using Castle.ActiveRecord.Framework; |
47 |
using Castle.ActiveRecord.Queries; |
|
48 |
using NHibernate.Criterion; |
|
47 | 49 |
using Pithos.Core.Agents; |
48 | 50 |
using Pithos.Interfaces; |
49 | 51 |
using Pithos.Network; |
... | ... | |
417 | 419 |
throw; |
418 | 420 |
} |
419 | 421 |
} |
422 |
|
|
423 |
public static void RemovePaths(IEnumerable<string> removed) |
|
424 |
{ |
|
425 |
|
|
426 |
var disjunction = new Disjunction(); |
|
427 |
|
|
428 |
foreach (var path in removed) |
|
429 |
{ |
|
430 |
disjunction.Add(Restrictions.On<FileState>(s => s.FilePath).IsLike(path, MatchMode.Start)); |
|
431 |
} |
|
432 |
|
|
433 |
|
|
434 |
|
|
435 |
var query=QueryOver.Of<FileState>().Where(disjunction); |
|
436 |
var aq = new ProjectionQuery<FileState,Guid>(query.DetachedCriteria, |
|
437 |
Projections.ProjectionList().Add(Projections.Id())); |
|
438 |
var ids=aq.Execute(); |
|
439 |
FileState.DeleteAll(ids); |
|
440 |
|
|
441 |
} |
|
420 | 442 |
} |
421 | 443 |
|
422 | 444 |
[ActiveRecord("Tags")] |
Also available in: Unified diff