Revision cfed7823 trunk/Pithos.Core/FileState.cs
b/trunk/Pithos.Core/FileState.cs | ||
---|---|---|
9 | 9 |
using System.Threading.Tasks; |
10 | 10 |
using Castle.ActiveRecord; |
11 | 11 |
using Castle.ActiveRecord.Framework; |
12 |
using Castle.ActiveRecord.Queries; |
|
12 | 13 |
using NHibernate.Engine; |
13 | 14 |
using Pithos.Core.Agents; |
14 | 15 |
using Pithos.Interfaces; |
... | ... | |
59 | 60 |
|
60 | 61 |
[Property] |
61 | 62 |
public DateTime? VersionTimeStamp { get; set; } |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
[Property] |
|
66 |
public bool IsShared { get; set; } |
|
67 |
|
|
68 |
[Property] |
|
69 |
public string SharedBy { get; set; } |
|
70 |
|
|
71 |
[Property] |
|
72 |
public bool ShareWrite { get; set; } |
|
73 |
|
|
63 | 74 |
|
64 | 75 |
[HasMany(Cascade = ManyRelationCascadeEnum.AllDeleteOrphan, Lazy = true,Inverse=true)] |
65 | 76 |
public IList<FileTag> Tags |
... | ... | |
88 | 99 |
throw new ArgumentNullException("absolutePath"); |
89 | 100 |
Contract.EndContractBlock(); |
90 | 101 |
|
91 |
var stateKeys = from state in FileState.Queryable |
|
92 |
where state.FilePath == absolutePath.ToLower() |
|
93 |
select state.Id; |
|
94 |
DeleteAll(stateKeys); |
|
102 |
FileState.Execute((session, instance) => |
|
103 |
{ |
|
104 |
const string hqlDelete = "delete FileState where FilePath = :path"; |
|
105 |
var deletedEntities = session.CreateQuery(hqlDelete) |
|
106 |
.SetString("path", absolutePath.ToLower()) |
|
107 |
.ExecuteUpdate(); |
|
108 |
return null; |
|
109 |
},null); |
|
110 |
|
|
95 | 111 |
} |
96 | 112 |
|
97 | 113 |
public static Task<FileState> CreateForAsync(string filePath,int blockSize,string algorithm) |
Also available in: Unified diff