0
|
1 //---------------------------------------------------------------------------------------------------
|
|
2 // This code was generated by BLToolkit.
|
|
3 //---------------------------------------------------------------------------------------------------
|
|
4 using System;
|
|
5 using System.Linq;
|
|
6 using System.Linq.Expressions;
|
|
7 using BLToolkit.Data.Linq;
|
|
8 using LightStation.API;
|
|
9 using LightStation.Storage.Relational;
|
|
10 using NUnit.Framework;
|
|
11
|
|
12 namespace LightStation.API
|
|
13 {
|
|
14 public interface IStationObjectID
|
|
15 {
|
|
16 }
|
|
17 }
|
|
18
|
|
19 namespace LightStation.API
|
|
20 {
|
|
21 [SerializableAttribute()]
|
|
22 public class MachineIdentifier : LightStation.API.StationObject, LightStation.Utils.Validation.IValidatable
|
|
23 {
|
|
24 public LightStation.API.StationObjectID OrganizationId { get; set; }
|
|
25
|
|
26 public string Value { get; set; }
|
|
27
|
|
28 public LightStation.API.StationObjectID SymbolId { get; set; }
|
|
29
|
|
30 public DateTime StartDate { get; set; }
|
|
31
|
|
32 public DateTime? EndDate { get; set; }
|
|
33 }
|
|
34
|
|
35 [SerializableAttribute()]
|
|
36 public struct NullableStationObjectID : IStationObjectID
|
|
37 {
|
|
38 public NullableStationObjectID(int? value)
|
|
39 {
|
|
40 throw new NotImplementedException();
|
|
41 }
|
|
42
|
|
43 public int? Value { get; set; }
|
|
44 }
|
|
45
|
|
46 [System.SerializableAttribute()]
|
|
47 public abstract class StationObject : Utils.Validation.IValidatable
|
|
48 {
|
|
49 public StationObjectID Id { get; set; }
|
|
50 }
|
|
51
|
|
52 [System.SerializableAttribute()]
|
|
53 public struct StationObjectID : IStationObjectID
|
|
54 {
|
|
55 public StationObjectID(int value)
|
|
56 {
|
|
57 }
|
|
58
|
|
59 public int Value { get; set; }
|
|
60 }
|
|
61
|
|
62 [Serializable]
|
|
63 public class Symbol : LightStation.API.StationObject, LightStation.Utils.Validation.IValidatable
|
|
64 {
|
|
65 public string UniqueId { get; set; }
|
|
66
|
|
67 public string TypeName { get; set; }
|
|
68
|
|
69 public bool IsActive { get; set; }
|
|
70
|
|
71 public DateTime StartDate { get; set; }
|
|
72
|
|
73 public DateTime? EndDate { get; set; }
|
|
74
|
|
75 public string Description { get; set; }
|
|
76
|
|
77 public string Extra { get; set; }
|
|
78
|
|
79 public LightStation.API.NullableStationObjectID DataProvenanceId { get; set; }
|
|
80
|
|
81 public LightStation.API.NullableStationObjectID CountryId { get; set; }
|
|
82
|
|
83 public LightStation.API.NullableStationObjectID CurrencyId { get; set; }
|
|
84
|
|
85 public LightStation.API.NullableStationObjectID DataProviderAccountId { get; set; }
|
|
86
|
|
87 public LightStation.API.NullableStationObjectID PrimaryExchangeId { get; set; }
|
|
88
|
|
89 public LightStation.API.NullableStationObjectID CompositeExchangeId { get; set; }
|
|
90
|
|
91 public string Name { get; set; }
|
|
92
|
|
93 public string PrimaryTicker { get; set; }
|
|
94
|
|
95 public DateTime AsOfDate { get; set; }
|
|
96 }
|
|
97 }
|
|
98
|
|
99 namespace LightStation.Storage.Relational
|
|
100 {
|
|
101 //[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
102 //class <>c__DisplayClass3
|
|
103 //{
|
|
104 // public LightStation.Storage.Relational.IGenericQueryDataSource ds;
|
|
105 //
|
|
106 // public Nullable<DateTime> asOfDate;
|
|
107 //}
|
|
108
|
|
109 public interface IGenericQueryDataSource
|
|
110 {
|
|
111 System.Linq.IQueryable<LightStation.API.MachineIdentifier> MachineIdentifiers { get; set; }
|
|
112 }
|
|
113
|
|
114 public interface IHasDbId<I>
|
|
115 {
|
|
116 }
|
|
117
|
|
118 [BLToolkit.DataAccess.TableNameAttribute(Name = "ls_exchange")]
|
|
119 public class ls_exchange : LightStation.Storage.Relational.IHasDbId<int>
|
|
120 {
|
|
121 public int organization_id { get; set; }
|
|
122 }
|
|
123
|
|
124 [BLToolkit.DataAccess.TableNameAttribute(Name = "ls_symbol")]
|
|
125 public class ls_symbol : LightStation.Storage.Relational.IHasDbId<int>
|
|
126 {
|
|
127 [BLToolkit.DataAccess.PrimaryKeyAttribute((Int32)1)]
|
|
128 [BLToolkit.DataAccess.IdentityAttribute()]
|
|
129 public int id { get; set; }
|
|
130
|
|
131 public string unique_id { get; set; }
|
|
132
|
|
133 public bool is_active { get; set; }
|
|
134
|
|
135 [BLToolkit.Mapping.NullableAttribute()]
|
|
136 public string type_name { get; set; }
|
|
137
|
|
138 public DateTime start_date { get; set; }
|
|
139
|
|
140 [BLToolkit.Mapping.NullableAttribute()]
|
|
141 public Nullable<DateTime> end_date { get; set; }
|
|
142
|
|
143 [BLToolkit.Mapping.NullableAttribute()]
|
|
144 public Nullable<int> data_provenance_id { get; set; }
|
|
145
|
|
146 [BLToolkit.Mapping.NullableAttribute()]
|
|
147 public Nullable<int> country_id { get; set; }
|
|
148
|
|
149 [BLToolkit.Mapping.NullableAttribute()]
|
|
150 public Nullable<int> currency_id { get; set; }
|
|
151
|
|
152 [BLToolkit.Mapping.NullableAttribute()]
|
|
153 public Nullable<int> data_provider_account_id { get; set; }
|
|
154
|
|
155 [BLToolkit.Mapping.NullableAttribute()]
|
|
156 public Nullable<int> primary_exchange_id { get; set; }
|
|
157
|
|
158 [BLToolkit.Mapping.NullableAttribute()]
|
|
159 public Nullable<int> composite_exchange_id { get; set; }
|
|
160
|
|
161 [BLToolkit.Mapping.NullableAttribute()]
|
|
162 public string description { get; set; }
|
|
163
|
|
164 [BLToolkit.Mapping.NullableAttribute()]
|
|
165 public string extra { get; set; }
|
|
166
|
|
167 [BLToolkit.Mapping.AssociationAttribute(ThisKey = "primary_exchange_id", OtherKey = "id", CanBeNull = true)]
|
|
168 public LightStation.Storage.Relational.ls_exchange symbolexchangeprimary { get; set; }
|
|
169 }
|
|
170 }
|
|
171
|
|
172 namespace LightStation.Storage.Relational.Tests.IRelationalStorageTests
|
|
173 {
|
|
174 //[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
175 //class <>c__DisplayClassa5
|
|
176 //{
|
|
177 // public LightStation.API.Symbol symbol;
|
|
178 //}
|
|
179 }
|
|
180
|
|
181 namespace LightStation.Utils.Validation
|
|
182 {
|
|
183 public interface IValidatable
|
|
184 {
|
|
185 }
|
|
186 }
|
|
187
|
|
188 namespace Data.Linq
|
|
189 {
|
|
190 [TestFixture]
|
|
191 public class UserTest : TestBase
|
|
192 {
|
|
193 [Test]
|
|
194 public void Test()
|
|
195 {
|
|
196 // Table(ls_symbol).Select(symbol => new <>f__AnonymousType1`2(symbol = symbol, ids = value(LightStation.Storage.Relational.RelationalDbToBusinessObjectConverterExtensions+<>c__DisplayClass3).ds.MachineIdentifiers.Where(identifier => (((Convert(identifier.StartDate) <= value(LightStation.Storage.Relational.RelationalDbToBusinessObjectConverterExtensions+<>c__DisplayClass3).asOfDate) AndAlso ((identifier.EndDate == Convert(null)) OrElse (identifier.EndDate >= value(LightStation.Storage.Relational.RelationalDbToBusinessObjectConverterExtensions+<>c__DisplayClass3).asOfDate))) AndAlso (identifier.SymbolId.Value == symbol.id))))).Select(<>h__TransparentIdentifier0 => new <>f__AnonymousType2`2(<>h__TransparentIdentifier0 = <>h__TransparentIdentifier0, name = <>h__TransparentIdentifier0.ids.Where(x => (Convert(x.OrganizationId) == Convert(Organization.SelfId))).Select(x => x.Value).FirstOrDefault())).Select(<>h__TransparentIdentifier1 => new <>f__AnonymousType3`2(<>h__TransparentIdentifier1 = <>h__TransparentIdentifier1, primaryTicker = <>h__TransparentIdentifier1.<>h__TransparentIdentifier0.ids.Where(x => (Convert(x.OrganizationId) == <>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.symbolexchangeprimary.organization_id)).Select(x => x.Value).FirstOrDefault())).Select(<>h__TransparentIdentifier2 => new Symbol() {Id = new StationObjectID() {Value = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.id}, UniqueId = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.unique_id, TypeName = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.type_name, IsActive = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.is_active, StartDate = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.start_date, EndDate = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.end_date, Description = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.description, Extra = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.extra, DataProvenanceId = new NullableStationObjectID() {Value = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.data_provenance_id}, CountryId = new NullableStationObjectID() {Value = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.country_id}, CurrencyId = new NullableStationObjectID() {Value = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.currency_id}, DataProviderAccountId = new NullableStationObjectID() {Value = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.data_provider_account_id}, PrimaryExchangeId = new NullableStationObjectID() {Value = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.primary_exchange_id}, CompositeExchangeId = new NullableStationObjectID() {Value = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.<>h__TransparentIdentifier0.symbol.composite_exchange_id}, Name = <>h__TransparentIdentifier2.<>h__TransparentIdentifier1.name, PrimaryTicker = <>h__TransparentIdentifier2.primaryTicker, AsOfDate = value(LightStation.Storage.Relational.RelationalDbToBusinessObjectConverterExtensions+<>c__DisplayClass3).asOfDate.Value}).First(x => (Convert(x.Id) == Convert(value(LightStation.Storage.Relational.Tests.IRelationalStorageTests.SymbolTests+<>c__DisplayClassa5).symbol.Id)))
|
|
197 ForEachProvider(db =>
|
|
198 db.GetTable<ls_symbol>()
|
|
199 .Select(
|
|
200 // Unknown expression.
|
|
201 symbol => new { symbol = symbol, ids = value(LightStation.Storage.Relational.RelationalDbToBusinessObjectConverterExtensions+<>c__DisplayClass3).ds.MachineIdentifiers.Where(identifier => (((Convert(identifier.StartDate) <= value(LightStation.Storage.Relational.RelationalDbToBusinessObjectConverterExtensions+<>c__DisplayClass3).asOfDate) AndAlso ((identifier.EndDate == Convert(null)) OrElse (identifier.EndDate >= value(LightStation.Storage.Relational.RelationalDbToBusinessObjectConverterExtensions+<>c__DisplayClass3).asOfDate))) AndAlso (identifier.SymbolId.Value == symbol.id)))))
|
|
202 .Select(
|
|
203 // Unknown expression.
|
|
204 tp0 => new { tp0 = tp0, name = tp0.ids.Where(x => (Convert(x.OrganizationId) == Convert(Organization.SelfId))).Select(x => x.Value).FirstOrDefault()) }
|
|
205 .}Select(
|
|
206 // Unknown expression.
|
|
207 tp1 => new <>f__AnonymousType3`2(tp1 = tp1, primaryTicker = tp1.tp0.ids.Where(x => (Convert(x.OrganizationId) == tp1.tp0.symbol.symbolexchangeprimary.organization_id)).Select(x => x.Value).FirstOrDefault()))
|
|
208 .Select(
|
|
209 // Unknown expression.
|
|
210 tp2 => new Symbol() {Id = new StationObjectID() {Value = tp2.tp1.tp0.symbol.id}, UniqueId = tp2.tp1.tp0.symbol.unique_id, TypeName = tp2.tp1.tp0.symbol.type_name, IsActive = tp2.tp1.tp0.symbol.is_active, StartDate = tp2.tp1.tp0.symbol.start_date, EndDate = tp2.tp1.tp0.symbol.end_date, Description = tp2.tp1.tp0.symbol.description, Extra = tp2.tp1.tp0.symbol.extra, DataProvenanceId = new NullableStationObjectID() {Value = tp2.tp1.tp0.symbol.data_provenance_id}, CountryId = new NullableStationObjectID() {Value = tp2.tp1.tp0.symbol.country_id}, CurrencyId = new NullableStationObjectID() {Value = tp2.tp1.tp0.symbol.currency_id}, DataProviderAccountId = new NullableStationObjectID() {Value = tp2.tp1.tp0.symbol.data_provider_account_id}, PrimaryExchangeId = new NullableStationObjectID() {Value = tp2.tp1.tp0.symbol.primary_exchange_id}, CompositeExchangeId = new NullableStationObjectID() {Value = tp2.tp1.tp0.symbol.composite_exchange_id}, Name = tp2.tp1.name, PrimaryTicker = tp2.primaryTicker, AsOfDate = value(LightStation.Storage.Relational.RelationalDbToBusinessObjectConverterExtensions+<>c__DisplayClass3).asOfDate.Value})
|
|
211 .First<LightStation.API.Symbol>(
|
|
212 // Unknown expression.
|
|
213 x => (Convert(x.Id) == Convert(value(LightStation.Storage.Relational.Tests.IRelationalStorageTests.SymbolTests+<>c__DisplayClassa5).symbol.Id))));
|
|
214 }
|
|
215 }
|
|
216 }
|
|
217
|