Added Tag storage
[pithos-ms-client] / trunk / Pithos.Core / FileState.cs
1 // -----------------------------------------------------------------------
2 // <copyright file="FileState.cs" company="Microsoft">
3 // TODO: Update copyright text.
4 // </copyright>
5 // -----------------------------------------------------------------------
6
7 using Castle.ActiveRecord;
8 using Castle.ActiveRecord.Framework;
9 using Pithos.Interfaces;
10
11 namespace Pithos.Core
12 {
13     using System;
14     using System.Collections.Generic;
15     using System.Linq;
16     using System.Text;
17
18     /// <summary>
19     /// TODO: Update summary.
20     /// </summary>
21     [ActiveRecord]
22     public class FileState:ActiveRecordLinqBase<FileState>
23     {
24         private string _filePath;
25         private IList<FileTag> _tags=new List<FileTag>();
26
27
28         [PrimaryKey]
29         public string FilePath
30         {
31             get { return _filePath; }
32             set { _filePath = value.ToLower(); }
33         }
34
35         [Property]
36         public FileOverlayStatus OverlayStatus { get; set; }
37
38         [Property]
39         public FileStatus FileStatus { get; set; }
40
41         [Property]
42         public string Checksum { get; set; }
43
44         [HasMany(Cascade=ManyRelationCascadeEnum.AllDeleteOrphan,Lazy=true)]
45         public IList<FileTag> Tags
46         {
47             get { return _tags; }   
48             set { _tags=value;}
49         }
50        
51     }
52
53     [ActiveRecord]
54     public class FileTag : ActiveRecordLinqBase<FileTag>
55     {
56         [PrimaryKey]
57         public string FilePath { get; set; }
58
59         [Property]
60         public string Value { get; set; }
61
62         [BelongsTo("FilePath")]
63         public FileState FileState { get; set; }
64
65     }
66
67
68 }