ruby_odata 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/LICENSE +24 -0
- data/README.rdoc +107 -0
- data/Rakefile +28 -0
- data/VERSION +1 -0
- data/config/cucumber.yml +7 -0
- data/doc/classes/OData/ClassBuilder.html +219 -0
- data/doc/classes/OData/Operation.html +194 -0
- data/doc/classes/OData/QueryBuilder.html +305 -0
- data/doc/classes/OData/Service.html +420 -0
- data/doc/classes/OData.html +126 -0
- data/doc/created.rid +1 -0
- data/doc/files/README_rdoc.html +252 -0
- data/doc/files/lib/odata_ruby/class_builder_rb.html +101 -0
- data/doc/files/lib/odata_ruby/operation_rb.html +101 -0
- data/doc/files/lib/odata_ruby/query_builder_rb.html +101 -0
- data/doc/files/lib/odata_ruby/service_rb.html +101 -0
- data/doc/files/lib/odata_ruby_rb.html +114 -0
- data/doc/fr_class_index.html +31 -0
- data/doc/fr_file_index.html +32 -0
- data/doc/fr_method_index.html +40 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/features/service.feature +82 -0
- data/features/service_manage.feature +44 -0
- data/features/step_definitions/service_steps.rb +132 -0
- data/features/support/env.rb +4 -0
- data/features/support/hooks.rb +4 -0
- data/lib/odata_ruby/class_builder.rb +84 -0
- data/lib/odata_ruby/operation.rb +18 -0
- data/lib/odata_ruby/query_builder.rb +63 -0
- data/lib/odata_ruby/service.rb +207 -0
- data/lib/odata_ruby.rb +15 -0
- data/ruby_odata.gemspec +94 -0
- data/test/Cassini x64.bat +1 -0
- data/test/Cassini x86.bat +1 -0
- data/test/SampleService/App_Code/Entities.cs +39 -0
- data/test/SampleService/App_Code/Model.Designer.cs +414 -0
- data/test/SampleService/App_Code/Model.edmx +140 -0
- data/test/SampleService/App_Data/_TestDB.mdf +0 -0
- data/test/SampleService/App_Data/_TestDB_Log.ldf +0 -0
- data/test/SampleService/Entities.svc +1 -0
- data/test/SampleService/web.config +27 -0
- data/test/blueprints.rb +16 -0
- metadata +158 -0
@@ -0,0 +1,414 @@
|
|
1
|
+
//------------------------------------------------------------------------------
|
2
|
+
// <auto-generated>
|
3
|
+
// This code was generated from a template.
|
4
|
+
//
|
5
|
+
// Manual changes to this file may cause unexpected behavior in your application.
|
6
|
+
// Manual changes to this file will be overwritten if the code is regenerated.
|
7
|
+
// </auto-generated>
|
8
|
+
//------------------------------------------------------------------------------
|
9
|
+
|
10
|
+
using System;
|
11
|
+
using System.Data.Objects;
|
12
|
+
using System.Data.Objects.DataClasses;
|
13
|
+
using System.Data.EntityClient;
|
14
|
+
using System.ComponentModel;
|
15
|
+
using System.Xml.Serialization;
|
16
|
+
using System.Runtime.Serialization;
|
17
|
+
|
18
|
+
[assembly: EdmSchemaAttribute()]
|
19
|
+
#region EDM Relationship Metadata
|
20
|
+
|
21
|
+
[assembly: EdmRelationshipAttribute("Model", "CategoryProduct", "Category", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(Model.Category), "Product", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(Model.Product))]
|
22
|
+
|
23
|
+
#endregion
|
24
|
+
|
25
|
+
namespace Model
|
26
|
+
{
|
27
|
+
#region Contexts
|
28
|
+
|
29
|
+
/// <summary>
|
30
|
+
/// No Metadata Documentation available.
|
31
|
+
/// </summary>
|
32
|
+
public partial class ModelContainer : ObjectContext
|
33
|
+
{
|
34
|
+
#region Constructors
|
35
|
+
|
36
|
+
/// <summary>
|
37
|
+
/// Initializes a new ModelContainer object using the connection string found in the 'ModelContainer' section of the application configuration file.
|
38
|
+
/// </summary>
|
39
|
+
public ModelContainer() : base("name=ModelContainer", "ModelContainer")
|
40
|
+
{
|
41
|
+
this.ContextOptions.LazyLoadingEnabled = true;
|
42
|
+
OnContextCreated();
|
43
|
+
}
|
44
|
+
|
45
|
+
/// <summary>
|
46
|
+
/// Initialize a new ModelContainer object.
|
47
|
+
/// </summary>
|
48
|
+
public ModelContainer(string connectionString) : base(connectionString, "ModelContainer")
|
49
|
+
{
|
50
|
+
this.ContextOptions.LazyLoadingEnabled = true;
|
51
|
+
OnContextCreated();
|
52
|
+
}
|
53
|
+
|
54
|
+
/// <summary>
|
55
|
+
/// Initialize a new ModelContainer object.
|
56
|
+
/// </summary>
|
57
|
+
public ModelContainer(EntityConnection connection) : base(connection, "ModelContainer")
|
58
|
+
{
|
59
|
+
this.ContextOptions.LazyLoadingEnabled = true;
|
60
|
+
OnContextCreated();
|
61
|
+
}
|
62
|
+
|
63
|
+
#endregion
|
64
|
+
|
65
|
+
#region Partial Methods
|
66
|
+
|
67
|
+
partial void OnContextCreated();
|
68
|
+
|
69
|
+
#endregion
|
70
|
+
|
71
|
+
#region ObjectSet Properties
|
72
|
+
|
73
|
+
/// <summary>
|
74
|
+
/// No Metadata Documentation available.
|
75
|
+
/// </summary>
|
76
|
+
public ObjectSet<Product> Products
|
77
|
+
{
|
78
|
+
get
|
79
|
+
{
|
80
|
+
if ((_Products == null))
|
81
|
+
{
|
82
|
+
_Products = base.CreateObjectSet<Product>("Products");
|
83
|
+
}
|
84
|
+
return _Products;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
private ObjectSet<Product> _Products;
|
88
|
+
|
89
|
+
/// <summary>
|
90
|
+
/// No Metadata Documentation available.
|
91
|
+
/// </summary>
|
92
|
+
public ObjectSet<Category> Categories
|
93
|
+
{
|
94
|
+
get
|
95
|
+
{
|
96
|
+
if ((_Categories == null))
|
97
|
+
{
|
98
|
+
_Categories = base.CreateObjectSet<Category>("Categories");
|
99
|
+
}
|
100
|
+
return _Categories;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
private ObjectSet<Category> _Categories;
|
104
|
+
|
105
|
+
#endregion
|
106
|
+
#region AddTo Methods
|
107
|
+
|
108
|
+
/// <summary>
|
109
|
+
/// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead.
|
110
|
+
/// </summary>
|
111
|
+
public void AddToProducts(Product product)
|
112
|
+
{
|
113
|
+
base.AddObject("Products", product);
|
114
|
+
}
|
115
|
+
|
116
|
+
/// <summary>
|
117
|
+
/// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead.
|
118
|
+
/// </summary>
|
119
|
+
public void AddToCategories(Category category)
|
120
|
+
{
|
121
|
+
base.AddObject("Categories", category);
|
122
|
+
}
|
123
|
+
|
124
|
+
#endregion
|
125
|
+
}
|
126
|
+
|
127
|
+
|
128
|
+
#endregion
|
129
|
+
|
130
|
+
#region Entities
|
131
|
+
|
132
|
+
/// <summary>
|
133
|
+
/// No Metadata Documentation available.
|
134
|
+
/// </summary>
|
135
|
+
[EdmEntityTypeAttribute(NamespaceName="Model", Name="Category")]
|
136
|
+
[Serializable()]
|
137
|
+
[DataContractAttribute(IsReference=true)]
|
138
|
+
public partial class Category : EntityObject
|
139
|
+
{
|
140
|
+
#region Factory Method
|
141
|
+
|
142
|
+
/// <summary>
|
143
|
+
/// Create a new Category object.
|
144
|
+
/// </summary>
|
145
|
+
/// <param name="id">Initial value of the Id property.</param>
|
146
|
+
/// <param name="name">Initial value of the Name property.</param>
|
147
|
+
public static Category CreateCategory(global::System.Int32 id, global::System.String name)
|
148
|
+
{
|
149
|
+
Category category = new Category();
|
150
|
+
category.Id = id;
|
151
|
+
category.Name = name;
|
152
|
+
return category;
|
153
|
+
}
|
154
|
+
|
155
|
+
#endregion
|
156
|
+
#region Primitive Properties
|
157
|
+
|
158
|
+
/// <summary>
|
159
|
+
/// No Metadata Documentation available.
|
160
|
+
/// </summary>
|
161
|
+
[EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
|
162
|
+
[DataMemberAttribute()]
|
163
|
+
public global::System.Int32 Id
|
164
|
+
{
|
165
|
+
get
|
166
|
+
{
|
167
|
+
return _Id;
|
168
|
+
}
|
169
|
+
set
|
170
|
+
{
|
171
|
+
if (_Id != value)
|
172
|
+
{
|
173
|
+
OnIdChanging(value);
|
174
|
+
ReportPropertyChanging("Id");
|
175
|
+
_Id = StructuralObject.SetValidValue(value);
|
176
|
+
ReportPropertyChanged("Id");
|
177
|
+
OnIdChanged();
|
178
|
+
}
|
179
|
+
}
|
180
|
+
}
|
181
|
+
private global::System.Int32 _Id;
|
182
|
+
partial void OnIdChanging(global::System.Int32 value);
|
183
|
+
partial void OnIdChanged();
|
184
|
+
|
185
|
+
/// <summary>
|
186
|
+
/// No Metadata Documentation available.
|
187
|
+
/// </summary>
|
188
|
+
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
|
189
|
+
[DataMemberAttribute()]
|
190
|
+
public global::System.String Name
|
191
|
+
{
|
192
|
+
get
|
193
|
+
{
|
194
|
+
return _Name;
|
195
|
+
}
|
196
|
+
set
|
197
|
+
{
|
198
|
+
OnNameChanging(value);
|
199
|
+
ReportPropertyChanging("Name");
|
200
|
+
_Name = StructuralObject.SetValidValue(value, false);
|
201
|
+
ReportPropertyChanged("Name");
|
202
|
+
OnNameChanged();
|
203
|
+
}
|
204
|
+
}
|
205
|
+
private global::System.String _Name;
|
206
|
+
partial void OnNameChanging(global::System.String value);
|
207
|
+
partial void OnNameChanged();
|
208
|
+
|
209
|
+
#endregion
|
210
|
+
|
211
|
+
#region Navigation Properties
|
212
|
+
|
213
|
+
/// <summary>
|
214
|
+
/// No Metadata Documentation available.
|
215
|
+
/// </summary>
|
216
|
+
[XmlIgnoreAttribute()]
|
217
|
+
[SoapIgnoreAttribute()]
|
218
|
+
[DataMemberAttribute()]
|
219
|
+
[EdmRelationshipNavigationPropertyAttribute("Model", "CategoryProduct", "Product")]
|
220
|
+
public EntityCollection<Product> Products
|
221
|
+
{
|
222
|
+
get
|
223
|
+
{
|
224
|
+
return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Product>("Model.CategoryProduct", "Product");
|
225
|
+
}
|
226
|
+
set
|
227
|
+
{
|
228
|
+
if ((value != null))
|
229
|
+
{
|
230
|
+
((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Product>("Model.CategoryProduct", "Product", value);
|
231
|
+
}
|
232
|
+
}
|
233
|
+
}
|
234
|
+
|
235
|
+
#endregion
|
236
|
+
}
|
237
|
+
|
238
|
+
/// <summary>
|
239
|
+
/// No Metadata Documentation available.
|
240
|
+
/// </summary>
|
241
|
+
[EdmEntityTypeAttribute(NamespaceName="Model", Name="Product")]
|
242
|
+
[Serializable()]
|
243
|
+
[DataContractAttribute(IsReference=true)]
|
244
|
+
public partial class Product : EntityObject
|
245
|
+
{
|
246
|
+
#region Factory Method
|
247
|
+
|
248
|
+
/// <summary>
|
249
|
+
/// Create a new Product object.
|
250
|
+
/// </summary>
|
251
|
+
/// <param name="id">Initial value of the Id property.</param>
|
252
|
+
/// <param name="name">Initial value of the Name property.</param>
|
253
|
+
/// <param name="description">Initial value of the Description property.</param>
|
254
|
+
/// <param name="price">Initial value of the Price property.</param>
|
255
|
+
public static Product CreateProduct(global::System.Int32 id, global::System.String name, global::System.String description, global::System.Decimal price)
|
256
|
+
{
|
257
|
+
Product product = new Product();
|
258
|
+
product.Id = id;
|
259
|
+
product.Name = name;
|
260
|
+
product.Description = description;
|
261
|
+
product.Price = price;
|
262
|
+
return product;
|
263
|
+
}
|
264
|
+
|
265
|
+
#endregion
|
266
|
+
#region Primitive Properties
|
267
|
+
|
268
|
+
/// <summary>
|
269
|
+
/// No Metadata Documentation available.
|
270
|
+
/// </summary>
|
271
|
+
[EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
|
272
|
+
[DataMemberAttribute()]
|
273
|
+
public global::System.Int32 Id
|
274
|
+
{
|
275
|
+
get
|
276
|
+
{
|
277
|
+
return _Id;
|
278
|
+
}
|
279
|
+
set
|
280
|
+
{
|
281
|
+
if (_Id != value)
|
282
|
+
{
|
283
|
+
OnIdChanging(value);
|
284
|
+
ReportPropertyChanging("Id");
|
285
|
+
_Id = StructuralObject.SetValidValue(value);
|
286
|
+
ReportPropertyChanged("Id");
|
287
|
+
OnIdChanged();
|
288
|
+
}
|
289
|
+
}
|
290
|
+
}
|
291
|
+
private global::System.Int32 _Id;
|
292
|
+
partial void OnIdChanging(global::System.Int32 value);
|
293
|
+
partial void OnIdChanged();
|
294
|
+
|
295
|
+
/// <summary>
|
296
|
+
/// No Metadata Documentation available.
|
297
|
+
/// </summary>
|
298
|
+
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
|
299
|
+
[DataMemberAttribute()]
|
300
|
+
public global::System.String Name
|
301
|
+
{
|
302
|
+
get
|
303
|
+
{
|
304
|
+
return _Name;
|
305
|
+
}
|
306
|
+
set
|
307
|
+
{
|
308
|
+
OnNameChanging(value);
|
309
|
+
ReportPropertyChanging("Name");
|
310
|
+
_Name = StructuralObject.SetValidValue(value, false);
|
311
|
+
ReportPropertyChanged("Name");
|
312
|
+
OnNameChanged();
|
313
|
+
}
|
314
|
+
}
|
315
|
+
private global::System.String _Name;
|
316
|
+
partial void OnNameChanging(global::System.String value);
|
317
|
+
partial void OnNameChanged();
|
318
|
+
|
319
|
+
/// <summary>
|
320
|
+
/// No Metadata Documentation available.
|
321
|
+
/// </summary>
|
322
|
+
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
|
323
|
+
[DataMemberAttribute()]
|
324
|
+
public global::System.String Description
|
325
|
+
{
|
326
|
+
get
|
327
|
+
{
|
328
|
+
return _Description;
|
329
|
+
}
|
330
|
+
set
|
331
|
+
{
|
332
|
+
OnDescriptionChanging(value);
|
333
|
+
ReportPropertyChanging("Description");
|
334
|
+
_Description = StructuralObject.SetValidValue(value, false);
|
335
|
+
ReportPropertyChanged("Description");
|
336
|
+
OnDescriptionChanged();
|
337
|
+
}
|
338
|
+
}
|
339
|
+
private global::System.String _Description;
|
340
|
+
partial void OnDescriptionChanging(global::System.String value);
|
341
|
+
partial void OnDescriptionChanged();
|
342
|
+
|
343
|
+
/// <summary>
|
344
|
+
/// No Metadata Documentation available.
|
345
|
+
/// </summary>
|
346
|
+
[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
|
347
|
+
[DataMemberAttribute()]
|
348
|
+
public global::System.Decimal Price
|
349
|
+
{
|
350
|
+
get
|
351
|
+
{
|
352
|
+
return _Price;
|
353
|
+
}
|
354
|
+
set
|
355
|
+
{
|
356
|
+
OnPriceChanging(value);
|
357
|
+
ReportPropertyChanging("Price");
|
358
|
+
_Price = StructuralObject.SetValidValue(value);
|
359
|
+
ReportPropertyChanged("Price");
|
360
|
+
OnPriceChanged();
|
361
|
+
}
|
362
|
+
}
|
363
|
+
private global::System.Decimal _Price;
|
364
|
+
partial void OnPriceChanging(global::System.Decimal value);
|
365
|
+
partial void OnPriceChanged();
|
366
|
+
|
367
|
+
#endregion
|
368
|
+
|
369
|
+
#region Navigation Properties
|
370
|
+
|
371
|
+
/// <summary>
|
372
|
+
/// No Metadata Documentation available.
|
373
|
+
/// </summary>
|
374
|
+
[XmlIgnoreAttribute()]
|
375
|
+
[SoapIgnoreAttribute()]
|
376
|
+
[DataMemberAttribute()]
|
377
|
+
[EdmRelationshipNavigationPropertyAttribute("Model", "CategoryProduct", "Category")]
|
378
|
+
public Category Category
|
379
|
+
{
|
380
|
+
get
|
381
|
+
{
|
382
|
+
return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Category>("Model.CategoryProduct", "Category").Value;
|
383
|
+
}
|
384
|
+
set
|
385
|
+
{
|
386
|
+
((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Category>("Model.CategoryProduct", "Category").Value = value;
|
387
|
+
}
|
388
|
+
}
|
389
|
+
/// <summary>
|
390
|
+
/// No Metadata Documentation available.
|
391
|
+
/// </summary>
|
392
|
+
[BrowsableAttribute(false)]
|
393
|
+
[DataMemberAttribute()]
|
394
|
+
public EntityReference<Category> CategoryReference
|
395
|
+
{
|
396
|
+
get
|
397
|
+
{
|
398
|
+
return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Category>("Model.CategoryProduct", "Category");
|
399
|
+
}
|
400
|
+
set
|
401
|
+
{
|
402
|
+
if ((value != null))
|
403
|
+
{
|
404
|
+
((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Category>("Model.CategoryProduct", "Category", value);
|
405
|
+
}
|
406
|
+
}
|
407
|
+
}
|
408
|
+
|
409
|
+
#endregion
|
410
|
+
}
|
411
|
+
|
412
|
+
#endregion
|
413
|
+
|
414
|
+
}
|
@@ -0,0 +1,140 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
|
3
|
+
<!-- EF Runtime content -->
|
4
|
+
<edmx:Runtime>
|
5
|
+
<!-- SSDL content -->
|
6
|
+
<edmx:StorageModels>
|
7
|
+
<Schema Namespace="Model.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2008" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
|
8
|
+
<EntityContainer Name="ModelStoreContainer">
|
9
|
+
<EntitySet Name="Categories" EntityType="Model.Store.Categories" store:Type="Tables" Schema="dbo" />
|
10
|
+
<EntitySet Name="Products" EntityType="Model.Store.Products" store:Type="Tables" Schema="dbo" />
|
11
|
+
<AssociationSet Name="FK_CategoryProduct" Association="Model.Store.FK_CategoryProduct">
|
12
|
+
<End Role="Categories" EntitySet="Categories" />
|
13
|
+
<End Role="Products" EntitySet="Products" />
|
14
|
+
</AssociationSet>
|
15
|
+
</EntityContainer>
|
16
|
+
<EntityType Name="Categories">
|
17
|
+
<Key>
|
18
|
+
<PropertyRef Name="Id" />
|
19
|
+
</Key>
|
20
|
+
<Property Name="Id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
|
21
|
+
<Property Name="Name" Type="nvarchar(max)" Nullable="false" />
|
22
|
+
</EntityType>
|
23
|
+
<EntityType Name="Products">
|
24
|
+
<Key>
|
25
|
+
<PropertyRef Name="Id" />
|
26
|
+
</Key>
|
27
|
+
<Property Name="Id" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
|
28
|
+
<Property Name="Name" Type="nvarchar(max)" Nullable="false" />
|
29
|
+
<Property Name="Description" Type="nvarchar(max)" Nullable="false" />
|
30
|
+
<Property Name="Price" Type="money" Nullable="false" />
|
31
|
+
<Property Name="Category_Id" Type="int" Nullable="false" />
|
32
|
+
</EntityType>
|
33
|
+
<Association Name="FK_CategoryProduct">
|
34
|
+
<End Role="Categories" Type="Model.Store.Categories" Multiplicity="1" />
|
35
|
+
<End Role="Products" Type="Model.Store.Products" Multiplicity="*" />
|
36
|
+
<ReferentialConstraint>
|
37
|
+
<Principal Role="Categories">
|
38
|
+
<PropertyRef Name="Id" />
|
39
|
+
</Principal>
|
40
|
+
<Dependent Role="Products">
|
41
|
+
<PropertyRef Name="Category_Id" />
|
42
|
+
</Dependent>
|
43
|
+
</ReferentialConstraint>
|
44
|
+
</Association>
|
45
|
+
</Schema></edmx:StorageModels>
|
46
|
+
<!-- CSDL content -->
|
47
|
+
<edmx:ConceptualModels>
|
48
|
+
<Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" xmlns:cg="http://schemas.microsoft.com/ado/2006/04/codegeneration" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" Namespace="Model" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
|
49
|
+
<EntityContainer Name="ModelContainer" annotation:LazyLoadingEnabled="true">
|
50
|
+
<EntitySet Name="Products" EntityType="Model.Product" />
|
51
|
+
<EntitySet Name="Categories" EntityType="Model.Category" />
|
52
|
+
<AssociationSet Name="CategoryProduct" Association="Model.CategoryProduct">
|
53
|
+
<End Role="Category" EntitySet="Categories" />
|
54
|
+
<End Role="Product" EntitySet="Products" />
|
55
|
+
</AssociationSet>
|
56
|
+
</EntityContainer>
|
57
|
+
<EntityType Name="Product">
|
58
|
+
<Key>
|
59
|
+
<PropertyRef Name="Id" />
|
60
|
+
</Key>
|
61
|
+
<Property Type="Int32" Name="Id" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
62
|
+
<Property Type="String" Name="Name" Nullable="false" />
|
63
|
+
<Property Type="String" Name="Description" Nullable="false" />
|
64
|
+
<Property Type="Decimal" Name="Price" Nullable="false" />
|
65
|
+
<NavigationProperty Name="Category" Relationship="Model.CategoryProduct" FromRole="Product" ToRole="Category" />
|
66
|
+
</EntityType>
|
67
|
+
<EntityType Name="Category">
|
68
|
+
<Key>
|
69
|
+
<PropertyRef Name="Id" />
|
70
|
+
</Key>
|
71
|
+
<Property Type="Int32" Name="Id" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
72
|
+
<Property Type="String" Name="Name" Nullable="false" />
|
73
|
+
<NavigationProperty Name="Products" Relationship="Model.CategoryProduct" FromRole="Category" ToRole="Product" />
|
74
|
+
</EntityType>
|
75
|
+
<Association Name="CategoryProduct">
|
76
|
+
<End Type="Model.Category" Role="Category" Multiplicity="1" />
|
77
|
+
<End Type="Model.Product" Role="Product" Multiplicity="*" />
|
78
|
+
</Association>
|
79
|
+
</Schema>
|
80
|
+
</edmx:ConceptualModels>
|
81
|
+
<!-- C-S mapping content -->
|
82
|
+
<edmx:Mappings>
|
83
|
+
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
|
84
|
+
<EntityContainerMapping StorageEntityContainer="ModelStoreContainer" CdmEntityContainer="ModelContainer">
|
85
|
+
<EntitySetMapping Name="Products">
|
86
|
+
<EntityTypeMapping TypeName="IsTypeOf(Model.Product)">
|
87
|
+
<MappingFragment StoreEntitySet="Products">
|
88
|
+
<ScalarProperty Name="Id" ColumnName="Id" />
|
89
|
+
<ScalarProperty Name="Name" ColumnName="Name" />
|
90
|
+
<ScalarProperty Name="Description" ColumnName="Description" />
|
91
|
+
<ScalarProperty Name="Price" ColumnName="Price" />
|
92
|
+
</MappingFragment>
|
93
|
+
</EntityTypeMapping>
|
94
|
+
</EntitySetMapping>
|
95
|
+
<EntitySetMapping Name="Categories">
|
96
|
+
<EntityTypeMapping TypeName="IsTypeOf(Model.Category)">
|
97
|
+
<MappingFragment StoreEntitySet="Categories">
|
98
|
+
<ScalarProperty Name="Id" ColumnName="Id" />
|
99
|
+
<ScalarProperty Name="Name" ColumnName="Name" />
|
100
|
+
</MappingFragment>
|
101
|
+
</EntityTypeMapping>
|
102
|
+
</EntitySetMapping>
|
103
|
+
<AssociationSetMapping Name="CategoryProduct" TypeName="Model.CategoryProduct" StoreEntitySet="Products">
|
104
|
+
<EndProperty Name="Category">
|
105
|
+
<ScalarProperty Name="Id" ColumnName="Category_Id" />
|
106
|
+
</EndProperty>
|
107
|
+
<EndProperty Name="Product">
|
108
|
+
<ScalarProperty Name="Id" ColumnName="Id" />
|
109
|
+
</EndProperty>
|
110
|
+
</AssociationSetMapping>
|
111
|
+
</EntityContainerMapping>
|
112
|
+
</Mapping></edmx:Mappings>
|
113
|
+
</edmx:Runtime>
|
114
|
+
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
|
115
|
+
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
|
116
|
+
<edmx:Connection>
|
117
|
+
<DesignerInfoPropertySet>
|
118
|
+
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
|
119
|
+
</DesignerInfoPropertySet>
|
120
|
+
</edmx:Connection>
|
121
|
+
<edmx:Options>
|
122
|
+
<DesignerInfoPropertySet>
|
123
|
+
<DesignerProperty Name="ValidateOnBuild" Value="true" />
|
124
|
+
<DesignerProperty Name="EnablePluralization" Value="True" />
|
125
|
+
<DesignerProperty Name="IncludeForeignKeysInModel" Value="True" />
|
126
|
+
</DesignerInfoPropertySet>
|
127
|
+
</edmx:Options>
|
128
|
+
<!-- Diagram content (shape and connector positions) -->
|
129
|
+
<edmx:Diagrams>
|
130
|
+
<Diagram Name="Model" >
|
131
|
+
<EntityTypeShape EntityType="Model.Product" Width="1.5" PointX="8" PointY="1.75" Height="1.787985026041667" />
|
132
|
+
<EntityTypeShape EntityType="Model.Category" Width="1.5" PointX="5.25" PointY="1.875" Height="1.59568359375" />
|
133
|
+
<AssociationConnector Association="Model.CategoryProduct">
|
134
|
+
<ConnectorPoint PointX="6.75" PointY="2.672841796875" />
|
135
|
+
<ConnectorPoint PointX="8" PointY="2.672841796875" />
|
136
|
+
</AssociationConnector>
|
137
|
+
</Diagram>
|
138
|
+
</edmx:Diagrams>
|
139
|
+
</edmx:Designer>
|
140
|
+
</edmx:Edmx>
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
<%@ ServiceHost Language="C#" Factory="System.Data.Services.DataServiceHostFactory" Service="Entities" %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!--
|
3
|
+
For more information on how to configure your ASP.NET application, please visit
|
4
|
+
http://go.microsoft.com/fwlink/?LinkId=169433
|
5
|
+
-->
|
6
|
+
<configuration>
|
7
|
+
<system.web>
|
8
|
+
<compilation debug="false" targetFramework="4.0">
|
9
|
+
<assemblies>
|
10
|
+
<add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
|
11
|
+
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
12
|
+
<add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
13
|
+
<add assembly="System.Data.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
14
|
+
<add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
15
|
+
</assemblies>
|
16
|
+
<buildProviders>
|
17
|
+
<add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" />
|
18
|
+
</buildProviders>
|
19
|
+
</compilation>
|
20
|
+
</system.web>
|
21
|
+
<connectionStrings>
|
22
|
+
<add name="ModelContainer" connectionString="metadata=res://*/App_Code.Model.csdl|res://*/App_Code.Model.ssdl|res://*/App_Code.Model.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\TestDB.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
|
23
|
+
</connectionStrings>
|
24
|
+
<system.serviceModel>
|
25
|
+
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
|
26
|
+
</system.serviceModel>
|
27
|
+
</configuration>
|
data/test/blueprints.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Sham.define do
|
2
|
+
category_name { |i| "Category #{i}" }
|
3
|
+
product_name { |i| "Widget #{i}" }
|
4
|
+
price { ['5.00', '10.00', '20.00', '15.00' , '25.00', '7.50'].rand }
|
5
|
+
end
|
6
|
+
|
7
|
+
Product.blueprint do
|
8
|
+
Name { Sham.product_name }
|
9
|
+
Description "Test Widget"
|
10
|
+
Price { Sham.price }
|
11
|
+
Category { Category.make }
|
12
|
+
end
|
13
|
+
|
14
|
+
Category.blueprint do
|
15
|
+
Name { Sham.category_name }
|
16
|
+
end
|