|
11 | 11 | namespace Microsoft.Data.SqlClient.UnitTests.UdtSerialization.SerializedTypes;
|
12 | 12 |
|
13 | 13 | // Simple cases: a struct containing one of the designated primitive types
|
14 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct BoolWrapperStruct { public bool Field1; } |
15 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct ByteWrapperStruct { public byte Field1; } |
16 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct SByteWrapperStruct { public sbyte Field1; } |
17 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct UShortWrapperStruct { public ushort Field1; } |
18 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct ShortWrapperStruct { public short Field1; } |
19 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct UIntWrapperStruct { public uint Field1; } |
20 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct IntWrapperStruct { public int Field1; } |
21 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct ULongWrapperStruct { public ulong Field1; } |
22 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct LongWrapperStruct { public long Field1; } |
23 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct FloatWrapperStruct { public float Field1; } |
24 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct DoubleWrapperStruct { public double Field1; } |
25 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct SqlByteWrapperStruct { public SqlByte Field1; } |
26 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct SqlInt16WrapperStruct { public SqlInt16 Field1; } |
27 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct SqlInt32WrapperStruct { public SqlInt32 Field1; } |
28 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct SqlInt64WrapperStruct { public SqlInt64 Field1; } |
29 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct SqlBooleanWrapperStruct { public SqlBoolean Field1; } |
30 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct SqlSingleWrapperStruct { public SqlSingle Field1; } |
31 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct SqlDoubleWrapperStruct { public SqlDouble Field1; } |
32 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct SqlDateTimeWrapperStruct { public SqlDateTime Field1; } |
33 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct SqlMoneyWrapperStruct { public SqlMoney Field1; } |
| 14 | +[SqlUserDefinedType(Format.Native)] |
| 15 | +[StructLayout(LayoutKind.Sequential)] |
| 16 | +public struct BoolWrapperStruct { public bool Field1; } |
| 17 | + |
| 18 | +[SqlUserDefinedType(Format.Native)] |
| 19 | +[StructLayout(LayoutKind.Sequential)] |
| 20 | +public struct ByteWrapperStruct { public byte Field1; } |
| 21 | + |
| 22 | +[SqlUserDefinedType(Format.Native)] |
| 23 | +[StructLayout(LayoutKind.Sequential)] |
| 24 | +public struct SByteWrapperStruct { public sbyte Field1; } |
| 25 | + |
| 26 | +[SqlUserDefinedType(Format.Native)] |
| 27 | +[StructLayout(LayoutKind.Sequential)] |
| 28 | +public struct UShortWrapperStruct { public ushort Field1; } |
| 29 | + |
| 30 | +[SqlUserDefinedType(Format.Native)] |
| 31 | +[StructLayout(LayoutKind.Sequential)] |
| 32 | +public struct ShortWrapperStruct { public short Field1; } |
| 33 | + |
| 34 | +[SqlUserDefinedType(Format.Native)] |
| 35 | +[StructLayout(LayoutKind.Sequential)] |
| 36 | +public struct UIntWrapperStruct { public uint Field1; } |
| 37 | + |
| 38 | +[SqlUserDefinedType(Format.Native)] |
| 39 | +[StructLayout(LayoutKind.Sequential)] |
| 40 | +public struct IntWrapperStruct { public int Field1; } |
| 41 | + |
| 42 | +[SqlUserDefinedType(Format.Native)] |
| 43 | +[StructLayout(LayoutKind.Sequential)] |
| 44 | +public struct ULongWrapperStruct { public ulong Field1; } |
| 45 | + |
| 46 | +[SqlUserDefinedType(Format.Native)] |
| 47 | +[StructLayout(LayoutKind.Sequential)] |
| 48 | +public struct LongWrapperStruct { public long Field1; } |
| 49 | + |
| 50 | +[SqlUserDefinedType(Format.Native)] |
| 51 | +[StructLayout(LayoutKind.Sequential)] |
| 52 | +public struct FloatWrapperStruct { public float Field1; } |
| 53 | + |
| 54 | +[SqlUserDefinedType(Format.Native)] |
| 55 | +[StructLayout(LayoutKind.Sequential)] |
| 56 | +public struct DoubleWrapperStruct { public double Field1; } |
| 57 | + |
| 58 | +[SqlUserDefinedType(Format.Native)] |
| 59 | +[StructLayout(LayoutKind.Sequential)] |
| 60 | +public struct SqlByteWrapperStruct { public SqlByte Field1; } |
| 61 | + |
| 62 | +[SqlUserDefinedType(Format.Native)] |
| 63 | +[StructLayout(LayoutKind.Sequential)] |
| 64 | +public struct SqlInt16WrapperStruct { public SqlInt16 Field1; } |
| 65 | + |
| 66 | +[SqlUserDefinedType(Format.Native)] |
| 67 | +[StructLayout(LayoutKind.Sequential)] |
| 68 | +public struct SqlInt32WrapperStruct { public SqlInt32 Field1; } |
| 69 | + |
| 70 | +[SqlUserDefinedType(Format.Native)] |
| 71 | +[StructLayout(LayoutKind.Sequential)] |
| 72 | +public struct SqlInt64WrapperStruct { public SqlInt64 Field1; } |
| 73 | + |
| 74 | +[SqlUserDefinedType(Format.Native)] |
| 75 | +[StructLayout(LayoutKind.Sequential)] |
| 76 | +public struct SqlBooleanWrapperStruct { public SqlBoolean Field1; } |
| 77 | + |
| 78 | +[SqlUserDefinedType(Format.Native)] |
| 79 | +[StructLayout(LayoutKind.Sequential)] |
| 80 | +public struct SqlSingleWrapperStruct { public SqlSingle Field1; } |
| 81 | + |
| 82 | +[SqlUserDefinedType(Format.Native)] |
| 83 | +[StructLayout(LayoutKind.Sequential)] |
| 84 | +public struct SqlDoubleWrapperStruct { public SqlDouble Field1; } |
| 85 | + |
| 86 | +[SqlUserDefinedType(Format.Native)] |
| 87 | +[StructLayout(LayoutKind.Sequential)] |
| 88 | +public struct SqlDateTimeWrapperStruct { public SqlDateTime Field1; } |
| 89 | + |
| 90 | +[SqlUserDefinedType(Format.Native)] |
| 91 | +[StructLayout(LayoutKind.Sequential)] |
| 92 | +public struct SqlMoneyWrapperStruct { public SqlMoney Field1; } |
| 93 | + |
34 | 94 |
|
35 | 95 | // Success case: a class containing one of the designated primitive types
|
36 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public class BoolWrapperClass { public bool Field1; } |
| 96 | +[SqlUserDefinedType(Format.Native)] |
| 97 | +[StructLayout(LayoutKind.Sequential)] |
| 98 | +public class BoolWrapperClass { public bool Field1; } |
37 | 99 |
|
38 | 100 | // Success case: a struct containing one designated primitive type and one nested struct
|
39 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedBoolWrapperStruct { public bool Field1; public BoolWrapperStruct Field2; } |
40 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedByteWrapperStruct { public byte Field1; public ByteWrapperStruct Field2; } |
41 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedSByteWrapperStruct { public sbyte Field1; public SByteWrapperStruct Field2; } |
42 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedUShortWrapperStruct { public ushort Field1; public UShortWrapperStruct Field2; } |
43 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedShortWrapperStruct { public short Field1; public ShortWrapperStruct Field2; } |
44 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedUIntWrapperStruct { public uint Field1; public UIntWrapperStruct Field2; } |
45 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedIntWrapperStruct { public int Field1; public IntWrapperStruct Field2; } |
46 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedULongWrapperStruct { public ulong Field1; public ULongWrapperStruct Field2; } |
47 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedLongWrapperStruct { public long Field1; public LongWrapperStruct Field2; } |
48 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedFloatWrapperStruct { public float Field1; public FloatWrapperStruct Field2; } |
49 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedDoubleWrapperStruct { public double Field1; public DoubleWrapperStruct Field2; } |
50 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedSqlByteWrapperStruct { public SqlByte Field1; public SqlByteWrapperStruct Field2; } |
51 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedSqlInt16WrapperStruct { public SqlInt16 Field1; public SqlInt16WrapperStruct Field2; } |
52 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedSqlInt32WrapperStruct { public SqlInt32 Field1; public SqlInt32WrapperStruct Field2; } |
53 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedSqlInt64WrapperStruct { public SqlInt64 Field1; public SqlInt64WrapperStruct Field2; } |
54 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedSqlBooleanWrapperStruct { public SqlBoolean Field1; public SqlBooleanWrapperStruct Field2; } |
55 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedSqlSingleWrapperStruct { public SqlSingle Field1; public SqlSingleWrapperStruct Field2; } |
56 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedSqlDoubleWrapperStruct { public SqlDouble Field1; public SqlDoubleWrapperStruct Field2; } |
57 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedSqlDateTimeWrapperStruct { public SqlDateTime Field1; public SqlDateTimeWrapperStruct Field2; } |
58 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct NestedSqlMoneyWrapperStruct { public SqlMoney Field1; public SqlMoneyWrapperStruct Field2; } |
| 101 | +[SqlUserDefinedType(Format.Native)] |
| 102 | +[StructLayout(LayoutKind.Sequential)] |
| 103 | +public struct NestedBoolWrapperStruct { public bool Field1; public BoolWrapperStruct Field2; } |
| 104 | + |
| 105 | +[SqlUserDefinedType(Format.Native)] |
| 106 | +[StructLayout(LayoutKind.Sequential)] |
| 107 | +public struct NestedByteWrapperStruct { public byte Field1; public ByteWrapperStruct Field2; } |
| 108 | + |
| 109 | +[SqlUserDefinedType(Format.Native)] |
| 110 | +[StructLayout(LayoutKind.Sequential)] |
| 111 | +public struct NestedSByteWrapperStruct { public sbyte Field1; public SByteWrapperStruct Field2; } |
| 112 | + |
| 113 | +[SqlUserDefinedType(Format.Native)] |
| 114 | +[StructLayout(LayoutKind.Sequential)] |
| 115 | +public struct NestedUShortWrapperStruct { public ushort Field1; public UShortWrapperStruct Field2; } |
| 116 | + |
| 117 | +[SqlUserDefinedType(Format.Native)] |
| 118 | +[StructLayout(LayoutKind.Sequential)] |
| 119 | +public struct NestedShortWrapperStruct { public short Field1; public ShortWrapperStruct Field2; } |
| 120 | + |
| 121 | +[SqlUserDefinedType(Format.Native)] |
| 122 | +[StructLayout(LayoutKind.Sequential)] |
| 123 | +public struct NestedUIntWrapperStruct { public uint Field1; public UIntWrapperStruct Field2; } |
| 124 | + |
| 125 | +[SqlUserDefinedType(Format.Native)] |
| 126 | +[StructLayout(LayoutKind.Sequential)] |
| 127 | +public struct NestedIntWrapperStruct { public int Field1; public IntWrapperStruct Field2; } |
| 128 | + |
| 129 | +[SqlUserDefinedType(Format.Native)] |
| 130 | +[StructLayout(LayoutKind.Sequential)] |
| 131 | +public struct NestedULongWrapperStruct { public ulong Field1; public ULongWrapperStruct Field2; } |
| 132 | + |
| 133 | +[SqlUserDefinedType(Format.Native)] |
| 134 | +[StructLayout(LayoutKind.Sequential)] |
| 135 | +public struct NestedLongWrapperStruct { public long Field1; public LongWrapperStruct Field2; } |
| 136 | + |
| 137 | +[SqlUserDefinedType(Format.Native)] |
| 138 | +[StructLayout(LayoutKind.Sequential)] |
| 139 | +public struct NestedFloatWrapperStruct { public float Field1; public FloatWrapperStruct Field2; } |
| 140 | + |
| 141 | +[SqlUserDefinedType(Format.Native)] |
| 142 | +[StructLayout(LayoutKind.Sequential)] |
| 143 | +public struct NestedDoubleWrapperStruct { public double Field1; public DoubleWrapperStruct Field2; } |
| 144 | + |
| 145 | +[SqlUserDefinedType(Format.Native)] |
| 146 | +[StructLayout(LayoutKind.Sequential)] |
| 147 | +public struct NestedSqlByteWrapperStruct { public SqlByte Field1; public SqlByteWrapperStruct Field2; } |
| 148 | + |
| 149 | +[SqlUserDefinedType(Format.Native)] |
| 150 | +[StructLayout(LayoutKind.Sequential)] |
| 151 | +public struct NestedSqlInt16WrapperStruct { public SqlInt16 Field1; public SqlInt16WrapperStruct Field2; } |
| 152 | + |
| 153 | +[SqlUserDefinedType(Format.Native)] |
| 154 | +[StructLayout(LayoutKind.Sequential)] |
| 155 | +public struct NestedSqlInt32WrapperStruct { public SqlInt32 Field1; public SqlInt32WrapperStruct Field2; } |
| 156 | + |
| 157 | +[SqlUserDefinedType(Format.Native)] |
| 158 | +[StructLayout(LayoutKind.Sequential)] |
| 159 | +public struct NestedSqlInt64WrapperStruct { public SqlInt64 Field1; public SqlInt64WrapperStruct Field2; } |
| 160 | + |
| 161 | +[SqlUserDefinedType(Format.Native)] |
| 162 | +[StructLayout(LayoutKind.Sequential)] |
| 163 | +public struct NestedSqlBooleanWrapperStruct { public SqlBoolean Field1; public SqlBooleanWrapperStruct Field2; } |
| 164 | + |
| 165 | +[SqlUserDefinedType(Format.Native)] |
| 166 | +[StructLayout(LayoutKind.Sequential)] |
| 167 | +public struct NestedSqlSingleWrapperStruct { public SqlSingle Field1; public SqlSingleWrapperStruct Field2; } |
| 168 | + |
| 169 | +[SqlUserDefinedType(Format.Native)] |
| 170 | +[StructLayout(LayoutKind.Sequential)] |
| 171 | +public struct NestedSqlDoubleWrapperStruct { public SqlDouble Field1; public SqlDoubleWrapperStruct Field2; } |
| 172 | + |
| 173 | +[SqlUserDefinedType(Format.Native)] |
| 174 | +[StructLayout(LayoutKind.Sequential)] |
| 175 | +public struct NestedSqlDateTimeWrapperStruct { public SqlDateTime Field1; public SqlDateTimeWrapperStruct Field2; } |
| 176 | + |
| 177 | +[SqlUserDefinedType(Format.Native)] |
| 178 | +[StructLayout(LayoutKind.Sequential)] |
| 179 | +public struct NestedSqlMoneyWrapperStruct { public SqlMoney Field1; public SqlMoneyWrapperStruct Field2; } |
| 180 | + |
59 | 181 |
|
60 | 182 | // Success case: a class containing one designated primitive type and a nested struct
|
61 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public class NestedBoolWrapperClass { public bool Field1; public BoolWrapperStruct Field2; } |
| 183 | +[SqlUserDefinedType(Format.Native)] |
| 184 | +[StructLayout(LayoutKind.Sequential)] |
| 185 | +public class NestedBoolWrapperClass { public bool Field1; public BoolWrapperStruct Field2; } |
62 | 186 |
|
63 | 187 | // Failure case: a struct or a class containing one designated primitive type and a nested class
|
64 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public class InvalidNestedBoolWrapperClass { public bool Field1; public BoolWrapperClass Field2; } |
| 188 | +[SqlUserDefinedType(Format.Native)] |
| 189 | +[StructLayout(LayoutKind.Sequential)] |
| 190 | +public class InvalidNestedBoolWrapperClass { public bool Field1; public BoolWrapperClass Field2; } |
65 | 191 |
|
66 | 192 | // Failure case: a struct or a class containing a field which is not a designated primitive type
|
67 |
| -[SqlUserDefinedType(Format.Native)] [StructLayout(LayoutKind.Sequential)] public struct InvalidIntPtrAndByteWrapperStruct { public byte Field1; public IntPtr Field2; } |
| 193 | +[SqlUserDefinedType(Format.Native)] |
| 194 | +[StructLayout(LayoutKind.Sequential)] |
| 195 | +public struct InvalidIntPtrAndByteWrapperStruct { public byte Field1; public IntPtr Field2; } |
68 | 196 |
|
69 | 197 | // Success case: a struct or a class implementing IBinarySerialize which would not otherwise be serializable
|
70 | 198 | public interface IFormattingProgress
|
|
0 commit comments