diff --git a/.gitignore b/.gitignore index 1f8820222..c65343b50 100644 --- a/.gitignore +++ b/.gitignore @@ -143,4 +143,5 @@ UpgradeLog*.XML /Snek2015AngularWebApiSample/WebClient/scripts *.backup -nupkg \ No newline at end of file +nupkg +.fake \ No newline at end of file diff --git a/ODataFaq/ODataFaq.DataModel/App.config b/ODataFaq/ODataFaq.DataModel/App.config deleted file mode 100644 index 7e1d79cab..000000000 --- a/ODataFaq/ODataFaq.DataModel/App.config +++ /dev/null @@ -1,17 +0,0 @@ - - - - -
- - - - - - - - - - - - \ No newline at end of file diff --git a/ODataFaq/ODataFaq.DataModel/DataModel.cs b/ODataFaq/ODataFaq.DataModel/DataModel.cs deleted file mode 100644 index c158b81be..000000000 --- a/ODataFaq/ODataFaq.DataModel/DataModel.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections.ObjectModel; -using System.ComponentModel.DataAnnotations; - -namespace ODataFaq.DataModel -{ - public class Customer - { - public Customer() - { - this.CustomerId = Guid.NewGuid(); - this.Orders = new OrderCollection(); - } - - [Key] - public Guid CustomerId { get; set; } - - [MaxLength(200)] - [Required(AllowEmptyStrings = false)] - public string CompanyName { get; set; } - - [MaxLength(2)] - [Required(AllowEmptyStrings = false)] - public string CountryIsoCode { get; set; } - - public OrderCollection Orders { get; private set; } - } - - public class Product - { - public Product() - { - this.ProductId = Guid.NewGuid(); - this.OrderDetails = new OrderDetailCollection(); - } - - [Key] - public Guid ProductId { get; set; } - - [MaxLength(200)] - [Required(AllowEmptyStrings = false)] - public string Description { get; set; } - - [MaxLength(10)] - [Required(AllowEmptyStrings = false)] - public string CategoryCode { get; set; } - - [Required] - public bool IsAvailable { get; set; } - - [Required] - public decimal PricePerUom { get; set; } - - public OrderDetailCollection OrderDetails { get; set; } - } - - public class OrderHeader - { - public OrderHeader() - { - this.OrderId = Guid.NewGuid(); - } - - [Key] - public Guid OrderId { get; set; } - - [Required] - public Customer Customer { get; set; } - - [Required] - public DateTimeOffset OrderDate { get; set; } - - public OrderDetailCollection OrderDetails { get; set; } - } - - public class OrderCollection : Collection { } - - public class OrderDetail - { - public OrderDetail() - { - this.OrderDetailId = Guid.NewGuid(); - } - - [Key] - public Guid OrderDetailId { get; set; } - - [Required] - public Product Product { get; set; } - - [Required] - public int Amount { get; set; } - - [Required] - public OrderHeader Order { get; set; } - } - - public class OrderDetailCollection : Collection { } -} diff --git a/ODataFaq/ODataFaq.DataModel/DataModelDiagram.cd b/ODataFaq/ODataFaq.DataModel/DataModelDiagram.cd deleted file mode 100644 index 48d089128..000000000 --- a/ODataFaq/ODataFaq.DataModel/DataModelDiagram.cd +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - AAEAQAAAAAAAAAAAAAAAAAAAAAAAABAAAAACAAAAAAA= - DataModel.cs - - - - - - - - - - - - - - - - - - - - - - - - AAECAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAQAAAAA= - DataModel.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - GAEAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAA= - DataModel.cs - - - - - - - - - - - - - - - - - - - - - EAAAAAAAAAAgAAAAABAAAAgAAAAAAAAAABAAAIAAAAA= - DataModel.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AAEAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAQ= - OrderManagementContext.cs - - - - - - - - - - \ No newline at end of file diff --git a/ODataFaq/ODataFaq.DataModel/ODataFaq.DataModel.csproj b/ODataFaq/ODataFaq.DataModel/ODataFaq.DataModel.csproj deleted file mode 100644 index d7a15f643..000000000 --- a/ODataFaq/ODataFaq.DataModel/ODataFaq.DataModel.csproj +++ /dev/null @@ -1,71 +0,0 @@ - - - - - Debug - AnyCPU - {C0B4089A-9F0C-4734-8009-50692285AB38} - Library - Properties - ODataFaq.DataModel - ODataFaq.DataModel - v4.5.2 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll - - - False - ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll - - - - - - - - - - - - - - - - - - - - Designer - - - - - \ No newline at end of file diff --git a/ODataFaq/ODataFaq.DataModel/OrderManagementContext.cs b/ODataFaq/ODataFaq.DataModel/OrderManagementContext.cs deleted file mode 100644 index 4f40a7c4b..000000000 --- a/ODataFaq/ODataFaq.DataModel/OrderManagementContext.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Data.Entity; -using System.Threading.Tasks; - -namespace ODataFaq.DataModel -{ - public class OrderManagementContext : DbContext - { - public OrderManagementContext() - : base(@"Server=(localdb)\v11.0;Database=ODataFaq;Integrated Security=true") - { - } - - public DbSet Customers { get; set; } - - public DbSet Products { get; set; } - - public DbSet Orders { get; set; } - - public DbSet OrderDetails { get; set; } - - public async Task ClearAndFillWithDemoData() - { - await this.OrderDetails.ForEachAsync(od => this.OrderDetails.Remove(od)); - await this.Orders.ForEachAsync(o => this.Orders.Remove(o)); - await this.Customers.ForEachAsync(c => this.Customers.Remove(c)); - await this.Products.ForEachAsync(p => this.Products.Remove(p)); - - var demoCustomers = new[] { - new Customer() { CompanyName = "Corina Air Conditioning", CountryIsoCode = "AT" }, - new Customer() { CompanyName = "Fernando Engineering", CountryIsoCode = "AT" }, - new Customer() { CompanyName = "Murakami Plumbing", CountryIsoCode = "CH" }, - new Customer() { CompanyName = "Naval Metal Construction", CountryIsoCode = "DE" } - }; - this.Customers.AddRange(demoCustomers); - - var demoProducts = new[] { - new Product() { Description = "Mountain Bike", IsAvailable = true, CategoryCode = "BIKE", PricePerUom = 2500 }, - new Product() { Description = "Road Bike", IsAvailable = true, CategoryCode = "BIKE", PricePerUom = 2000 }, - new Product() { Description = "Skate Board", IsAvailable = true, CategoryCode = "BOARD", PricePerUom = 100 }, - new Product() { Description = "Long Board", IsAvailable = true, CategoryCode = "BOARD", PricePerUom = 250 }, - new Product() { Description = "Scooter", IsAvailable = false, CategoryCode = "OTHERS", PricePerUom = 150 } - }; - this.Products.AddRange(demoProducts); - - var rand = new Random(); - for (var i = 0; i < 100; i++) - { - var order = new OrderHeader() - { - OrderDate = new DateTimeOffset(new DateTime(2014, rand.Next(1, 12), rand.Next(1, 28))), - Customer = demoCustomers[rand.Next(demoCustomers.Length - 1)] - }; - this.Orders.Add(order); - - for (var j = 0; j < 3; j++) - { - this.OrderDetails.Add(new OrderDetail() - { - Order = order, - Product = demoProducts[rand.Next(demoProducts.Length - 1)], - Amount = rand.Next(1, 5) - }); - } - } - - await this.SaveChangesAsync(); - } - } -} diff --git a/ODataFaq/ODataFaq.DataModel/Properties/AssemblyInfo.cs b/ODataFaq/ODataFaq.DataModel/Properties/AssemblyInfo.cs deleted file mode 100644 index 10a8a65aa..000000000 --- a/ODataFaq/ODataFaq.DataModel/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ODataFaq.DataModel")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ODataFaq.DataModel")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("f5297d63-3de1-475a-9bf4-d1b59cc39e83")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ODataFaq/ODataFaq.DataModel/packages.config b/ODataFaq/ODataFaq.DataModel/packages.config deleted file mode 100644 index 440917307..000000000 --- a/ODataFaq/ODataFaq.DataModel/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/ODataFaq/ODataFaq.DataService/ODataFaq.DataService.csproj b/ODataFaq/ODataFaq.DataService/ODataFaq.DataService.csproj deleted file mode 100644 index 2e6a4e2f4..000000000 --- a/ODataFaq/ODataFaq.DataService/ODataFaq.DataService.csproj +++ /dev/null @@ -1,154 +0,0 @@ - - - - - Debug - AnyCPU - - - 2.0 - {A4A92809-3FC6-40F7-AC4C-3E6ED27E0B09} - {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - ODataFaq.DataService - ODataFaq.DataService - v4.5.2 - true - - - - - - - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\ - TRACE - prompt - 4 - - - - False - ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll - - - False - ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll - - - - False - ..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll - - - False - ..\packages\Microsoft.Data.OData.5.6.4\lib\net40\Microsoft.Data.OData.dll - - - False - ..\packages\Microsoft.Data.Services.5.6.4\lib\net40\Microsoft.Data.Services.dll - - - False - ..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll - - - ..\packages\Microsoft.OData.EntityFrameworkProvider.1.0.0-beta2\lib\net40\Microsoft.OData.EntityFrameworkProvider.dll - - - - - - False - ..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll - - - - - - - - - - - - - - - - - - - Designer - - - Web.config - - - Web.config - - - - - - Designer - - - - - ODataFaqService.svc - - - - - - {c0b4089a-9f0c-4734-8009-50692285ab38} - ODataFaq.DataModel - - - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - - - - - True - True - 11449 - / - http://localhost:11449/ - False - False - - - False - - - - - - \ No newline at end of file diff --git a/ODataFaq/ODataFaq.DataService/ODataFaqService.svc b/ODataFaq/ODataFaq.DataService/ODataFaqService.svc deleted file mode 100644 index 61579d5e2..000000000 --- a/ODataFaq/ODataFaq.DataService/ODataFaqService.svc +++ /dev/null @@ -1,4 +0,0 @@ - - -<%@ ServiceHost Language="C#" Factory="System.ServiceModel.Activation.WebServiceHostFactory, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Service="ODataFaq.DataService.ODataFaqService" %> - diff --git a/ODataFaq/ODataFaq.DataService/ODataFaqService.svc.cs b/ODataFaq/ODataFaq.DataService/ODataFaqService.svc.cs deleted file mode 100644 index 90058550d..000000000 --- a/ODataFaq/ODataFaq.DataService/ODataFaqService.svc.cs +++ /dev/null @@ -1,17 +0,0 @@ -using ODataFaq.DataModel; -using System.Data.Services; -using System.Data.Services.Common; -using System.Data.Services.Providers; - -namespace ODataFaq.DataService -{ - public class ODataFaqService : EntityFrameworkDataService - { - public static void InitializeService(DataServiceConfiguration config) - { - config.SetEntitySetAccessRule("*", EntitySetRights.AllRead); - config.SetEntitySetAccessRule("Customers", EntitySetRights.AllRead | EntitySetRights.WriteAppend); - config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3; - } - } -} diff --git a/ODataFaq/ODataFaq.DataService/Properties/AssemblyInfo.cs b/ODataFaq/ODataFaq.DataService/Properties/AssemblyInfo.cs deleted file mode 100644 index 5683f21b8..000000000 --- a/ODataFaq/ODataFaq.DataService/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ODataFaq.DataService")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ODataFaq.DataService")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("460c3ab2-7d06-4364-9bcb-6dcad19fd13e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ODataFaq/ODataFaq.DataService/Web.Debug.config b/ODataFaq/ODataFaq.DataService/Web.Debug.config deleted file mode 100644 index 2e302f9f9..000000000 --- a/ODataFaq/ODataFaq.DataService/Web.Debug.config +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/ODataFaq/ODataFaq.DataService/Web.Release.config b/ODataFaq/ODataFaq.DataService/Web.Release.config deleted file mode 100644 index c35844462..000000000 --- a/ODataFaq/ODataFaq.DataService/Web.Release.config +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/ODataFaq/ODataFaq.DataService/Web.config b/ODataFaq/ODataFaq.DataService/Web.config deleted file mode 100644 index 2323c7cf7..000000000 --- a/ODataFaq/ODataFaq.DataService/Web.config +++ /dev/null @@ -1,57 +0,0 @@ - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ODataFaq/ODataFaq.DataService/packages.config b/ODataFaq/ODataFaq.DataService/packages.config deleted file mode 100644 index 856b6acc7..000000000 --- a/ODataFaq/ODataFaq.DataService/packages.config +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/ODataFaq/ODataFaq.DemoDataGenerator/App.config b/ODataFaq/ODataFaq.DemoDataGenerator/App.config deleted file mode 100644 index 9d942d716..000000000 --- a/ODataFaq/ODataFaq.DemoDataGenerator/App.config +++ /dev/null @@ -1,20 +0,0 @@ - - - - -
- - - - - - - - - - - - - - - diff --git a/ODataFaq/ODataFaq.DemoDataGenerator/ODataFaq.DemoDataGenerator.csproj b/ODataFaq/ODataFaq.DemoDataGenerator/ODataFaq.DemoDataGenerator.csproj deleted file mode 100644 index 90e3c002f..000000000 --- a/ODataFaq/ODataFaq.DemoDataGenerator/ODataFaq.DemoDataGenerator.csproj +++ /dev/null @@ -1,76 +0,0 @@ - - - - - Debug - AnyCPU - {2BD3F850-B8FB-4853-B24B-F1A0EBBCEF60} - Exe - Properties - ODataFaq.DemoDataGenerator - ODataFaq.DemoDataGenerator - v4.5.2 - 512 - true - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll - - - False - ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll - - - - - - - - - - - - - - - - - - - - - {c0b4089a-9f0c-4734-8009-50692285ab38} - ODataFaq.DataModel - - - - - \ No newline at end of file diff --git a/ODataFaq/ODataFaq.DemoDataGenerator/Program.cs b/ODataFaq/ODataFaq.DemoDataGenerator/Program.cs deleted file mode 100644 index 823ba170d..000000000 --- a/ODataFaq/ODataFaq.DemoDataGenerator/Program.cs +++ /dev/null @@ -1,23 +0,0 @@ -using ODataFaq.DataModel; -using System; - -namespace ODataFaq.DemoDataGenerator -{ - class Program - { - static void Main(string[] args) - { - Console.WriteLine("Press any key to continue with clearing the database 'ODataFaq' on (localdb)\\v11.0 and filling it with demo data ..."); - Console.ReadKey(); - - Console.WriteLine("Please be patient, generating data ..."); - using (var omc = new OrderManagementContext()) - { - omc.ClearAndFillWithDemoData().Wait(); - } - - Console.WriteLine("Done. Press any key to quit ..."); - Console.ReadKey(); - } - } -} diff --git a/ODataFaq/ODataFaq.DemoDataGenerator/Properties/AssemblyInfo.cs b/ODataFaq/ODataFaq.DemoDataGenerator/Properties/AssemblyInfo.cs deleted file mode 100644 index ce3ada625..000000000 --- a/ODataFaq/ODataFaq.DemoDataGenerator/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ODataFaq.DemoDataGenerator")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ODataFaq.DemoDataGenerator")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("2620220f-0c18-4c73-bcb9-71b5be84c504")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ODataFaq/ODataFaq.DemoDataGenerator/packages.config b/ODataFaq/ODataFaq.DemoDataGenerator/packages.config deleted file mode 100644 index 440917307..000000000 --- a/ODataFaq/ODataFaq.DemoDataGenerator/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/ODataFaq/ODataFaq.SelfHostService/App.config b/ODataFaq/ODataFaq.SelfHostService/App.config deleted file mode 100644 index f5f88ef48..000000000 --- a/ODataFaq/ODataFaq.SelfHostService/App.config +++ /dev/null @@ -1,72 +0,0 @@ - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ODataFaq/ODataFaq.SelfHostService/CustomerByContryWebApiController.cs b/ODataFaq/ODataFaq.SelfHostService/CustomerByContryWebApiController.cs deleted file mode 100644 index 577d9923e..000000000 --- a/ODataFaq/ODataFaq.SelfHostService/CustomerByContryWebApiController.cs +++ /dev/null @@ -1,21 +0,0 @@ -using ODataFaq.DataModel; -using System.Collections.Generic; -using System.Linq; -using System.Web.Http; - -namespace ODataFaq.SelfHostService -{ - public class CustomerByCountryWebApiController : ApiController - { - [HttpGet] - public IEnumerable Get(string countryIsoCode) - { - using (var context = new OrderManagementContext()) - { - return context.Customers - .Where(c => c.CountryIsoCode == countryIsoCode) - .ToArray(); - } - } - } -} diff --git a/ODataFaq/ODataFaq.SelfHostService/CustomerController.cs b/ODataFaq/ODataFaq.SelfHostService/CustomerController.cs deleted file mode 100644 index c0a974b3d..000000000 --- a/ODataFaq/ODataFaq.SelfHostService/CustomerController.cs +++ /dev/null @@ -1,62 +0,0 @@ -using ODataFaq.DataModel; -using System; -using System.Linq; -using System.Threading.Tasks; -using System.Web.Http; -using System.Web.OData; -using System.Web.OData.Routing; - -namespace ODataFaq.SelfHostService -{ - // [Authorize] - [ODataRoutePrefix("Customer")] - public class CustomerController : ODataController - { - private OrderManagementContext context = new OrderManagementContext(); - - //[EnableQuery] - //public IHttpActionResult Get() - //{ - // if (!string.IsNullOrWhiteSpace(((ClaimsPrincipal)Thread.CurrentPrincipal).Claims.FirstOrDefault(c => c.Type == "IsAdmin").Value)) - // { - // return Ok(context.Customers); - // } - - // return Unauthorized(); - //} - - [EnableQuery] - public IQueryable Get() - { - return context.Customers; - } - - [EnableQuery] - [ODataRoute("Default.OrderedBike")] - [HttpGet] - public IQueryable OrderedBike() - { - return from c in this.context.Customers - where c.Orders.Count(o => o.OrderDetails.Count(od => od.Product.CategoryCode == "BIKE") > 0) > 0 - select c; - } - - [HttpPost] - public async Task Post([FromBody] Customer customer) - { - context.Customers.Add(customer); - await context.SaveChangesAsync(); - return Created(customer); - } - - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - if (disposing) - { - this.context.Dispose(); - GC.SuppressFinalize(this); - } - } - } -} diff --git a/ODataFaq/ODataFaq.SelfHostService/CustomerWebApiController.cs b/ODataFaq/ODataFaq.SelfHostService/CustomerWebApiController.cs deleted file mode 100644 index a0e201f47..000000000 --- a/ODataFaq/ODataFaq.SelfHostService/CustomerWebApiController.cs +++ /dev/null @@ -1,30 +0,0 @@ -using ODataFaq.DataModel; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web.Http; - -namespace ODataFaq.SelfHostService -{ - public class CustomerWebApiController : ApiController - { - [HttpGet] - public IEnumerable Get() - { - using (var context = new OrderManagementContext()) - { - return context.Customers.ToArray(); - } - } - - [HttpGet] - public Customer Get(Guid id) - { - using (var context = new OrderManagementContext()) - { - return context.Customers - .SingleOrDefault(c => c.CustomerId == id); - } - } - } -} diff --git a/ODataFaq/ODataFaq.SelfHostService/ODataFaq.SelfHostService.csproj b/ODataFaq/ODataFaq.SelfHostService/ODataFaq.SelfHostService.csproj deleted file mode 100644 index 89b3d71c6..000000000 --- a/ODataFaq/ODataFaq.SelfHostService/ODataFaq.SelfHostService.csproj +++ /dev/null @@ -1,167 +0,0 @@ - - - - - Debug - AnyCPU - {5A6E26B4-851D-48B8-8898-6AD1B1106B15} - Exe - Properties - ODataFaq.SelfHostService - ODataFaq.SelfHostService - v4.5.2 - 512 - true - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll - - - False - ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll - - - False - ..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll - - - False - ..\packages\Microsoft.Data.OData.5.6.4\lib\net40\Microsoft.Data.OData.dll - - - False - ..\packages\Microsoft.Data.Services.5.6.4\lib\net40\Microsoft.Data.Services.dll - - - False - ..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll - - - False - ..\packages\Microsoft.OData.Core.6.12.0\lib\portable-net40+sl5+wp8+win8+wpa\Microsoft.OData.Core.dll - - - False - ..\packages\Microsoft.OData.Edm.6.12.0\lib\portable-net40+sl5+wp8+win8+wpa\Microsoft.OData.Edm.dll - - - ..\packages\Microsoft.OData.EntityFrameworkProvider.1.0.0-beta2\lib\net40\Microsoft.OData.EntityFrameworkProvider.dll - - - False - ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll - - - False - ..\packages\Microsoft.Owin.Diagnostics.3.0.1\lib\net45\Microsoft.Owin.Diagnostics.dll - - - False - ..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll - - - False - ..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll - - - False - ..\packages\Microsoft.Owin.Security.3.0.1\lib\net45\Microsoft.Owin.Security.dll - - - False - ..\packages\Microsoft.Owin.Security.OAuth.3.0.1\lib\net45\Microsoft.Owin.Security.OAuth.dll - - - False - ..\packages\Microsoft.Spatial.6.12.0\lib\portable-net40+sl5+wp8+win8+wpa\Microsoft.Spatial.dll - - - False - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - - - ..\packages\Owin.1.0\lib\net40\Owin.dll - - - - - - - False - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll - - - False - ..\packages\System.Spatial.5.6.4\lib\net40\System.Spatial.dll - - - - False - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll - - - False - ..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll - - - False - ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll - - - False - ..\packages\Microsoft.AspNet.OData.5.6.0\lib\net45\System.Web.OData.dll - - - - - - - - - - - - - - - - - - - - - {c0b4089a-9f0c-4734-8009-50692285ab38} - ODataFaq.DataModel - - - - - \ No newline at end of file diff --git a/ODataFaq/ODataFaq.SelfHostService/Program.cs b/ODataFaq/ODataFaq.SelfHostService/Program.cs deleted file mode 100644 index 1f8f36f7f..000000000 --- a/ODataFaq/ODataFaq.SelfHostService/Program.cs +++ /dev/null @@ -1,122 +0,0 @@ -using Microsoft.Owin; -using Microsoft.Owin.Hosting; -using Microsoft.Owin.Security.OAuth; -using ODataFaq.DataModel; -using Owin; -using System; -using System.Security.Claims; -using System.Threading.Tasks; -using System.Web.Http; -using System.Web.OData.Builder; -using System.Web.OData.Extensions; - -[assembly: OwinStartup(typeof(ODataFaq.SelfHostService.Startup))] - -namespace ODataFaq.SelfHostService -{ - class Program - { - static void Main(string[] args) - { - using (WebApp.Start("http://localhost:12345")) - { - Console.WriteLine("Listening on port 12345. Press any key to quit."); - Console.ReadLine(); - } - } - } - - public class Startup - { - public void Configuration(IAppBuilder app) - { - // Setup routes - var config = new HttpConfiguration(); - - // Removing XML formatter, we just want to support JSON - config.Formatters.Remove(config.Formatters.XmlFormatter); - SetupWebApiRoutes(config); - SetupOdataRoutes(config); - - // Setup simple OAuth2 server for Resource Owner Password Credentials Grant - SetupOauthServer(app); - - app.UseWebApi(config); - } - - private static void SetupWebApiRoutes(HttpConfiguration config) - { - config.Routes.MapHttpRoute( - name: "Customer", - routeTemplate: "api/Customer/{id}", - defaults: new { controller = "CustomerWebApi", id = RouteParameter.Optional } - ); - config.Routes.MapHttpRoute( - name: "CustomerByCountry", - routeTemplate: "api/CustomerByCountry/{countryIsoCode}", - defaults: new { controller = "CustomerByCountryWebApi" } - ); - } - - private static void SetupOdataRoutes(HttpConfiguration config) - { - var builder = new ODataConventionModelBuilder(); - var customers = builder.EntitySet("Customer"); - customers - .EntityType - .Collection - .Function("OrderedBike") - .ReturnsCollectionFromEntitySet("Customer"); - config.MapODataServiceRoute( - routeName: "odata", - routePrefix: "odata", - model: builder.GetEdmModel()); - } - - private static void SetupOauthServer(IAppBuilder app) - { - // grant_type=password&username=admin&password=admin - app.UseOAuthAuthorizationServer(new OAuthAuthorizationServerOptions - { - AllowInsecureHttp = true, - TokenEndpointPath = new PathString("/token"), - AccessTokenExpireTimeSpan = TimeSpan.FromHours(8), - Provider = new DummyAuthorizationProvider() - }); - app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions()); - } - - private class DummyAuthorizationProvider : OAuthAuthorizationServerProvider - { - public static Task FinishedTask = Task.FromResult(0); - - public override Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context) - { - // No validation code -> all clients are ok - context.Validated(); - return FinishedTask; - } - - public override Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) - { - // If username and password are equal, they are ok - if (context.UserName != context.Password) - { - context.Rejected(); - return FinishedTask; - } - - // Build claims identity - var identity = new ClaimsIdentity("OAuth2"); - identity.AddClaim(new Claim("User", context.UserName)); - if (context.UserName == "admin") - { - identity.AddClaim(new Claim("IsAdmin", "IsAdmin")); - } - - context.Validated(identity); - return FinishedTask; - } - } - } -} diff --git a/ODataFaq/ODataFaq.SelfHostService/Properties/AssemblyInfo.cs b/ODataFaq/ODataFaq.SelfHostService/Properties/AssemblyInfo.cs deleted file mode 100644 index 78d4e1932..000000000 --- a/ODataFaq/ODataFaq.SelfHostService/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ODataFaq.SelfHostService")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ODataFaq.SelfHostService")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c1b981bf-054e-4c36-afb2-2b1a506f887c")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ODataFaq/ODataFaq.SelfHostService/packages.config b/ODataFaq/ODataFaq.SelfHostService/packages.config deleted file mode 100644 index 01b6121d2..000000000 --- a/ODataFaq/ODataFaq.SelfHostService/packages.config +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ODataFaq/ODataFaq.sln b/ODataFaq/ODataFaq.sln deleted file mode 100644 index bdebe3675..000000000 --- a/ODataFaq/ODataFaq.sln +++ /dev/null @@ -1,40 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.30723.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ODataFaq.DataModel", "ODataFaq.DataModel\ODataFaq.DataModel.csproj", "{C0B4089A-9F0C-4734-8009-50692285AB38}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ODataFaq.DemoDataGenerator", "ODataFaq.DemoDataGenerator\ODataFaq.DemoDataGenerator.csproj", "{2BD3F850-B8FB-4853-B24B-F1A0EBBCEF60}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ODataFaq.SelfHostService", "ODataFaq.SelfHostService\ODataFaq.SelfHostService.csproj", "{5A6E26B4-851D-48B8-8898-6AD1B1106B15}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ODataFaq.DataService", "ODataFaq.DataService\ODataFaq.DataService.csproj", "{A4A92809-3FC6-40F7-AC4C-3E6ED27E0B09}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C0B4089A-9F0C-4734-8009-50692285AB38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C0B4089A-9F0C-4734-8009-50692285AB38}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C0B4089A-9F0C-4734-8009-50692285AB38}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C0B4089A-9F0C-4734-8009-50692285AB38}.Release|Any CPU.Build.0 = Release|Any CPU - {2BD3F850-B8FB-4853-B24B-F1A0EBBCEF60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2BD3F850-B8FB-4853-B24B-F1A0EBBCEF60}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2BD3F850-B8FB-4853-B24B-F1A0EBBCEF60}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2BD3F850-B8FB-4853-B24B-F1A0EBBCEF60}.Release|Any CPU.Build.0 = Release|Any CPU - {5A6E26B4-851D-48B8-8898-6AD1B1106B15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5A6E26B4-851D-48B8-8898-6AD1B1106B15}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5A6E26B4-851D-48B8-8898-6AD1B1106B15}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5A6E26B4-851D-48B8-8898-6AD1B1106B15}.Release|Any CPU.Build.0 = Release|Any CPU - {A4A92809-3FC6-40F7-AC4C-3E6ED27E0B09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A4A92809-3FC6-40F7-AC4C-3E6ED27E0B09}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A4A92809-3FC6-40F7-AC4C-3E6ED27E0B09}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A4A92809-3FC6-40F7-AC4C-3E6ED27E0B09}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/ODataFaq/README.md b/ODataFaq/README.md deleted file mode 100644 index d40088748..000000000 --- a/ODataFaq/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# OData FAQ - -**Note that this sample is outdated! A refreshed version using ASP.NET Core can be found in [ODataCoreFaq](../ODataCoreFaq).**