-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathObjectInfo.cs
More file actions
62 lines (53 loc) · 1.68 KB
/
ObjectInfo.cs
File metadata and controls
62 lines (53 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
namespace SharpQuant.ObjectStore
{
public interface IObjectInfo
{
string Catalogue { get; }
string ID { get; }
DateTime Version { get; }
string Type { get; }
IDictionary<string, string> Tags { get; }
byte[] Data { get; }
int DataSize { get; }
}
[DataContract, Serializable]
public class ObjectInfo : IObjectInfo
{
[DataMember(Order = 1, Name = "Catalogue")]
public string Catalogue { get; set; }
[DataMember(Order = 2, Name = "ID")]
public string ID { get; set; }
[DataMember(Order = 3, Name = "Version")]
public DateTime Version { get; set; }
[DataMember(Order = 4, Name = "Type")]
public string Type { get; set; }
[DataMember(Order = 5, Name = "Tags")]
public IDictionary<string, string> Tags { get; set; }
[DataMember(Order = 6, Name = "Data")]
public byte[] Data { get; set; }
[DataMember(Order = 7, Name = "DataSize")]
public int DataSize { get; set; }
public ObjectInfo()
{
Tags = new Dictionary<string, string>();
}
public static ObjectInfo Create(IObjectInfo info)
{
return new ObjectInfo()
{
Catalogue = info.Catalogue,
ID = info.ID,
Version = info.Version,
Type = info.Type,
Tags = new Dictionary<string, string>(info.Tags),
Data = info.Data,
DataSize = info.DataSize
};
}
}
}