This repository has been archived by the owner on May 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
/
CompositeType`1.cs
106 lines (91 loc) · 3.18 KB
/
CompositeType`1.cs
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using System;
using System.Collections.Generic;
using System.Linq;
namespace FluentCassandra.Types
{
public class CompositeType<T1> : CompositeType
where T1 : CassandraObject
{
public CompositeType(T1 t1)
{
SetValue(new CassandraObject[] { t1 });
}
public CompositeType()
{
ComponentTypeHints = GetType().GetGenericArguments().Select(x => new CassandraType(x.Name)).ToList();
}
public T1 Item1 { get { return (T1)GetValue<List<CassandraObject>>()[0]; } }
}
public class CompositeType<T1, T2> : CompositeType
where T1 : CassandraObject
where T2 : CassandraObject
{
public CompositeType(T1 t1, T2 t2)
{
SetValue(new CassandraObject[] { t1, t2 });
}
public CompositeType()
{
ComponentTypeHints = GetType().GetGenericArguments().Select(x => new CassandraType(x.Name)).ToList();
}
public T1 Item1 { get { return (T1)GetValue<List<CassandraObject>>()[0]; } }
public T2 Item2 { get { return (T2)GetValue<List<CassandraObject>>()[1]; } }
}
public class CompositeType<T1, T2, T3> : CompositeType
where T1 : CassandraObject
where T2 : CassandraObject
where T3 : CassandraObject
{
public CompositeType(T1 t1, T2 t2, T3 t3)
{
SetValue(new CassandraObject[] { t1, t2, t3 });
}
public CompositeType()
{
ComponentTypeHints = GetType().GetGenericArguments().Select(x => new CassandraType(x.Name)).ToList();
}
public T1 Item1 { get { return (T1)GetValue<List<CassandraObject>>()[0]; } }
public T2 Item2 { get { return (T2)GetValue<List<CassandraObject>>()[1]; } }
public T3 Item3 { get { return (T3)GetValue<List<CassandraObject>>()[2]; } }
}
public class CompositeType<T1, T2, T3, T4> : CompositeType
where T1 : CassandraObject
where T2 : CassandraObject
where T3 : CassandraObject
where T4 : CassandraObject
{
public CompositeType(T1 t1, T2 t2, T3 t3, T4 t4)
{
SetValue(new CassandraObject[] { t1, t2, t3, t4 });
}
public CompositeType()
{
ComponentTypeHints = GetType().GetGenericArguments().Select(x => new CassandraType(x.Name)).ToList();
}
public T1 Item1 { get { return (T1)GetValue<List<CassandraObject>>()[0]; } }
public T2 Item2 { get { return (T2)GetValue<List<CassandraObject>>()[1]; } }
public T3 Item3 { get { return (T3)GetValue<List<CassandraObject>>()[2]; } }
public T4 Item4 { get { return (T4)GetValue<List<CassandraObject>>()[3]; } }
}
public class CompositeType<T1, T2, T3, T4, T5> : CompositeType
where T1 : CassandraObject
where T2 : CassandraObject
where T3 : CassandraObject
where T4 : CassandraObject
where T5 : CassandraObject
{
public CompositeType(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
{
SetValue(new CassandraObject[] { t1, t2, t3, t4, t5 });
}
public CompositeType()
{
ComponentTypeHints = GetType().GetGenericArguments().Select(x => new CassandraType(x.Name)).ToList();
}
public T1 Item1 { get { return (T1)GetValue<List<CassandraObject>>()[0]; } }
public T2 Item2 { get { return (T2)GetValue<List<CassandraObject>>()[1]; } }
public T3 Item3 { get { return (T3)GetValue<List<CassandraObject>>()[2]; } }
public T4 Item4 { get { return (T4)GetValue<List<CassandraObject>>()[3]; } }
public T5 Item5 { get { return (T5)GetValue<List<CassandraObject>>()[4]; } }
}
}