From bc080f6367eebb152f274860c7d5e946a8c76b3d Mon Sep 17 00:00:00 2001 From: USER001 F Date: Mon, 11 Jul 2016 22:55:07 +0900 Subject: [PATCH 01/18] AddSamples --- .gitignore | 4 +- NuGet.config | 10 ++ WebApplication.sln | 57 +++++++---- src/WebApplication.Elm/Elm.cs | 93 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | 19 ++++ .../WebApplication.Elm.xproj | 21 ++++ src/WebApplication.Elm/project.json | 17 ++++ src/WebApplication.ExtensionA/ExtensionA.cs | 88 ++++++++++------- .../Views/ExtensionA/Index.cshtml | 2 + src/WebApplication.ExtensionA/project.json | 2 +- .../Controllers/ExtensionBController.cs | 25 +++-- src/WebApplication.ExtensionB/ExtensionB.cs | 97 ++++++++++++------- .../Models/IItemRepository.cs | 11 +++ src/WebApplication.ExtensionB/Models/Item.cs | 11 +++ .../Models/ItemDbContext.cs | 19 ++++ .../Models/ItemRepository.cs | 21 ++++ .../ExtensionB/Index/IndexViewModelBuilder.cs | 18 ++-- .../ViewModels/Shared/ItemViewModelBuilder.cs | 18 ++-- .../Views/ExtensionB/Index.cshtml | 2 +- src/WebApplication.ExtensionB/project.json | 6 +- src/WebApplication.NLog/NLog.cs | 76 +++++++++++++++ .../Properties/AssemblyInfo.cs | 19 ++++ .../WebApplication.NLog.xproj | 21 ++++ src/WebApplication.NLog/project.json | 24 +++++ .../Properties/AssemblyInfo.cs | 19 ++++ src/WebApplication.Swagger/Swagger.cs | 90 +++++++++++++++++ .../WebApplication.Swagger.xproj | 21 ++++ src/WebApplication.Swagger/project.json | 21 ++++ .../Controllers/ItemsController.cs | 45 +++++++++ .../Models/IItemRepository.cs | 15 +++ src/WebApplication.WebAPI/Models/Item.cs | 11 +++ .../Models/ItemDbContext.cs | 19 ++++ .../Models/ItemRepository.cs | 44 +++++++++ .../Properties/AssemblyInfo.cs | 19 ++++ src/WebApplication.WebAPI/WebAPI.cs | 79 +++++++++++++++ .../WebApplication.WebAPI.xproj | 21 ++++ src/WebApplication.WebAPI/project.json | 16 +++ src/WebApplication/gulpfile.js | 7 +- src/WebApplication/nlog.config | 32 ++++++ src/WebApplication/project.json | 22 +++-- 40 files changed, 1022 insertions(+), 140 deletions(-) create mode 100644 NuGet.config create mode 100644 src/WebApplication.Elm/Elm.cs create mode 100644 src/WebApplication.Elm/Properties/AssemblyInfo.cs create mode 100644 src/WebApplication.Elm/WebApplication.Elm.xproj create mode 100644 src/WebApplication.Elm/project.json create mode 100644 src/WebApplication.ExtensionB/Models/IItemRepository.cs create mode 100644 src/WebApplication.ExtensionB/Models/Item.cs create mode 100644 src/WebApplication.ExtensionB/Models/ItemDbContext.cs create mode 100644 src/WebApplication.ExtensionB/Models/ItemRepository.cs create mode 100644 src/WebApplication.NLog/NLog.cs create mode 100644 src/WebApplication.NLog/Properties/AssemblyInfo.cs create mode 100644 src/WebApplication.NLog/WebApplication.NLog.xproj create mode 100644 src/WebApplication.NLog/project.json create mode 100644 src/WebApplication.Swagger/Properties/AssemblyInfo.cs create mode 100644 src/WebApplication.Swagger/Swagger.cs create mode 100644 src/WebApplication.Swagger/WebApplication.Swagger.xproj create mode 100644 src/WebApplication.Swagger/project.json create mode 100644 src/WebApplication.WebAPI/Controllers/ItemsController.cs create mode 100644 src/WebApplication.WebAPI/Models/IItemRepository.cs create mode 100644 src/WebApplication.WebAPI/Models/Item.cs create mode 100644 src/WebApplication.WebAPI/Models/ItemDbContext.cs create mode 100644 src/WebApplication.WebAPI/Models/ItemRepository.cs create mode 100644 src/WebApplication.WebAPI/Properties/AssemblyInfo.cs create mode 100644 src/WebApplication.WebAPI/WebAPI.cs create mode 100644 src/WebApplication.WebAPI/WebApplication.WebAPI.xproj create mode 100644 src/WebApplication.WebAPI/project.json create mode 100644 src/WebApplication/nlog.config diff --git a/.gitignore b/.gitignore index cbb98db..9aefda2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ bin/ obj/ src/WebApplication/node_modules/ *.xproj.user -*.lock.json \ No newline at end of file +*.lock.json +*.dll +*.log \ No newline at end of file diff --git a/NuGet.config b/NuGet.config new file mode 100644 index 0000000..590be3b --- /dev/null +++ b/NuGet.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/WebApplication.sln b/WebApplication.sln index 7b3ff39..496c336 100644 --- a/WebApplication.sln +++ b/WebApplication.sln @@ -18,13 +18,23 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExtensionA", "ExtensionA", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExtensionB", "ExtensionB", "{4EA56716-702B-485A-A23A-10E110A85D78}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionB.Data.Models", "src\WebApplication.ExtensionB.Data.Models\WebApplication.ExtensionB.Data.Models.xproj", "{6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionB", "src\WebApplication.ExtensionB\WebApplication.ExtensionB.xproj", "{396A8530-C500-469E-9F6F-A2D9C286C47D}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionB.Data.Abstractions", "src\WebApplication.ExtensionB.Data.Abstractions\WebApplication.ExtensionB.Data.Abstractions.xproj", "{922E22BD-10F8-4261-9ACC-9CD10A4C8147}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NLog", "NLog", "{511BD310-4C03-407B-92EA-34110884C547}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.NLog", "src\WebApplication.NLog\WebApplication.NLog.xproj", "{9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Swagger", "Swagger", "{8327C820-20D1-4095-8771-E03613D1969F}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.Swagger", "src\WebApplication.Swagger\WebApplication.Swagger.xproj", "{95E5595E-410B-4A6D-8822-4C07FDC3CF21}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebAPI", "WebAPI", "{FDEA400A-7F71-4A17-8419-030D80F74A3F}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.WebAPI", "src\WebApplication.WebAPI\WebApplication.WebAPI.xproj", "{7DE66111-BBB6-4C93-B864-9E65CAFD505B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Elm", "Elm", "{C49636B1-231E-45A2-8901-10EC68C7CB55}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionB.Data.EntityFramework.Sqlite", "src\WebApplication.ExtensionB.Data.EntityFramework.Sqlite\WebApplication.ExtensionB.Data.EntityFramework.Sqlite.xproj", "{AF7B3C14-BC6E-4964-BD0B-5233428349B6}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.Elm", "src\WebApplication.Elm\WebApplication.Elm.xproj", "{A5C5400D-DD78-4192-B34B-06D81996F0DA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -40,22 +50,26 @@ Global {8D722841-4E2C-4673-A7CC-C2690EFE3915}.Debug|Any CPU.Build.0 = Debug|Any CPU {8D722841-4E2C-4673-A7CC-C2690EFE3915}.Release|Any CPU.ActiveCfg = Release|Any CPU {8D722841-4E2C-4673-A7CC-C2690EFE3915}.Release|Any CPU.Build.0 = Release|Any CPU - {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}.Release|Any CPU.Build.0 = Release|Any CPU {396A8530-C500-469E-9F6F-A2D9C286C47D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {396A8530-C500-469E-9F6F-A2D9C286C47D}.Debug|Any CPU.Build.0 = Debug|Any CPU {396A8530-C500-469E-9F6F-A2D9C286C47D}.Release|Any CPU.ActiveCfg = Release|Any CPU {396A8530-C500-469E-9F6F-A2D9C286C47D}.Release|Any CPU.Build.0 = Release|Any CPU - {922E22BD-10F8-4261-9ACC-9CD10A4C8147}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {922E22BD-10F8-4261-9ACC-9CD10A4C8147}.Debug|Any CPU.Build.0 = Debug|Any CPU - {922E22BD-10F8-4261-9ACC-9CD10A4C8147}.Release|Any CPU.ActiveCfg = Release|Any CPU - {922E22BD-10F8-4261-9ACC-9CD10A4C8147}.Release|Any CPU.Build.0 = Release|Any CPU - {AF7B3C14-BC6E-4964-BD0B-5233428349B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AF7B3C14-BC6E-4964-BD0B-5233428349B6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AF7B3C14-BC6E-4964-BD0B-5233428349B6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AF7B3C14-BC6E-4964-BD0B-5233428349B6}.Release|Any CPU.Build.0 = Release|Any CPU + {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}.Release|Any CPU.Build.0 = Release|Any CPU + {95E5595E-410B-4A6D-8822-4C07FDC3CF21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95E5595E-410B-4A6D-8822-4C07FDC3CF21}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95E5595E-410B-4A6D-8822-4C07FDC3CF21}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95E5595E-410B-4A6D-8822-4C07FDC3CF21}.Release|Any CPU.Build.0 = Release|Any CPU + {7DE66111-BBB6-4C93-B864-9E65CAFD505B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7DE66111-BBB6-4C93-B864-9E65CAFD505B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7DE66111-BBB6-4C93-B864-9E65CAFD505B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7DE66111-BBB6-4C93-B864-9E65CAFD505B}.Release|Any CPU.Build.0 = Release|Any CPU + {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -65,9 +79,14 @@ Global {8D722841-4E2C-4673-A7CC-C2690EFE3915} = {F92B44CF-63EE-4781-8244-48ACC5386A8C} {F92B44CF-63EE-4781-8244-48ACC5386A8C} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} {4EA56716-702B-485A-A23A-10E110A85D78} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} - {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF} = {4EA56716-702B-485A-A23A-10E110A85D78} {396A8530-C500-469E-9F6F-A2D9C286C47D} = {4EA56716-702B-485A-A23A-10E110A85D78} - {922E22BD-10F8-4261-9ACC-9CD10A4C8147} = {4EA56716-702B-485A-A23A-10E110A85D78} - {AF7B3C14-BC6E-4964-BD0B-5233428349B6} = {4EA56716-702B-485A-A23A-10E110A85D78} + {511BD310-4C03-407B-92EA-34110884C547} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9} = {511BD310-4C03-407B-92EA-34110884C547} + {8327C820-20D1-4095-8771-E03613D1969F} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {95E5595E-410B-4A6D-8822-4C07FDC3CF21} = {8327C820-20D1-4095-8771-E03613D1969F} + {FDEA400A-7F71-4A17-8419-030D80F74A3F} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {7DE66111-BBB6-4C93-B864-9E65CAFD505B} = {FDEA400A-7F71-4A17-8419-030D80F74A3F} + {C49636B1-231E-45A2-8901-10EC68C7CB55} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {A5C5400D-DD78-4192-B34B-06D81996F0DA} = {C49636B1-231E-45A2-8901-10EC68C7CB55} EndGlobalSection EndGlobal diff --git a/src/WebApplication.Elm/Elm.cs b/src/WebApplication.Elm/Elm.cs new file mode 100644 index 0000000..6b75fbc --- /dev/null +++ b/src/WebApplication.Elm/Elm.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ExtCore.Infrastructure; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Logging; + +namespace WebApplication.Elm +{ + public class Elm : IExtension + { + private IConfigurationRoot configurationRoot; + + public string Name + { + get + { + return "Extension Elm"; + } + } + + public IDictionary> RouteRegistrarsByPriorities + { + get + { + return null; + } + } + + + public int ConfigureServicesPriorities + { + get + { + return 100; + } + } + public int ConfigurePriorities + { + get + { + return 100; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + public void ConfigureServices(IServiceCollection services) + { + services.AddElm(options => + { + options.Path = new PathString("/Elm"); // defaults to "/Elm" + options.Filter = (name, level) => level >= LogLevel.Information; + }); + } + + public void Configure(IApplicationBuilder app) + { + app.UseElmPage(); // Shows the logs at the specified path + app.UseElmCapture(); // Adds the ElmLoggerProvider + var factory = app.ApplicationServices.GetService(); + var logger = factory.CreateLogger(); + using (logger.BeginScope("startup")) + { + logger.LogWarning("Starting up"); + } + + /*app.Run(async context => + { + await context.Response.WriteAsync("Hello world"); + using (logger.BeginScope("world")) + { + logger.LogInformation("Hello world!"); + logger.LogError("Mort"); + } + // This will not get logged because the filter has been set to LogLevel.Information and above + using (logger.BeginScope("debug")) + { + logger.LogDebug("some debug stuff"); + } + });*/ + logger.LogInformation("This message is not in a scope"); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.Elm/Properties/AssemblyInfo.cs b/src/WebApplication.Elm/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1052743 --- /dev/null +++ b/src/WebApplication.Elm/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +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: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebApplication.Elm")] +[assembly: AssemblyTrademark("")] + +// 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("a5c5400d-dd78-4192-b34b-06d81996f0da")] diff --git a/src/WebApplication.Elm/WebApplication.Elm.xproj b/src/WebApplication.Elm/WebApplication.Elm.xproj new file mode 100644 index 0000000..502d8c1 --- /dev/null +++ b/src/WebApplication.Elm/WebApplication.Elm.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + a5c5400d-dd78-4192-b34b-06d81996f0da + Elm + .\obj + .\bin\ + v4.6.1 + + + + 2.0 + + + diff --git a/src/WebApplication.Elm/project.json b/src/WebApplication.Elm/project.json new file mode 100644 index 0000000..ed3341a --- /dev/null +++ b/src/WebApplication.Elm/project.json @@ -0,0 +1,17 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "NETStandard.Library": "1.6.0", + "ExtCore.Infrastructure": "1.0.0-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.0", + "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", + "Microsoft.AspNetCore.Diagnostics.Elm": "0.1.0" + }, + + "frameworks": { + "netstandard1.6": { + "imports": "dnxcore50" + } + } +} \ No newline at end of file diff --git a/src/WebApplication.ExtensionA/ExtensionA.cs b/src/WebApplication.ExtensionA/ExtensionA.cs index e583ddb..8116d77 100644 --- a/src/WebApplication.ExtensionA/ExtensionA.cs +++ b/src/WebApplication.ExtensionA/ExtensionA.cs @@ -11,47 +11,61 @@ namespace WebApplication.ExtensionA { - public class ExtensionA : IExtension - { - private IConfigurationRoot configurationRoot; - - public string Name + public class ExtensionA : IExtension { - get - { - return "Extension A"; - } - } + private IConfigurationRoot configurationRoot; - public IDictionary> RouteRegistrarsByPriorities - { - get - { - Dictionary> routeRegistrarsByPriorities = new Dictionary>(); - - routeRegistrarsByPriorities.Add( - 1000, - routeBuilder => - { - routeBuilder.MapRoute(name: "Extension A", template: "", defaults: new { controller = "ExtensionA", action = "Index" }); - } - ); - - return routeRegistrarsByPriorities; - } - } + public string Name + { + get + { + return "Extension A"; + } + } - public void SetConfigurationRoot(IConfigurationRoot configurationRoot) - { - this.configurationRoot = configurationRoot; - } + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); - public void ConfigureServices(IServiceCollection services) - { - } + routeRegistrarsByPriorities.Add( + 2500, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension A", template: "", defaults: new { controller = "ExtensionA", action = "Index" }); + } + ); - public void Configure(IApplicationBuilder applicationBuilder) - { + return routeRegistrarsByPriorities; + } + } + + public int ConfigureServicesPriorities + { + get + { + return 1000; + } + } + public int ConfigurePriorities + { + get + { + return 1000; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + public void ConfigureServices(IServiceCollection services) + { + } + + public void Configure(IApplicationBuilder applicationBuilder) + { + } } - } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionA/Views/ExtensionA/Index.cshtml b/src/WebApplication.ExtensionA/Views/ExtensionA/Index.cshtml index 1716286..c6212ae 100644 --- a/src/WebApplication.ExtensionA/Views/ExtensionA/Index.cshtml +++ b/src/WebApplication.ExtensionA/Views/ExtensionA/Index.cshtml @@ -18,6 +18,8 @@
  • @item
  • } +

    Go to Swagger

    Go to Extension B

    +

    Go to Elm

    \ No newline at end of file diff --git a/src/WebApplication.ExtensionA/project.json b/src/WebApplication.ExtensionA/project.json index 1c7c60e..29b1708 100644 --- a/src/WebApplication.ExtensionA/project.json +++ b/src/WebApplication.ExtensionA/project.json @@ -2,7 +2,7 @@ "authors": [ "Dmitry Sikorsky" ], "buildOptions": { "embed": [ "Styles/**", "Views/**" ] }, "dependencies": { - "ExtCore.Infrastructure": "1.0.0-alpha9", + "ExtCore.Infrastructure": "1.0.0-alpha901", "Microsoft.AspNetCore.Mvc": "1.0.0", "NETStandard.Library": "1.6.0" }, diff --git a/src/WebApplication.ExtensionB/Controllers/ExtensionBController.cs b/src/WebApplication.ExtensionB/Controllers/ExtensionBController.cs index 4606037..33e2aca 100644 --- a/src/WebApplication.ExtensionB/Controllers/ExtensionBController.cs +++ b/src/WebApplication.ExtensionB/Controllers/ExtensionBController.cs @@ -1,25 +1,24 @@ // Copyright © 2015 Dmitry Sikorsky. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using ExtCore.Data.Abstractions; using Microsoft.AspNetCore.Mvc; -using WebApplication.ExtensionB.Data.Abstractions; using WebApplication.ExtensionB.ViewModels.ExtenstionB; +using WebApplication.ExtensionB.Models; namespace WebApplication.ExtensionB.Controllers { - public class ExtensionBController : Controller - { - private IStorage storage; - - public ExtensionBController(IStorage storage) + public class ExtensionBController : Controller { - this.storage = storage; - } + private IItemRepository _itemRepository { get; set; } - public ActionResult Index() - { - return this.View(new IndexViewModelBuilder().Build(this.storage.GetRepository().All())); + public ExtensionBController(IItemRepository itemRepository) + { + _itemRepository = itemRepository; + } + + public ActionResult Index() + { + return this.View(new IndexViewModelBuilder().Build(_itemRepository.All())); + } } - } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/ExtensionB.cs b/src/WebApplication.ExtensionB/ExtensionB.cs index b7f71e4..4f4027b 100644 --- a/src/WebApplication.ExtensionB/ExtensionB.cs +++ b/src/WebApplication.ExtensionB/ExtensionB.cs @@ -8,50 +8,73 @@ using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.EntityFrameworkCore; +using WebApplication.ExtensionB.Models; namespace WebApplication.ExtensionB { - public class ExtensionB : IExtension - { - private IConfigurationRoot configurationRoot; - - public string Name + public class ExtensionB : IExtension { - get - { - return "Extension B"; - } - } + private IConfigurationRoot configurationRoot; - public IDictionary> RouteRegistrarsByPriorities - { - get - { - Dictionary> routeRegistrarsByPriorities = new Dictionary>(); - - routeRegistrarsByPriorities.Add( - 2000, - routeBuilder => - { - routeBuilder.MapRoute(name: "Extension B", template: "extension-b", defaults: new { controller = "ExtensionB", action = "Index" }); - } - ); - - return routeRegistrarsByPriorities; - } - } + public string Name + { + get + { + return "Extension B"; + } + } - public void SetConfigurationRoot(IConfigurationRoot configurationRoot) - { - this.configurationRoot = configurationRoot; - } + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); - public void ConfigureServices(IServiceCollection services) - { - } + routeRegistrarsByPriorities.Add( + 3000, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension B", template: "extension-b", defaults: new { controller = "ExtensionB", action = "Index" }); + } + ); - public void Configure(IApplicationBuilder applicationBuilder) - { + return routeRegistrarsByPriorities; + } + } + + + public int ConfigureServicesPriorities + { + get + { + return 2000; + } + } + public int ConfigurePriorities + { + get + { + return 2000; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + public void ConfigureServices(IServiceCollection services) + { + services.AddEntityFrameworkSqlite(); + services.AddDbContext(options => + { + options.UseSqlite(this.configurationRoot["Data:DefaultConnection:ConnectionString"]); + }); + services.AddScoped(); + } + + public void Configure(IApplicationBuilder applicationBuilder) + { + } } - } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Models/IItemRepository.cs b/src/WebApplication.ExtensionB/Models/IItemRepository.cs new file mode 100644 index 0000000..ffd86fc --- /dev/null +++ b/src/WebApplication.ExtensionB/Models/IItemRepository.cs @@ -0,0 +1,11 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +namespace WebApplication.ExtensionB.Models +{ + public interface IItemRepository + { + IEnumerable All(); + } +} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Models/Item.cs b/src/WebApplication.ExtensionB/Models/Item.cs new file mode 100644 index 0000000..fd3d533 --- /dev/null +++ b/src/WebApplication.ExtensionB/Models/Item.cs @@ -0,0 +1,11 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace WebApplication.ExtensionB.Models +{ + public class Item + { + public int Id { get; set; } + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Models/ItemDbContext.cs b/src/WebApplication.ExtensionB/Models/ItemDbContext.cs new file mode 100644 index 0000000..5c74414 --- /dev/null +++ b/src/WebApplication.ExtensionB/Models/ItemDbContext.cs @@ -0,0 +1,19 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.EntityFrameworkCore; + +namespace WebApplication.ExtensionB.Models +{ + public class ItemDbContext : DbContext + { + public ItemDbContext(DbContextOptions options) :base(options) + { } + public DbSet Items { get; set; } + public void OnModelCreating(ModelBuilder builder) + { + builder.Entity().HasKey(m => m.Id); + base.OnModelCreating(builder); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Models/ItemRepository.cs b/src/WebApplication.ExtensionB/Models/ItemRepository.cs new file mode 100644 index 0000000..2113d13 --- /dev/null +++ b/src/WebApplication.ExtensionB/Models/ItemRepository.cs @@ -0,0 +1,21 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; + +namespace WebApplication.ExtensionB.Models +{ + public class ItemRepository : IItemRepository + { + private ItemDbContext _itemDbContext { get; set; } + public ItemRepository(ItemDbContext itemDbContext) + { + _itemDbContext = itemDbContext; + } + public IEnumerable All() + { + return _itemDbContext.Items.OrderBy(i => i.Name); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/ViewModels/ExtensionB/Index/IndexViewModelBuilder.cs b/src/WebApplication.ExtensionB/ViewModels/ExtensionB/Index/IndexViewModelBuilder.cs index 3fb9be6..2b8dc03 100644 --- a/src/WebApplication.ExtensionB/ViewModels/ExtensionB/Index/IndexViewModelBuilder.cs +++ b/src/WebApplication.ExtensionB/ViewModels/ExtensionB/Index/IndexViewModelBuilder.cs @@ -3,19 +3,19 @@ using System.Collections.Generic; using System.Linq; -using WebApplication.ExtensionB.Data.Models; +using WebApplication.ExtensionB.Models; using WebApplication.ExtensionB.ViewModels.Shared; namespace WebApplication.ExtensionB.ViewModels.ExtenstionB { - public class IndexViewModelBuilder - { - public IndexViewModel Build(IEnumerable items) + public class IndexViewModelBuilder { - return new IndexViewModel() - { - Items = items.Select(i => new ItemViewModelBuilder().Build(i)) - }; + public IndexViewModel Build(IEnumerable items) + { + return new IndexViewModel() + { + Items = items.Select(i => new ItemViewModelBuilder().Build(i)) + }; + } } - } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/ViewModels/Shared/ItemViewModelBuilder.cs b/src/WebApplication.ExtensionB/ViewModels/Shared/ItemViewModelBuilder.cs index ece8fd2..f56bc53 100644 --- a/src/WebApplication.ExtensionB/ViewModels/Shared/ItemViewModelBuilder.cs +++ b/src/WebApplication.ExtensionB/ViewModels/Shared/ItemViewModelBuilder.cs @@ -1,18 +1,18 @@ // Copyright © 2015 Dmitry Sikorsky. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using WebApplication.ExtensionB.Data.Models; +using WebApplication.ExtensionB.Models; namespace WebApplication.ExtensionB.ViewModels.Shared { - public class ItemViewModelBuilder - { - public ItemViewModel Build(Item item) + public class ItemViewModelBuilder { - return new ItemViewModel() - { - Name = item.Name - }; + public ItemViewModel Build(Item item) + { + return new ItemViewModel() + { + Name = item.Name + }; + } } - } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Views/ExtensionB/Index.cshtml b/src/WebApplication.ExtensionB/Views/ExtensionB/Index.cshtml index 338ffd2..7743a4e 100644 --- a/src/WebApplication.ExtensionB/Views/ExtensionB/Index.cshtml +++ b/src/WebApplication.ExtensionB/Views/ExtensionB/Index.cshtml @@ -19,6 +19,6 @@

    This line is red because of the rule in CSS-file added as resource (from Extension A).

    So any extension can use resources from any other extension.

    -

    * Precompiled views support has been suspended in ASP.NET Core 1.0 RC2.

    +

    * Precompiled views support has been suspended in ASP.NET Core 1.0 RTM.

    \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/project.json b/src/WebApplication.ExtensionB/project.json index fb9e2f8..ebd75b0 100644 --- a/src/WebApplication.ExtensionB/project.json +++ b/src/WebApplication.ExtensionB/project.json @@ -2,12 +2,10 @@ "authors": [ "Dmitry Sikorsky" ], "buildOptions": { "embed": [ "Views/**" ] }, "dependencies": { - "ExtCore.Data.Abstractions": "1.0.0-alpha9", - "ExtCore.Infrastructure": "1.0.0-alpha9", + "ExtCore.Infrastructure": "1.0.0-alpha901", "Microsoft.AspNetCore.Mvc": "1.0.0", "NETStandard.Library": "1.6.0", - "WebApplication.ExtensionB.Data.Abstractions": "1.0.0", - "WebApplication.ExtensionB.Data.Models": "1.0.0" + "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0" }, "frameworks": { "netstandard1.6": { diff --git a/src/WebApplication.NLog/NLog.cs b/src/WebApplication.NLog/NLog.cs new file mode 100644 index 0000000..1321c38 --- /dev/null +++ b/src/WebApplication.NLog/NLog.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ExtCore.Infrastructure; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using NLog.Web; +using NLog.Extensions.Logging; + +namespace WebApplication.NLog +{ + public class NLog : IExtension + { + private IConfigurationRoot configurationRoot; + + public string Name + { + get + { + return "Extension NLog"; + } + } + + public IDictionary> RouteRegistrarsByPriorities + { + get + { + return null; + } + } + + public int ConfigureServicesPriorities + { + get + { + return 100; + } + } + public int ConfigurePriorities + { + get + { + return 100; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + public void ConfigureServices(IServiceCollection services) + { + services.AddLogging(); + } + + public void Configure(IApplicationBuilder app) + { + var loggerFactory = app.ApplicationServices.GetService(); + var env = app.ApplicationServices.GetService(); + + //add NLog to ASP.NET Core + loggerFactory.AddNLog(); + + //add NLog.Web + app.AddNLogWeb(); + //needed for non-NETSTANDARD platforms: configure nlog.config in your project root + //env.ConfigureNLog("nlog.config"); + loggerFactory.AddConsole(); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.NLog/Properties/AssemblyInfo.cs b/src/WebApplication.NLog/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..609930a --- /dev/null +++ b/src/WebApplication.NLog/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +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: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebApplication.NLog")] +[assembly: AssemblyTrademark("")] + +// 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("9e4b65ab-3f34-4c81-b02d-8e5643d2b3b9")] diff --git a/src/WebApplication.NLog/WebApplication.NLog.xproj b/src/WebApplication.NLog/WebApplication.NLog.xproj new file mode 100644 index 0000000..abf2298 --- /dev/null +++ b/src/WebApplication.NLog/WebApplication.NLog.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + 9e4b65ab-3f34-4c81-b02d-8e5643d2b3b9 + WebApplication.NLog + .\obj + .\bin\ + v4.6.1 + + + + 2.0 + + + diff --git a/src/WebApplication.NLog/project.json b/src/WebApplication.NLog/project.json new file mode 100644 index 0000000..c6f5370 --- /dev/null +++ b/src/WebApplication.NLog/project.json @@ -0,0 +1,24 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "ExtCore.Infrastructure": "1.0.0-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.0", + "NETStandard.Library": "1.6.0", + "Microsoft.Extensions.Logging": "1.0.0", + "Microsoft.Extensions.Logging.Console": "1.0.0", + "Microsoft.Extensions.Logging.Debug": "1.0.0", + "NLog.Extensions.Logging": "1.0.0-rtm-alpha2", + "NLog.Web.AspNetCore": "4.2.4" + }, + + "frameworks": { + "netstandard1.6": { + "imports": [ + "dotnet5.6", + "dnxcore50", + "portable-net45+win8" + ] + } + } +} diff --git a/src/WebApplication.Swagger/Properties/AssemblyInfo.cs b/src/WebApplication.Swagger/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..402d27a --- /dev/null +++ b/src/WebApplication.Swagger/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +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: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebApplication.Swagger")] +[assembly: AssemblyTrademark("")] + +// 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("95e5595e-410b-4a6d-8822-4c07fdc3cf21")] diff --git a/src/WebApplication.Swagger/Swagger.cs b/src/WebApplication.Swagger/Swagger.cs new file mode 100644 index 0000000..162f971 --- /dev/null +++ b/src/WebApplication.Swagger/Swagger.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ExtCore.Infrastructure; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Swashbuckle.Swagger.Model; + + +namespace WebApplication.Swagger +{ + public class Swagger : IExtension + { + private IConfigurationRoot configurationRoot; + + public string Name + { + get + { + return "Extension Swagger"; + } + } + + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); + + routeRegistrarsByPriorities.Add( + 9000, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension Swagger", template: "{controller=Home}/{action=Index}/{id?}"); + } + ); + + return routeRegistrarsByPriorities; + } + } + + public int ConfigureServicesPriorities + { + get + { + return 300; + } + } + public int ConfigurePriorities + { + get + { + return 9000; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + + public void ConfigureServices(IServiceCollection services) + { + //var pathToDoc = this.configurationRoot["Swagger:Path"]; + services.AddSwaggerGen(); + services.ConfigureSwaggerGen(options => + { + options.SingleApiVersion(new Info + { + Version = "v1", + Title = "Geo Search API", + Description = "A simple api to search using geo location in Elasticsearch", + TermsOfService = "None" + }); + //options.IncludeXmlComments(pathToDoc); + options.DescribeAllEnumsAsStrings(); + }); + } + + public void Configure(IApplicationBuilder applicationBuilder) + { + applicationBuilder.UseSwagger(); + applicationBuilder.UseSwaggerUi(); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.Swagger/WebApplication.Swagger.xproj b/src/WebApplication.Swagger/WebApplication.Swagger.xproj new file mode 100644 index 0000000..7af6b7d --- /dev/null +++ b/src/WebApplication.Swagger/WebApplication.Swagger.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + 95e5595e-410b-4a6d-8822-4c07fdc3cf21 + WebApplication.Swagger + .\obj + .\bin\ + v4.6.1 + + + + 2.0 + + + diff --git a/src/WebApplication.Swagger/project.json b/src/WebApplication.Swagger/project.json new file mode 100644 index 0000000..3ec61ca --- /dev/null +++ b/src/WebApplication.Swagger/project.json @@ -0,0 +1,21 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "ExtCore.Infrastructure": "1.0.0-alpha901", + "NETStandard.Library": "1.6.0", + "Microsoft.AspNetCore.Mvc": "1.0.0", + "Swashbuckle": "6.0.0-beta901", + "Swashbuckle.Swagger": "6.0.0-beta901" + }, + + "frameworks": { + "netstandard1.6": { + "imports": [ + "dotnet5.6", + "dnxcore50", + "portable-net45+win8" + ] + } + } +} diff --git a/src/WebApplication.WebAPI/Controllers/ItemsController.cs b/src/WebApplication.WebAPI/Controllers/ItemsController.cs new file mode 100644 index 0000000..02021e7 --- /dev/null +++ b/src/WebApplication.WebAPI/Controllers/ItemsController.cs @@ -0,0 +1,45 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Mvc; +using WebApplication.WebAPI.Models; + +namespace WebApplication.WebAPI.Controllers +{ + [Route("api/[controller]")] + public class ItemsController : Controller + { + private IItemRepository _itemRepository { get; set; } + + public ItemsController(IItemRepository itemRepository) + { + _itemRepository = itemRepository; + } + + [HttpGet] + public IActionResult Get() + { + return Ok(_itemRepository.All()); + } + [HttpGet("{id}")] + public IActionResult Get(long id) + { + return Ok(_itemRepository.Find(id)); + } + [HttpPost] + public void Post([FromBody]Item value) + { + _itemRepository.Add(value); + } + [HttpPut("{id}")] + public void Put(long id, [FromBody]Item value) + { + _itemRepository.Update(id, value); + } + [HttpDelete("{id}")] + public void Delete(long id) + { + _itemRepository.Delete(id); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Models/IItemRepository.cs b/src/WebApplication.WebAPI/Models/IItemRepository.cs new file mode 100644 index 0000000..41a1689 --- /dev/null +++ b/src/WebApplication.WebAPI/Models/IItemRepository.cs @@ -0,0 +1,15 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +namespace WebApplication.WebAPI.Models +{ + public interface IItemRepository + { + IEnumerable All(); + Item Find(long id); + void Add(Item value); + void Update(long id, Item value); + void Delete(long id); + } +} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Models/Item.cs b/src/WebApplication.WebAPI/Models/Item.cs new file mode 100644 index 0000000..31b9813 --- /dev/null +++ b/src/WebApplication.WebAPI/Models/Item.cs @@ -0,0 +1,11 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace WebApplication.WebAPI.Models +{ + public class Item + { + public int Id { get; set; } + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Models/ItemDbContext.cs b/src/WebApplication.WebAPI/Models/ItemDbContext.cs new file mode 100644 index 0000000..401a332 --- /dev/null +++ b/src/WebApplication.WebAPI/Models/ItemDbContext.cs @@ -0,0 +1,19 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.EntityFrameworkCore; + +namespace WebApplication.WebAPI.Models +{ + public class ItemDbContext : DbContext + { + public ItemDbContext(DbContextOptions options) :base(options) + { } + public DbSet Items { get; set; } + public void OnModelCreating(ModelBuilder builder) + { + builder.Entity().HasKey(m => m.Id); + base.OnModelCreating(builder); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Models/ItemRepository.cs b/src/WebApplication.WebAPI/Models/ItemRepository.cs new file mode 100644 index 0000000..869666d --- /dev/null +++ b/src/WebApplication.WebAPI/Models/ItemRepository.cs @@ -0,0 +1,44 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; + +namespace WebApplication.WebAPI.Models +{ + public class ItemRepository : IItemRepository + { + private ItemDbContext _itemDbContext { get; set; } + public ItemRepository(ItemDbContext itemDbContext) + { + _itemDbContext = itemDbContext; + } + public IEnumerable All() + { + return _itemDbContext.Items.OrderBy(i => i.Name); + } + public Item Find(long id) + { + return _itemDbContext.Items.Where(i => i.Id == id).First(); + } + public void Add(Item value) + { + _itemDbContext.Items.Add(value); + _itemDbContext.SaveChanges(); + return; + } + public void Update(long id, Item value) + { + _itemDbContext.Items.Update(value); + _itemDbContext.SaveChanges(); + return; + } + public void Delete(long id) + { + var value =_itemDbContext.Items.Where(i => i.Id == id).First(); + _itemDbContext.Items.Remove(value); + _itemDbContext.SaveChanges(); + return; + } + } +} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Properties/AssemblyInfo.cs b/src/WebApplication.WebAPI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..881bd64 --- /dev/null +++ b/src/WebApplication.WebAPI/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +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: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebApplication.WebAPI")] +[assembly: AssemblyTrademark("")] + +// 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("7de66111-bbb6-4c93-b864-9e65cafd505b")] diff --git a/src/WebApplication.WebAPI/WebAPI.cs b/src/WebApplication.WebAPI/WebAPI.cs new file mode 100644 index 0000000..3cf3a9e --- /dev/null +++ b/src/WebApplication.WebAPI/WebAPI.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ExtCore.Infrastructure; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.EntityFrameworkCore; +using WebApplication.WebAPI.Models; + +namespace WebApplication.WebAPI +{ + public class WebAPI : IExtension + { + private IConfigurationRoot configurationRoot; + + public string Name + { + get + { + return "Extension WebAPI"; + } + } + + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); + + routeRegistrarsByPriorities.Add( + 2000, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension WebAPI", template: "{controller=Home}/{action=Index}/{id?}"); + } + ); + + return routeRegistrarsByPriorities; + } + } + + + public int ConfigureServicesPriorities + { + get + { + return 2001; + } + } + public int ConfigurePriorities + { + get + { + return 2001; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + public void ConfigureServices(IServiceCollection services) + { + services.AddEntityFrameworkSqlite(); + services.AddDbContext(options => + { + options.UseSqlite(this.configurationRoot["Data:DefaultConnection:ConnectionString"]); + }); + services.AddScoped(); + } + + public void Configure(IApplicationBuilder applicationBuilder) + { + } + } +} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/WebApplication.WebAPI.xproj b/src/WebApplication.WebAPI/WebApplication.WebAPI.xproj new file mode 100644 index 0000000..9f3c301 --- /dev/null +++ b/src/WebApplication.WebAPI/WebApplication.WebAPI.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + 7de66111-bbb6-4c93-b864-9e65cafd505b + WebApplication.WebAPI + .\obj + .\bin\ + v4.6.1 + + + + 2.0 + + + diff --git a/src/WebApplication.WebAPI/project.json b/src/WebApplication.WebAPI/project.json new file mode 100644 index 0000000..87fe16f --- /dev/null +++ b/src/WebApplication.WebAPI/project.json @@ -0,0 +1,16 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "NETStandard.Library": "1.6.0", + "ExtCore.Infrastructure": "1.0.0-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.0", + "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0" + }, + + "frameworks": { + "netstandard1.6": { + "imports": "dnxcore50" + } + } +} diff --git a/src/WebApplication/gulpfile.js b/src/WebApplication/gulpfile.js index 7aefd59..c1f75df 100644 --- a/src/WebApplication/gulpfile.js +++ b/src/WebApplication/gulpfile.js @@ -2,11 +2,12 @@ gulp.task( "copy-extensions", function (cb) { + gulp.src(["../WebApplication.NLog/bin/Debug/netstandard1.6/WebApplication.NLog.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.Elm/bin/Debug/netstandard1.6/WebApplication.Elm.dll"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.ExtensionA/bin/Debug/netstandard1.6/WebApplication.ExtensionA.dll"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.ExtensionB/bin/Debug/netstandard1.6/WebApplication.ExtensionB.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.ExtensionB.Data.Abstractions/bin/Debug/netstandard1.6/WebApplication.ExtensionB.Data.Abstractions.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.ExtensionB.Data.EntityFramework.Sqlite/bin/Debug/netstandard1.6/WebApplication.ExtensionB.Data.EntityFramework.Sqlite.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.ExtensionB.Data.Models/bin/Debug/netstandard1.6/WebApplication.ExtensionB.Data.Models.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.Swagger/bin/Debug/netstandard1.6/WebApplication.Swagger.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.WebAPI/bin/Debug/netstandard1.6/WebApplication.WebAPI.dll"]).pipe(gulp.dest("Extensions")); cb(); } ); \ No newline at end of file diff --git a/src/WebApplication/nlog.config b/src/WebApplication/nlog.config new file mode 100644 index 0000000..53ac823 --- /dev/null +++ b/src/WebApplication/nlog.config @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/WebApplication/project.json b/src/WebApplication/project.json index 117e652..c148096 100644 --- a/src/WebApplication/project.json +++ b/src/WebApplication/project.json @@ -7,10 +7,8 @@ "preserveCompilationContext": true }, "dependencies": { - "ExtCore.Data": "1.0.0-alpha9", - "ExtCore.Data.EntityFramework.Sqlite": "1.0.0-alpha9", - "ExtCore.Infrastructure": "1.0.0-alpha9", - "ExtCore.WebApplication": "1.0.0-alpha9", + "ExtCore.Infrastructure": "1.0.0-alpha901", + "ExtCore.WebApplication": "1.0.0-alpha901", "Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", @@ -20,7 +18,18 @@ "version": "1.0.0", "type": "platform" }, - "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0" + "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0", + "Microsoft.Extensions.Logging": "1.0.0", + "Microsoft.Extensions.Logging.Console": "1.0.0", + "Microsoft.Extensions.Logging.Debug": "1.0.0", + "NLog.Extensions.Logging": "1.0.0-rtm-alpha2", + "NLog.Web.AspNetCore": "4.2.4", + "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0", + "NETStandard.Library": "1.6.0", + "Microsoft.AspNetCore.Mvc": "1.0.0", + "Microsoft.AspNetCore.Diagnostics.Elm": "0.1.0", + "Swashbuckle": "6.0.0-beta901", + "Swashbuckle.Swagger": "6.0.0-beta901" }, "frameworks": { "netcoreapp1.0": { @@ -36,7 +45,8 @@ "Views", "wwwroot", "config.json", - "web.config" + "web.config", + "nlog.config" ] }, "runtimeOptions": { From 644c13a5281d5c693a0022daded42e5ab30f818f Mon Sep 17 00:00:00 2001 From: f7q Date: Mon, 11 Jul 2016 23:02:41 +0900 Subject: [PATCH 02/18] Revert "AddSamples" --- .gitignore | 4 +- NuGet.config | 10 -- WebApplication.sln | 57 ++++------- src/WebApplication.Elm/Elm.cs | 93 ------------------ .../Properties/AssemblyInfo.cs | 19 ---- .../WebApplication.Elm.xproj | 21 ---- src/WebApplication.Elm/project.json | 17 ---- src/WebApplication.ExtensionA/ExtensionA.cs | 88 +++++++---------- .../Views/ExtensionA/Index.cshtml | 2 - src/WebApplication.ExtensionA/project.json | 2 +- .../Controllers/ExtensionBController.cs | 25 ++--- src/WebApplication.ExtensionB/ExtensionB.cs | 97 +++++++------------ .../Models/IItemRepository.cs | 11 --- src/WebApplication.ExtensionB/Models/Item.cs | 11 --- .../Models/ItemDbContext.cs | 19 ---- .../Models/ItemRepository.cs | 21 ---- .../ExtensionB/Index/IndexViewModelBuilder.cs | 18 ++-- .../ViewModels/Shared/ItemViewModelBuilder.cs | 18 ++-- .../Views/ExtensionB/Index.cshtml | 2 +- src/WebApplication.ExtensionB/project.json | 6 +- src/WebApplication.NLog/NLog.cs | 76 --------------- .../Properties/AssemblyInfo.cs | 19 ---- .../WebApplication.NLog.xproj | 21 ---- src/WebApplication.NLog/project.json | 24 ----- .../Properties/AssemblyInfo.cs | 19 ---- src/WebApplication.Swagger/Swagger.cs | 90 ----------------- .../WebApplication.Swagger.xproj | 21 ---- src/WebApplication.Swagger/project.json | 21 ---- .../Controllers/ItemsController.cs | 45 --------- .../Models/IItemRepository.cs | 15 --- src/WebApplication.WebAPI/Models/Item.cs | 11 --- .../Models/ItemDbContext.cs | 19 ---- .../Models/ItemRepository.cs | 44 --------- .../Properties/AssemblyInfo.cs | 19 ---- src/WebApplication.WebAPI/WebAPI.cs | 79 --------------- .../WebApplication.WebAPI.xproj | 21 ---- src/WebApplication.WebAPI/project.json | 16 --- src/WebApplication/gulpfile.js | 7 +- src/WebApplication/nlog.config | 32 ------ src/WebApplication/project.json | 22 ++--- 40 files changed, 140 insertions(+), 1022 deletions(-) delete mode 100644 NuGet.config delete mode 100644 src/WebApplication.Elm/Elm.cs delete mode 100644 src/WebApplication.Elm/Properties/AssemblyInfo.cs delete mode 100644 src/WebApplication.Elm/WebApplication.Elm.xproj delete mode 100644 src/WebApplication.Elm/project.json delete mode 100644 src/WebApplication.ExtensionB/Models/IItemRepository.cs delete mode 100644 src/WebApplication.ExtensionB/Models/Item.cs delete mode 100644 src/WebApplication.ExtensionB/Models/ItemDbContext.cs delete mode 100644 src/WebApplication.ExtensionB/Models/ItemRepository.cs delete mode 100644 src/WebApplication.NLog/NLog.cs delete mode 100644 src/WebApplication.NLog/Properties/AssemblyInfo.cs delete mode 100644 src/WebApplication.NLog/WebApplication.NLog.xproj delete mode 100644 src/WebApplication.NLog/project.json delete mode 100644 src/WebApplication.Swagger/Properties/AssemblyInfo.cs delete mode 100644 src/WebApplication.Swagger/Swagger.cs delete mode 100644 src/WebApplication.Swagger/WebApplication.Swagger.xproj delete mode 100644 src/WebApplication.Swagger/project.json delete mode 100644 src/WebApplication.WebAPI/Controllers/ItemsController.cs delete mode 100644 src/WebApplication.WebAPI/Models/IItemRepository.cs delete mode 100644 src/WebApplication.WebAPI/Models/Item.cs delete mode 100644 src/WebApplication.WebAPI/Models/ItemDbContext.cs delete mode 100644 src/WebApplication.WebAPI/Models/ItemRepository.cs delete mode 100644 src/WebApplication.WebAPI/Properties/AssemblyInfo.cs delete mode 100644 src/WebApplication.WebAPI/WebAPI.cs delete mode 100644 src/WebApplication.WebAPI/WebApplication.WebAPI.xproj delete mode 100644 src/WebApplication.WebAPI/project.json delete mode 100644 src/WebApplication/nlog.config diff --git a/.gitignore b/.gitignore index 9aefda2..cbb98db 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,4 @@ bin/ obj/ src/WebApplication/node_modules/ *.xproj.user -*.lock.json -*.dll -*.log \ No newline at end of file +*.lock.json \ No newline at end of file diff --git a/NuGet.config b/NuGet.config deleted file mode 100644 index 590be3b..0000000 --- a/NuGet.config +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/WebApplication.sln b/WebApplication.sln index 496c336..7b3ff39 100644 --- a/WebApplication.sln +++ b/WebApplication.sln @@ -18,23 +18,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExtensionA", "ExtensionA", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExtensionB", "ExtensionB", "{4EA56716-702B-485A-A23A-10E110A85D78}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionB", "src\WebApplication.ExtensionB\WebApplication.ExtensionB.xproj", "{396A8530-C500-469E-9F6F-A2D9C286C47D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NLog", "NLog", "{511BD310-4C03-407B-92EA-34110884C547}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.NLog", "src\WebApplication.NLog\WebApplication.NLog.xproj", "{9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Swagger", "Swagger", "{8327C820-20D1-4095-8771-E03613D1969F}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionB.Data.Models", "src\WebApplication.ExtensionB.Data.Models\WebApplication.ExtensionB.Data.Models.xproj", "{6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.Swagger", "src\WebApplication.Swagger\WebApplication.Swagger.xproj", "{95E5595E-410B-4A6D-8822-4C07FDC3CF21}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebAPI", "WebAPI", "{FDEA400A-7F71-4A17-8419-030D80F74A3F}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.WebAPI", "src\WebApplication.WebAPI\WebApplication.WebAPI.xproj", "{7DE66111-BBB6-4C93-B864-9E65CAFD505B}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionB", "src\WebApplication.ExtensionB\WebApplication.ExtensionB.xproj", "{396A8530-C500-469E-9F6F-A2D9C286C47D}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Elm", "Elm", "{C49636B1-231E-45A2-8901-10EC68C7CB55}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionB.Data.Abstractions", "src\WebApplication.ExtensionB.Data.Abstractions\WebApplication.ExtensionB.Data.Abstractions.xproj", "{922E22BD-10F8-4261-9ACC-9CD10A4C8147}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.Elm", "src\WebApplication.Elm\WebApplication.Elm.xproj", "{A5C5400D-DD78-4192-B34B-06D81996F0DA}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionB.Data.EntityFramework.Sqlite", "src\WebApplication.ExtensionB.Data.EntityFramework.Sqlite\WebApplication.ExtensionB.Data.EntityFramework.Sqlite.xproj", "{AF7B3C14-BC6E-4964-BD0B-5233428349B6}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -50,26 +40,22 @@ Global {8D722841-4E2C-4673-A7CC-C2690EFE3915}.Debug|Any CPU.Build.0 = Debug|Any CPU {8D722841-4E2C-4673-A7CC-C2690EFE3915}.Release|Any CPU.ActiveCfg = Release|Any CPU {8D722841-4E2C-4673-A7CC-C2690EFE3915}.Release|Any CPU.Build.0 = Release|Any CPU + {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}.Release|Any CPU.Build.0 = Release|Any CPU {396A8530-C500-469E-9F6F-A2D9C286C47D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {396A8530-C500-469E-9F6F-A2D9C286C47D}.Debug|Any CPU.Build.0 = Debug|Any CPU {396A8530-C500-469E-9F6F-A2D9C286C47D}.Release|Any CPU.ActiveCfg = Release|Any CPU {396A8530-C500-469E-9F6F-A2D9C286C47D}.Release|Any CPU.Build.0 = Release|Any CPU - {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}.Release|Any CPU.Build.0 = Release|Any CPU - {95E5595E-410B-4A6D-8822-4C07FDC3CF21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {95E5595E-410B-4A6D-8822-4C07FDC3CF21}.Debug|Any CPU.Build.0 = Debug|Any CPU - {95E5595E-410B-4A6D-8822-4C07FDC3CF21}.Release|Any CPU.ActiveCfg = Release|Any CPU - {95E5595E-410B-4A6D-8822-4C07FDC3CF21}.Release|Any CPU.Build.0 = Release|Any CPU - {7DE66111-BBB6-4C93-B864-9E65CAFD505B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7DE66111-BBB6-4C93-B864-9E65CAFD505B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7DE66111-BBB6-4C93-B864-9E65CAFD505B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7DE66111-BBB6-4C93-B864-9E65CAFD505B}.Release|Any CPU.Build.0 = Release|Any CPU - {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Release|Any CPU.Build.0 = Release|Any CPU + {922E22BD-10F8-4261-9ACC-9CD10A4C8147}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {922E22BD-10F8-4261-9ACC-9CD10A4C8147}.Debug|Any CPU.Build.0 = Debug|Any CPU + {922E22BD-10F8-4261-9ACC-9CD10A4C8147}.Release|Any CPU.ActiveCfg = Release|Any CPU + {922E22BD-10F8-4261-9ACC-9CD10A4C8147}.Release|Any CPU.Build.0 = Release|Any CPU + {AF7B3C14-BC6E-4964-BD0B-5233428349B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF7B3C14-BC6E-4964-BD0B-5233428349B6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF7B3C14-BC6E-4964-BD0B-5233428349B6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF7B3C14-BC6E-4964-BD0B-5233428349B6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -79,14 +65,9 @@ Global {8D722841-4E2C-4673-A7CC-C2690EFE3915} = {F92B44CF-63EE-4781-8244-48ACC5386A8C} {F92B44CF-63EE-4781-8244-48ACC5386A8C} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} {4EA56716-702B-485A-A23A-10E110A85D78} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF} = {4EA56716-702B-485A-A23A-10E110A85D78} {396A8530-C500-469E-9F6F-A2D9C286C47D} = {4EA56716-702B-485A-A23A-10E110A85D78} - {511BD310-4C03-407B-92EA-34110884C547} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} - {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9} = {511BD310-4C03-407B-92EA-34110884C547} - {8327C820-20D1-4095-8771-E03613D1969F} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} - {95E5595E-410B-4A6D-8822-4C07FDC3CF21} = {8327C820-20D1-4095-8771-E03613D1969F} - {FDEA400A-7F71-4A17-8419-030D80F74A3F} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} - {7DE66111-BBB6-4C93-B864-9E65CAFD505B} = {FDEA400A-7F71-4A17-8419-030D80F74A3F} - {C49636B1-231E-45A2-8901-10EC68C7CB55} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} - {A5C5400D-DD78-4192-B34B-06D81996F0DA} = {C49636B1-231E-45A2-8901-10EC68C7CB55} + {922E22BD-10F8-4261-9ACC-9CD10A4C8147} = {4EA56716-702B-485A-A23A-10E110A85D78} + {AF7B3C14-BC6E-4964-BD0B-5233428349B6} = {4EA56716-702B-485A-A23A-10E110A85D78} EndGlobalSection EndGlobal diff --git a/src/WebApplication.Elm/Elm.cs b/src/WebApplication.Elm/Elm.cs deleted file mode 100644 index 6b75fbc..0000000 --- a/src/WebApplication.Elm/Elm.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using ExtCore.Infrastructure; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Logging; - -namespace WebApplication.Elm -{ - public class Elm : IExtension - { - private IConfigurationRoot configurationRoot; - - public string Name - { - get - { - return "Extension Elm"; - } - } - - public IDictionary> RouteRegistrarsByPriorities - { - get - { - return null; - } - } - - - public int ConfigureServicesPriorities - { - get - { - return 100; - } - } - public int ConfigurePriorities - { - get - { - return 100; - } - } - public void SetConfigurationRoot(IConfigurationRoot configurationRoot) - { - this.configurationRoot = configurationRoot; - } - - public void ConfigureServices(IServiceCollection services) - { - services.AddElm(options => - { - options.Path = new PathString("/Elm"); // defaults to "/Elm" - options.Filter = (name, level) => level >= LogLevel.Information; - }); - } - - public void Configure(IApplicationBuilder app) - { - app.UseElmPage(); // Shows the logs at the specified path - app.UseElmCapture(); // Adds the ElmLoggerProvider - var factory = app.ApplicationServices.GetService(); - var logger = factory.CreateLogger(); - using (logger.BeginScope("startup")) - { - logger.LogWarning("Starting up"); - } - - /*app.Run(async context => - { - await context.Response.WriteAsync("Hello world"); - using (logger.BeginScope("world")) - { - logger.LogInformation("Hello world!"); - logger.LogError("Mort"); - } - // This will not get logged because the filter has been set to LogLevel.Information and above - using (logger.BeginScope("debug")) - { - logger.LogDebug("some debug stuff"); - } - });*/ - logger.LogInformation("This message is not in a scope"); - } - } -} \ No newline at end of file diff --git a/src/WebApplication.Elm/Properties/AssemblyInfo.cs b/src/WebApplication.Elm/Properties/AssemblyInfo.cs deleted file mode 100644 index 1052743..0000000 --- a/src/WebApplication.Elm/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,19 +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: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("WebApplication.Elm")] -[assembly: AssemblyTrademark("")] - -// 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("a5c5400d-dd78-4192-b34b-06d81996f0da")] diff --git a/src/WebApplication.Elm/WebApplication.Elm.xproj b/src/WebApplication.Elm/WebApplication.Elm.xproj deleted file mode 100644 index 502d8c1..0000000 --- a/src/WebApplication.Elm/WebApplication.Elm.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - a5c5400d-dd78-4192-b34b-06d81996f0da - Elm - .\obj - .\bin\ - v4.6.1 - - - - 2.0 - - - diff --git a/src/WebApplication.Elm/project.json b/src/WebApplication.Elm/project.json deleted file mode 100644 index ed3341a..0000000 --- a/src/WebApplication.Elm/project.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "NETStandard.Library": "1.6.0", - "ExtCore.Infrastructure": "1.0.0-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.0", - "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", - "Microsoft.AspNetCore.Diagnostics.Elm": "0.1.0" - }, - - "frameworks": { - "netstandard1.6": { - "imports": "dnxcore50" - } - } -} \ No newline at end of file diff --git a/src/WebApplication.ExtensionA/ExtensionA.cs b/src/WebApplication.ExtensionA/ExtensionA.cs index 8116d77..e583ddb 100644 --- a/src/WebApplication.ExtensionA/ExtensionA.cs +++ b/src/WebApplication.ExtensionA/ExtensionA.cs @@ -11,61 +11,47 @@ namespace WebApplication.ExtensionA { - public class ExtensionA : IExtension - { - private IConfigurationRoot configurationRoot; - - public string Name - { - get - { - return "Extension A"; - } - } - - public IDictionary> RouteRegistrarsByPriorities - { - get - { - Dictionary> routeRegistrarsByPriorities = new Dictionary>(); + public class ExtensionA : IExtension + { + private IConfigurationRoot configurationRoot; - routeRegistrarsByPriorities.Add( - 2500, - routeBuilder => - { - routeBuilder.MapRoute(name: "Extension A", template: "", defaults: new { controller = "ExtensionA", action = "Index" }); - } - ); + public string Name + { + get + { + return "Extension A"; + } + } - return routeRegistrarsByPriorities; - } - } + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); + + routeRegistrarsByPriorities.Add( + 1000, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension A", template: "", defaults: new { controller = "ExtensionA", action = "Index" }); + } + ); + + return routeRegistrarsByPriorities; + } + } - public int ConfigureServicesPriorities - { - get - { - return 1000; - } - } - public int ConfigurePriorities - { - get - { - return 1000; - } - } - public void SetConfigurationRoot(IConfigurationRoot configurationRoot) - { - this.configurationRoot = configurationRoot; - } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } - public void ConfigureServices(IServiceCollection services) - { - } + public void ConfigureServices(IServiceCollection services) + { + } - public void Configure(IApplicationBuilder applicationBuilder) - { - } + public void Configure(IApplicationBuilder applicationBuilder) + { } + } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionA/Views/ExtensionA/Index.cshtml b/src/WebApplication.ExtensionA/Views/ExtensionA/Index.cshtml index c6212ae..1716286 100644 --- a/src/WebApplication.ExtensionA/Views/ExtensionA/Index.cshtml +++ b/src/WebApplication.ExtensionA/Views/ExtensionA/Index.cshtml @@ -18,8 +18,6 @@
  • @item
  • } -

    Go to Swagger

    Go to Extension B

    -

    Go to Elm

    \ No newline at end of file diff --git a/src/WebApplication.ExtensionA/project.json b/src/WebApplication.ExtensionA/project.json index 29b1708..1c7c60e 100644 --- a/src/WebApplication.ExtensionA/project.json +++ b/src/WebApplication.ExtensionA/project.json @@ -2,7 +2,7 @@ "authors": [ "Dmitry Sikorsky" ], "buildOptions": { "embed": [ "Styles/**", "Views/**" ] }, "dependencies": { - "ExtCore.Infrastructure": "1.0.0-alpha901", + "ExtCore.Infrastructure": "1.0.0-alpha9", "Microsoft.AspNetCore.Mvc": "1.0.0", "NETStandard.Library": "1.6.0" }, diff --git a/src/WebApplication.ExtensionB/Controllers/ExtensionBController.cs b/src/WebApplication.ExtensionB/Controllers/ExtensionBController.cs index 33e2aca..4606037 100644 --- a/src/WebApplication.ExtensionB/Controllers/ExtensionBController.cs +++ b/src/WebApplication.ExtensionB/Controllers/ExtensionBController.cs @@ -1,24 +1,25 @@ // Copyright © 2015 Dmitry Sikorsky. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using ExtCore.Data.Abstractions; using Microsoft.AspNetCore.Mvc; +using WebApplication.ExtensionB.Data.Abstractions; using WebApplication.ExtensionB.ViewModels.ExtenstionB; -using WebApplication.ExtensionB.Models; namespace WebApplication.ExtensionB.Controllers { - public class ExtensionBController : Controller - { - private IItemRepository _itemRepository { get; set; } + public class ExtensionBController : Controller + { + private IStorage storage; - public ExtensionBController(IItemRepository itemRepository) - { - _itemRepository = itemRepository; - } + public ExtensionBController(IStorage storage) + { + this.storage = storage; + } - public ActionResult Index() - { - return this.View(new IndexViewModelBuilder().Build(_itemRepository.All())); - } + public ActionResult Index() + { + return this.View(new IndexViewModelBuilder().Build(this.storage.GetRepository().All())); } + } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/ExtensionB.cs b/src/WebApplication.ExtensionB/ExtensionB.cs index 4f4027b..b7f71e4 100644 --- a/src/WebApplication.ExtensionB/ExtensionB.cs +++ b/src/WebApplication.ExtensionB/ExtensionB.cs @@ -8,73 +8,50 @@ using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.EntityFrameworkCore; -using WebApplication.ExtensionB.Models; namespace WebApplication.ExtensionB { - public class ExtensionB : IExtension - { - private IConfigurationRoot configurationRoot; - - public string Name - { - get - { - return "Extension B"; - } - } - - public IDictionary> RouteRegistrarsByPriorities - { - get - { - Dictionary> routeRegistrarsByPriorities = new Dictionary>(); - - routeRegistrarsByPriorities.Add( - 3000, - routeBuilder => - { - routeBuilder.MapRoute(name: "Extension B", template: "extension-b", defaults: new { controller = "ExtensionB", action = "Index" }); - } - ); + public class ExtensionB : IExtension + { + private IConfigurationRoot configurationRoot; - return routeRegistrarsByPriorities; - } - } + public string Name + { + get + { + return "Extension B"; + } + } + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); + + routeRegistrarsByPriorities.Add( + 2000, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension B", template: "extension-b", defaults: new { controller = "ExtensionB", action = "Index" }); + } + ); + + return routeRegistrarsByPriorities; + } + } - public int ConfigureServicesPriorities - { - get - { - return 2000; - } - } - public int ConfigurePriorities - { - get - { - return 2000; - } - } - public void SetConfigurationRoot(IConfigurationRoot configurationRoot) - { - this.configurationRoot = configurationRoot; - } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } - public void ConfigureServices(IServiceCollection services) - { - services.AddEntityFrameworkSqlite(); - services.AddDbContext(options => - { - options.UseSqlite(this.configurationRoot["Data:DefaultConnection:ConnectionString"]); - }); - services.AddScoped(); - } + public void ConfigureServices(IServiceCollection services) + { + } - public void Configure(IApplicationBuilder applicationBuilder) - { - } + public void Configure(IApplicationBuilder applicationBuilder) + { } + } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Models/IItemRepository.cs b/src/WebApplication.ExtensionB/Models/IItemRepository.cs deleted file mode 100644 index ffd86fc..0000000 --- a/src/WebApplication.ExtensionB/Models/IItemRepository.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright © 2015 Dmitry Sikorsky. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -namespace WebApplication.ExtensionB.Models -{ - public interface IItemRepository - { - IEnumerable All(); - } -} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Models/Item.cs b/src/WebApplication.ExtensionB/Models/Item.cs deleted file mode 100644 index fd3d533..0000000 --- a/src/WebApplication.ExtensionB/Models/Item.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright © 2015 Dmitry Sikorsky. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace WebApplication.ExtensionB.Models -{ - public class Item - { - public int Id { get; set; } - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Models/ItemDbContext.cs b/src/WebApplication.ExtensionB/Models/ItemDbContext.cs deleted file mode 100644 index 5c74414..0000000 --- a/src/WebApplication.ExtensionB/Models/ItemDbContext.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright © 2015 Dmitry Sikorsky. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.EntityFrameworkCore; - -namespace WebApplication.ExtensionB.Models -{ - public class ItemDbContext : DbContext - { - public ItemDbContext(DbContextOptions options) :base(options) - { } - public DbSet Items { get; set; } - public void OnModelCreating(ModelBuilder builder) - { - builder.Entity().HasKey(m => m.Id); - base.OnModelCreating(builder); - } - } -} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Models/ItemRepository.cs b/src/WebApplication.ExtensionB/Models/ItemRepository.cs deleted file mode 100644 index 2113d13..0000000 --- a/src/WebApplication.ExtensionB/Models/ItemRepository.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright © 2015 Dmitry Sikorsky. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; - -namespace WebApplication.ExtensionB.Models -{ - public class ItemRepository : IItemRepository - { - private ItemDbContext _itemDbContext { get; set; } - public ItemRepository(ItemDbContext itemDbContext) - { - _itemDbContext = itemDbContext; - } - public IEnumerable All() - { - return _itemDbContext.Items.OrderBy(i => i.Name); - } - } -} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/ViewModels/ExtensionB/Index/IndexViewModelBuilder.cs b/src/WebApplication.ExtensionB/ViewModels/ExtensionB/Index/IndexViewModelBuilder.cs index 2b8dc03..3fb9be6 100644 --- a/src/WebApplication.ExtensionB/ViewModels/ExtensionB/Index/IndexViewModelBuilder.cs +++ b/src/WebApplication.ExtensionB/ViewModels/ExtensionB/Index/IndexViewModelBuilder.cs @@ -3,19 +3,19 @@ using System.Collections.Generic; using System.Linq; -using WebApplication.ExtensionB.Models; +using WebApplication.ExtensionB.Data.Models; using WebApplication.ExtensionB.ViewModels.Shared; namespace WebApplication.ExtensionB.ViewModels.ExtenstionB { - public class IndexViewModelBuilder + public class IndexViewModelBuilder + { + public IndexViewModel Build(IEnumerable items) { - public IndexViewModel Build(IEnumerable items) - { - return new IndexViewModel() - { - Items = items.Select(i => new ItemViewModelBuilder().Build(i)) - }; - } + return new IndexViewModel() + { + Items = items.Select(i => new ItemViewModelBuilder().Build(i)) + }; } + } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/ViewModels/Shared/ItemViewModelBuilder.cs b/src/WebApplication.ExtensionB/ViewModels/Shared/ItemViewModelBuilder.cs index f56bc53..ece8fd2 100644 --- a/src/WebApplication.ExtensionB/ViewModels/Shared/ItemViewModelBuilder.cs +++ b/src/WebApplication.ExtensionB/ViewModels/Shared/ItemViewModelBuilder.cs @@ -1,18 +1,18 @@ // Copyright © 2015 Dmitry Sikorsky. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using WebApplication.ExtensionB.Models; +using WebApplication.ExtensionB.Data.Models; namespace WebApplication.ExtensionB.ViewModels.Shared { - public class ItemViewModelBuilder + public class ItemViewModelBuilder + { + public ItemViewModel Build(Item item) { - public ItemViewModel Build(Item item) - { - return new ItemViewModel() - { - Name = item.Name - }; - } + return new ItemViewModel() + { + Name = item.Name + }; } + } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Views/ExtensionB/Index.cshtml b/src/WebApplication.ExtensionB/Views/ExtensionB/Index.cshtml index 7743a4e..338ffd2 100644 --- a/src/WebApplication.ExtensionB/Views/ExtensionB/Index.cshtml +++ b/src/WebApplication.ExtensionB/Views/ExtensionB/Index.cshtml @@ -19,6 +19,6 @@

    This line is red because of the rule in CSS-file added as resource (from Extension A).

    So any extension can use resources from any other extension.

    -

    * Precompiled views support has been suspended in ASP.NET Core 1.0 RTM.

    +

    * Precompiled views support has been suspended in ASP.NET Core 1.0 RC2.

    \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/project.json b/src/WebApplication.ExtensionB/project.json index ebd75b0..fb9e2f8 100644 --- a/src/WebApplication.ExtensionB/project.json +++ b/src/WebApplication.ExtensionB/project.json @@ -2,10 +2,12 @@ "authors": [ "Dmitry Sikorsky" ], "buildOptions": { "embed": [ "Views/**" ] }, "dependencies": { - "ExtCore.Infrastructure": "1.0.0-alpha901", + "ExtCore.Data.Abstractions": "1.0.0-alpha9", + "ExtCore.Infrastructure": "1.0.0-alpha9", "Microsoft.AspNetCore.Mvc": "1.0.0", "NETStandard.Library": "1.6.0", - "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0" + "WebApplication.ExtensionB.Data.Abstractions": "1.0.0", + "WebApplication.ExtensionB.Data.Models": "1.0.0" }, "frameworks": { "netstandard1.6": { diff --git a/src/WebApplication.NLog/NLog.cs b/src/WebApplication.NLog/NLog.cs deleted file mode 100644 index 1321c38..0000000 --- a/src/WebApplication.NLog/NLog.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using ExtCore.Infrastructure; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using NLog.Web; -using NLog.Extensions.Logging; - -namespace WebApplication.NLog -{ - public class NLog : IExtension - { - private IConfigurationRoot configurationRoot; - - public string Name - { - get - { - return "Extension NLog"; - } - } - - public IDictionary> RouteRegistrarsByPriorities - { - get - { - return null; - } - } - - public int ConfigureServicesPriorities - { - get - { - return 100; - } - } - public int ConfigurePriorities - { - get - { - return 100; - } - } - public void SetConfigurationRoot(IConfigurationRoot configurationRoot) - { - this.configurationRoot = configurationRoot; - } - - public void ConfigureServices(IServiceCollection services) - { - services.AddLogging(); - } - - public void Configure(IApplicationBuilder app) - { - var loggerFactory = app.ApplicationServices.GetService(); - var env = app.ApplicationServices.GetService(); - - //add NLog to ASP.NET Core - loggerFactory.AddNLog(); - - //add NLog.Web - app.AddNLogWeb(); - //needed for non-NETSTANDARD platforms: configure nlog.config in your project root - //env.ConfigureNLog("nlog.config"); - loggerFactory.AddConsole(); - } - } -} \ No newline at end of file diff --git a/src/WebApplication.NLog/Properties/AssemblyInfo.cs b/src/WebApplication.NLog/Properties/AssemblyInfo.cs deleted file mode 100644 index 609930a..0000000 --- a/src/WebApplication.NLog/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,19 +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: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("WebApplication.NLog")] -[assembly: AssemblyTrademark("")] - -// 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("9e4b65ab-3f34-4c81-b02d-8e5643d2b3b9")] diff --git a/src/WebApplication.NLog/WebApplication.NLog.xproj b/src/WebApplication.NLog/WebApplication.NLog.xproj deleted file mode 100644 index abf2298..0000000 --- a/src/WebApplication.NLog/WebApplication.NLog.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - 9e4b65ab-3f34-4c81-b02d-8e5643d2b3b9 - WebApplication.NLog - .\obj - .\bin\ - v4.6.1 - - - - 2.0 - - - diff --git a/src/WebApplication.NLog/project.json b/src/WebApplication.NLog/project.json deleted file mode 100644 index c6f5370..0000000 --- a/src/WebApplication.NLog/project.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "ExtCore.Infrastructure": "1.0.0-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.0", - "NETStandard.Library": "1.6.0", - "Microsoft.Extensions.Logging": "1.0.0", - "Microsoft.Extensions.Logging.Console": "1.0.0", - "Microsoft.Extensions.Logging.Debug": "1.0.0", - "NLog.Extensions.Logging": "1.0.0-rtm-alpha2", - "NLog.Web.AspNetCore": "4.2.4" - }, - - "frameworks": { - "netstandard1.6": { - "imports": [ - "dotnet5.6", - "dnxcore50", - "portable-net45+win8" - ] - } - } -} diff --git a/src/WebApplication.Swagger/Properties/AssemblyInfo.cs b/src/WebApplication.Swagger/Properties/AssemblyInfo.cs deleted file mode 100644 index 402d27a..0000000 --- a/src/WebApplication.Swagger/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,19 +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: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("WebApplication.Swagger")] -[assembly: AssemblyTrademark("")] - -// 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("95e5595e-410b-4a6d-8822-4c07fdc3cf21")] diff --git a/src/WebApplication.Swagger/Swagger.cs b/src/WebApplication.Swagger/Swagger.cs deleted file mode 100644 index 162f971..0000000 --- a/src/WebApplication.Swagger/Swagger.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using ExtCore.Infrastructure; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Swashbuckle.Swagger.Model; - - -namespace WebApplication.Swagger -{ - public class Swagger : IExtension - { - private IConfigurationRoot configurationRoot; - - public string Name - { - get - { - return "Extension Swagger"; - } - } - - public IDictionary> RouteRegistrarsByPriorities - { - get - { - Dictionary> routeRegistrarsByPriorities = new Dictionary>(); - - routeRegistrarsByPriorities.Add( - 9000, - routeBuilder => - { - routeBuilder.MapRoute(name: "Extension Swagger", template: "{controller=Home}/{action=Index}/{id?}"); - } - ); - - return routeRegistrarsByPriorities; - } - } - - public int ConfigureServicesPriorities - { - get - { - return 300; - } - } - public int ConfigurePriorities - { - get - { - return 9000; - } - } - public void SetConfigurationRoot(IConfigurationRoot configurationRoot) - { - this.configurationRoot = configurationRoot; - } - - - public void ConfigureServices(IServiceCollection services) - { - //var pathToDoc = this.configurationRoot["Swagger:Path"]; - services.AddSwaggerGen(); - services.ConfigureSwaggerGen(options => - { - options.SingleApiVersion(new Info - { - Version = "v1", - Title = "Geo Search API", - Description = "A simple api to search using geo location in Elasticsearch", - TermsOfService = "None" - }); - //options.IncludeXmlComments(pathToDoc); - options.DescribeAllEnumsAsStrings(); - }); - } - - public void Configure(IApplicationBuilder applicationBuilder) - { - applicationBuilder.UseSwagger(); - applicationBuilder.UseSwaggerUi(); - } - } -} \ No newline at end of file diff --git a/src/WebApplication.Swagger/WebApplication.Swagger.xproj b/src/WebApplication.Swagger/WebApplication.Swagger.xproj deleted file mode 100644 index 7af6b7d..0000000 --- a/src/WebApplication.Swagger/WebApplication.Swagger.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - 95e5595e-410b-4a6d-8822-4c07fdc3cf21 - WebApplication.Swagger - .\obj - .\bin\ - v4.6.1 - - - - 2.0 - - - diff --git a/src/WebApplication.Swagger/project.json b/src/WebApplication.Swagger/project.json deleted file mode 100644 index 3ec61ca..0000000 --- a/src/WebApplication.Swagger/project.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "ExtCore.Infrastructure": "1.0.0-alpha901", - "NETStandard.Library": "1.6.0", - "Microsoft.AspNetCore.Mvc": "1.0.0", - "Swashbuckle": "6.0.0-beta901", - "Swashbuckle.Swagger": "6.0.0-beta901" - }, - - "frameworks": { - "netstandard1.6": { - "imports": [ - "dotnet5.6", - "dnxcore50", - "portable-net45+win8" - ] - } - } -} diff --git a/src/WebApplication.WebAPI/Controllers/ItemsController.cs b/src/WebApplication.WebAPI/Controllers/ItemsController.cs deleted file mode 100644 index 02021e7..0000000 --- a/src/WebApplication.WebAPI/Controllers/ItemsController.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright © 2015 Dmitry Sikorsky. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNetCore.Mvc; -using WebApplication.WebAPI.Models; - -namespace WebApplication.WebAPI.Controllers -{ - [Route("api/[controller]")] - public class ItemsController : Controller - { - private IItemRepository _itemRepository { get; set; } - - public ItemsController(IItemRepository itemRepository) - { - _itemRepository = itemRepository; - } - - [HttpGet] - public IActionResult Get() - { - return Ok(_itemRepository.All()); - } - [HttpGet("{id}")] - public IActionResult Get(long id) - { - return Ok(_itemRepository.Find(id)); - } - [HttpPost] - public void Post([FromBody]Item value) - { - _itemRepository.Add(value); - } - [HttpPut("{id}")] - public void Put(long id, [FromBody]Item value) - { - _itemRepository.Update(id, value); - } - [HttpDelete("{id}")] - public void Delete(long id) - { - _itemRepository.Delete(id); - } - } -} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Models/IItemRepository.cs b/src/WebApplication.WebAPI/Models/IItemRepository.cs deleted file mode 100644 index 41a1689..0000000 --- a/src/WebApplication.WebAPI/Models/IItemRepository.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright © 2015 Dmitry Sikorsky. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -namespace WebApplication.WebAPI.Models -{ - public interface IItemRepository - { - IEnumerable All(); - Item Find(long id); - void Add(Item value); - void Update(long id, Item value); - void Delete(long id); - } -} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Models/Item.cs b/src/WebApplication.WebAPI/Models/Item.cs deleted file mode 100644 index 31b9813..0000000 --- a/src/WebApplication.WebAPI/Models/Item.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright © 2015 Dmitry Sikorsky. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace WebApplication.WebAPI.Models -{ - public class Item - { - public int Id { get; set; } - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Models/ItemDbContext.cs b/src/WebApplication.WebAPI/Models/ItemDbContext.cs deleted file mode 100644 index 401a332..0000000 --- a/src/WebApplication.WebAPI/Models/ItemDbContext.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright © 2015 Dmitry Sikorsky. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.EntityFrameworkCore; - -namespace WebApplication.WebAPI.Models -{ - public class ItemDbContext : DbContext - { - public ItemDbContext(DbContextOptions options) :base(options) - { } - public DbSet Items { get; set; } - public void OnModelCreating(ModelBuilder builder) - { - builder.Entity().HasKey(m => m.Id); - base.OnModelCreating(builder); - } - } -} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Models/ItemRepository.cs b/src/WebApplication.WebAPI/Models/ItemRepository.cs deleted file mode 100644 index 869666d..0000000 --- a/src/WebApplication.WebAPI/Models/ItemRepository.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright © 2015 Dmitry Sikorsky. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; - -namespace WebApplication.WebAPI.Models -{ - public class ItemRepository : IItemRepository - { - private ItemDbContext _itemDbContext { get; set; } - public ItemRepository(ItemDbContext itemDbContext) - { - _itemDbContext = itemDbContext; - } - public IEnumerable All() - { - return _itemDbContext.Items.OrderBy(i => i.Name); - } - public Item Find(long id) - { - return _itemDbContext.Items.Where(i => i.Id == id).First(); - } - public void Add(Item value) - { - _itemDbContext.Items.Add(value); - _itemDbContext.SaveChanges(); - return; - } - public void Update(long id, Item value) - { - _itemDbContext.Items.Update(value); - _itemDbContext.SaveChanges(); - return; - } - public void Delete(long id) - { - var value =_itemDbContext.Items.Where(i => i.Id == id).First(); - _itemDbContext.Items.Remove(value); - _itemDbContext.SaveChanges(); - return; - } - } -} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Properties/AssemblyInfo.cs b/src/WebApplication.WebAPI/Properties/AssemblyInfo.cs deleted file mode 100644 index 881bd64..0000000 --- a/src/WebApplication.WebAPI/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,19 +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: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("WebApplication.WebAPI")] -[assembly: AssemblyTrademark("")] - -// 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("7de66111-bbb6-4c93-b864-9e65cafd505b")] diff --git a/src/WebApplication.WebAPI/WebAPI.cs b/src/WebApplication.WebAPI/WebAPI.cs deleted file mode 100644 index 3cf3a9e..0000000 --- a/src/WebApplication.WebAPI/WebAPI.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using ExtCore.Infrastructure; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.EntityFrameworkCore; -using WebApplication.WebAPI.Models; - -namespace WebApplication.WebAPI -{ - public class WebAPI : IExtension - { - private IConfigurationRoot configurationRoot; - - public string Name - { - get - { - return "Extension WebAPI"; - } - } - - public IDictionary> RouteRegistrarsByPriorities - { - get - { - Dictionary> routeRegistrarsByPriorities = new Dictionary>(); - - routeRegistrarsByPriorities.Add( - 2000, - routeBuilder => - { - routeBuilder.MapRoute(name: "Extension WebAPI", template: "{controller=Home}/{action=Index}/{id?}"); - } - ); - - return routeRegistrarsByPriorities; - } - } - - - public int ConfigureServicesPriorities - { - get - { - return 2001; - } - } - public int ConfigurePriorities - { - get - { - return 2001; - } - } - public void SetConfigurationRoot(IConfigurationRoot configurationRoot) - { - this.configurationRoot = configurationRoot; - } - - public void ConfigureServices(IServiceCollection services) - { - services.AddEntityFrameworkSqlite(); - services.AddDbContext(options => - { - options.UseSqlite(this.configurationRoot["Data:DefaultConnection:ConnectionString"]); - }); - services.AddScoped(); - } - - public void Configure(IApplicationBuilder applicationBuilder) - { - } - } -} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/WebApplication.WebAPI.xproj b/src/WebApplication.WebAPI/WebApplication.WebAPI.xproj deleted file mode 100644 index 9f3c301..0000000 --- a/src/WebApplication.WebAPI/WebApplication.WebAPI.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - 7de66111-bbb6-4c93-b864-9e65cafd505b - WebApplication.WebAPI - .\obj - .\bin\ - v4.6.1 - - - - 2.0 - - - diff --git a/src/WebApplication.WebAPI/project.json b/src/WebApplication.WebAPI/project.json deleted file mode 100644 index 87fe16f..0000000 --- a/src/WebApplication.WebAPI/project.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "NETStandard.Library": "1.6.0", - "ExtCore.Infrastructure": "1.0.0-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.0", - "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0" - }, - - "frameworks": { - "netstandard1.6": { - "imports": "dnxcore50" - } - } -} diff --git a/src/WebApplication/gulpfile.js b/src/WebApplication/gulpfile.js index c1f75df..7aefd59 100644 --- a/src/WebApplication/gulpfile.js +++ b/src/WebApplication/gulpfile.js @@ -2,12 +2,11 @@ gulp.task( "copy-extensions", function (cb) { - gulp.src(["../WebApplication.NLog/bin/Debug/netstandard1.6/WebApplication.NLog.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.Elm/bin/Debug/netstandard1.6/WebApplication.Elm.dll"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.ExtensionA/bin/Debug/netstandard1.6/WebApplication.ExtensionA.dll"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.ExtensionB/bin/Debug/netstandard1.6/WebApplication.ExtensionB.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.Swagger/bin/Debug/netstandard1.6/WebApplication.Swagger.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.WebAPI/bin/Debug/netstandard1.6/WebApplication.WebAPI.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.ExtensionB.Data.Abstractions/bin/Debug/netstandard1.6/WebApplication.ExtensionB.Data.Abstractions.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.ExtensionB.Data.EntityFramework.Sqlite/bin/Debug/netstandard1.6/WebApplication.ExtensionB.Data.EntityFramework.Sqlite.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.ExtensionB.Data.Models/bin/Debug/netstandard1.6/WebApplication.ExtensionB.Data.Models.dll"]).pipe(gulp.dest("Extensions")); cb(); } ); \ No newline at end of file diff --git a/src/WebApplication/nlog.config b/src/WebApplication/nlog.config deleted file mode 100644 index 53ac823..0000000 --- a/src/WebApplication/nlog.config +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/WebApplication/project.json b/src/WebApplication/project.json index c148096..117e652 100644 --- a/src/WebApplication/project.json +++ b/src/WebApplication/project.json @@ -7,8 +7,10 @@ "preserveCompilationContext": true }, "dependencies": { - "ExtCore.Infrastructure": "1.0.0-alpha901", - "ExtCore.WebApplication": "1.0.0-alpha901", + "ExtCore.Data": "1.0.0-alpha9", + "ExtCore.Data.EntityFramework.Sqlite": "1.0.0-alpha9", + "ExtCore.Infrastructure": "1.0.0-alpha9", + "ExtCore.WebApplication": "1.0.0-alpha9", "Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", @@ -18,18 +20,7 @@ "version": "1.0.0", "type": "platform" }, - "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0", - "Microsoft.Extensions.Logging": "1.0.0", - "Microsoft.Extensions.Logging.Console": "1.0.0", - "Microsoft.Extensions.Logging.Debug": "1.0.0", - "NLog.Extensions.Logging": "1.0.0-rtm-alpha2", - "NLog.Web.AspNetCore": "4.2.4", - "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0", - "NETStandard.Library": "1.6.0", - "Microsoft.AspNetCore.Mvc": "1.0.0", - "Microsoft.AspNetCore.Diagnostics.Elm": "0.1.0", - "Swashbuckle": "6.0.0-beta901", - "Swashbuckle.Swagger": "6.0.0-beta901" + "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0" }, "frameworks": { "netcoreapp1.0": { @@ -45,8 +36,7 @@ "Views", "wwwroot", "config.json", - "web.config", - "nlog.config" + "web.config" ] }, "runtimeOptions": { From 7bdba620f8cef845a65764d1dccacd35d5f546fd Mon Sep 17 00:00:00 2001 From: USER001 F Date: Mon, 11 Jul 2016 23:23:32 +0900 Subject: [PATCH 03/18] delete --- .gitignore | 4 +- NuGet.config | 10 ++ WebApplication.sln | 57 +++++++---- src/WebApplication.Elm/Elm.cs | 93 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | 19 ++++ .../WebApplication.Elm.xproj} | 10 +- src/WebApplication.Elm/project.json | 17 ++++ src/WebApplication.ExtensionA/ExtensionA.cs | 88 ++++++++++------- .../Views/ExtensionA/Index.cshtml | 2 + src/WebApplication.ExtensionA/project.json | 2 +- .../IItemRepository.cs | 14 --- .../project.json | 19 ---- .../ItemRepository.cs | 19 ---- .../ModelRegistrar.cs | 23 ----- .../project.json | 21 ---- .../Item.cs | 13 --- .../project.json | 18 ---- .../Controllers/ExtensionBController.cs | 25 +++-- src/WebApplication.ExtensionB/ExtensionB.cs | 97 ++++++++++++------- .../Models/IItemRepository.cs | 11 +++ src/WebApplication.ExtensionB/Models/Item.cs | 11 +++ .../Models/ItemDbContext.cs | 19 ++++ .../Models/ItemRepository.cs | 21 ++++ .../ExtensionB/Index/IndexViewModelBuilder.cs | 18 ++-- .../ViewModels/Shared/ItemViewModelBuilder.cs | 18 ++-- .../Views/ExtensionB/Index.cshtml | 2 +- src/WebApplication.ExtensionB/project.json | 6 +- src/WebApplication.NLog/NLog.cs | 76 +++++++++++++++ .../Properties/AssemblyInfo.cs | 19 ++++ .../WebApplication.NLog.xproj} | 10 +- src/WebApplication.NLog/project.json | 24 +++++ .../Properties/AssemblyInfo.cs | 19 ++++ src/WebApplication.Swagger/Swagger.cs | 90 +++++++++++++++++ .../WebApplication.Swagger.xproj} | 10 +- src/WebApplication.Swagger/project.json | 21 ++++ .../Controllers/ItemsController.cs | 45 +++++++++ .../Models/IItemRepository.cs | 15 +++ src/WebApplication.WebAPI/Models/Item.cs | 11 +++ .../Models/ItemDbContext.cs | 19 ++++ .../Models/ItemRepository.cs | 44 +++++++++ .../Properties/AssemblyInfo.cs | 19 ++++ src/WebApplication.WebAPI/WebAPI.cs | 79 +++++++++++++++ .../WebApplication.WebAPI.xproj | 21 ++++ src/WebApplication.WebAPI/project.json | 16 +++ src/WebApplication/gulpfile.js | 7 +- src/WebApplication/nlog.config | 32 ++++++ src/WebApplication/project.json | 22 +++-- 47 files changed, 977 insertions(+), 279 deletions(-) create mode 100644 NuGet.config create mode 100644 src/WebApplication.Elm/Elm.cs create mode 100644 src/WebApplication.Elm/Properties/AssemblyInfo.cs rename src/{WebApplication.ExtensionB.Data.Models/WebApplication.ExtensionB.Data.Models.xproj => WebApplication.Elm/WebApplication.Elm.xproj} (82%) create mode 100644 src/WebApplication.Elm/project.json delete mode 100644 src/WebApplication.ExtensionB.Data.Abstractions/IItemRepository.cs delete mode 100644 src/WebApplication.ExtensionB.Data.Abstractions/project.json delete mode 100644 src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/ItemRepository.cs delete mode 100644 src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/ModelRegistrar.cs delete mode 100644 src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/project.json delete mode 100644 src/WebApplication.ExtensionB.Data.Models/Item.cs delete mode 100644 src/WebApplication.ExtensionB.Data.Models/project.json create mode 100644 src/WebApplication.ExtensionB/Models/IItemRepository.cs create mode 100644 src/WebApplication.ExtensionB/Models/Item.cs create mode 100644 src/WebApplication.ExtensionB/Models/ItemDbContext.cs create mode 100644 src/WebApplication.ExtensionB/Models/ItemRepository.cs create mode 100644 src/WebApplication.NLog/NLog.cs create mode 100644 src/WebApplication.NLog/Properties/AssemblyInfo.cs rename src/{WebApplication.ExtensionB.Data.EntityFramework.Sqlite/WebApplication.ExtensionB.Data.EntityFramework.Sqlite.xproj => WebApplication.NLog/WebApplication.NLog.xproj} (82%) create mode 100644 src/WebApplication.NLog/project.json create mode 100644 src/WebApplication.Swagger/Properties/AssemblyInfo.cs create mode 100644 src/WebApplication.Swagger/Swagger.cs rename src/{WebApplication.ExtensionB.Data.Abstractions/WebApplication.ExtensionB.Data.Abstractions.xproj => WebApplication.Swagger/WebApplication.Swagger.xproj} (81%) create mode 100644 src/WebApplication.Swagger/project.json create mode 100644 src/WebApplication.WebAPI/Controllers/ItemsController.cs create mode 100644 src/WebApplication.WebAPI/Models/IItemRepository.cs create mode 100644 src/WebApplication.WebAPI/Models/Item.cs create mode 100644 src/WebApplication.WebAPI/Models/ItemDbContext.cs create mode 100644 src/WebApplication.WebAPI/Models/ItemRepository.cs create mode 100644 src/WebApplication.WebAPI/Properties/AssemblyInfo.cs create mode 100644 src/WebApplication.WebAPI/WebAPI.cs create mode 100644 src/WebApplication.WebAPI/WebApplication.WebAPI.xproj create mode 100644 src/WebApplication.WebAPI/project.json create mode 100644 src/WebApplication/nlog.config diff --git a/.gitignore b/.gitignore index cbb98db..9aefda2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ bin/ obj/ src/WebApplication/node_modules/ *.xproj.user -*.lock.json \ No newline at end of file +*.lock.json +*.dll +*.log \ No newline at end of file diff --git a/NuGet.config b/NuGet.config new file mode 100644 index 0000000..590be3b --- /dev/null +++ b/NuGet.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/WebApplication.sln b/WebApplication.sln index 7b3ff39..496c336 100644 --- a/WebApplication.sln +++ b/WebApplication.sln @@ -18,13 +18,23 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExtensionA", "ExtensionA", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExtensionB", "ExtensionB", "{4EA56716-702B-485A-A23A-10E110A85D78}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionB.Data.Models", "src\WebApplication.ExtensionB.Data.Models\WebApplication.ExtensionB.Data.Models.xproj", "{6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionB", "src\WebApplication.ExtensionB\WebApplication.ExtensionB.xproj", "{396A8530-C500-469E-9F6F-A2D9C286C47D}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionB.Data.Abstractions", "src\WebApplication.ExtensionB.Data.Abstractions\WebApplication.ExtensionB.Data.Abstractions.xproj", "{922E22BD-10F8-4261-9ACC-9CD10A4C8147}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NLog", "NLog", "{511BD310-4C03-407B-92EA-34110884C547}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.NLog", "src\WebApplication.NLog\WebApplication.NLog.xproj", "{9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Swagger", "Swagger", "{8327C820-20D1-4095-8771-E03613D1969F}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.Swagger", "src\WebApplication.Swagger\WebApplication.Swagger.xproj", "{95E5595E-410B-4A6D-8822-4C07FDC3CF21}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebAPI", "WebAPI", "{FDEA400A-7F71-4A17-8419-030D80F74A3F}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.WebAPI", "src\WebApplication.WebAPI\WebApplication.WebAPI.xproj", "{7DE66111-BBB6-4C93-B864-9E65CAFD505B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Elm", "Elm", "{C49636B1-231E-45A2-8901-10EC68C7CB55}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionB.Data.EntityFramework.Sqlite", "src\WebApplication.ExtensionB.Data.EntityFramework.Sqlite\WebApplication.ExtensionB.Data.EntityFramework.Sqlite.xproj", "{AF7B3C14-BC6E-4964-BD0B-5233428349B6}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.Elm", "src\WebApplication.Elm\WebApplication.Elm.xproj", "{A5C5400D-DD78-4192-B34B-06D81996F0DA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -40,22 +50,26 @@ Global {8D722841-4E2C-4673-A7CC-C2690EFE3915}.Debug|Any CPU.Build.0 = Debug|Any CPU {8D722841-4E2C-4673-A7CC-C2690EFE3915}.Release|Any CPU.ActiveCfg = Release|Any CPU {8D722841-4E2C-4673-A7CC-C2690EFE3915}.Release|Any CPU.Build.0 = Release|Any CPU - {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF}.Release|Any CPU.Build.0 = Release|Any CPU {396A8530-C500-469E-9F6F-A2D9C286C47D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {396A8530-C500-469E-9F6F-A2D9C286C47D}.Debug|Any CPU.Build.0 = Debug|Any CPU {396A8530-C500-469E-9F6F-A2D9C286C47D}.Release|Any CPU.ActiveCfg = Release|Any CPU {396A8530-C500-469E-9F6F-A2D9C286C47D}.Release|Any CPU.Build.0 = Release|Any CPU - {922E22BD-10F8-4261-9ACC-9CD10A4C8147}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {922E22BD-10F8-4261-9ACC-9CD10A4C8147}.Debug|Any CPU.Build.0 = Debug|Any CPU - {922E22BD-10F8-4261-9ACC-9CD10A4C8147}.Release|Any CPU.ActiveCfg = Release|Any CPU - {922E22BD-10F8-4261-9ACC-9CD10A4C8147}.Release|Any CPU.Build.0 = Release|Any CPU - {AF7B3C14-BC6E-4964-BD0B-5233428349B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AF7B3C14-BC6E-4964-BD0B-5233428349B6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AF7B3C14-BC6E-4964-BD0B-5233428349B6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AF7B3C14-BC6E-4964-BD0B-5233428349B6}.Release|Any CPU.Build.0 = Release|Any CPU + {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}.Release|Any CPU.Build.0 = Release|Any CPU + {95E5595E-410B-4A6D-8822-4C07FDC3CF21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95E5595E-410B-4A6D-8822-4C07FDC3CF21}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95E5595E-410B-4A6D-8822-4C07FDC3CF21}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95E5595E-410B-4A6D-8822-4C07FDC3CF21}.Release|Any CPU.Build.0 = Release|Any CPU + {7DE66111-BBB6-4C93-B864-9E65CAFD505B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7DE66111-BBB6-4C93-B864-9E65CAFD505B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7DE66111-BBB6-4C93-B864-9E65CAFD505B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7DE66111-BBB6-4C93-B864-9E65CAFD505B}.Release|Any CPU.Build.0 = Release|Any CPU + {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -65,9 +79,14 @@ Global {8D722841-4E2C-4673-A7CC-C2690EFE3915} = {F92B44CF-63EE-4781-8244-48ACC5386A8C} {F92B44CF-63EE-4781-8244-48ACC5386A8C} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} {4EA56716-702B-485A-A23A-10E110A85D78} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} - {6EB08C04-9CA2-48B7-9404-3188AFA3E2DF} = {4EA56716-702B-485A-A23A-10E110A85D78} {396A8530-C500-469E-9F6F-A2D9C286C47D} = {4EA56716-702B-485A-A23A-10E110A85D78} - {922E22BD-10F8-4261-9ACC-9CD10A4C8147} = {4EA56716-702B-485A-A23A-10E110A85D78} - {AF7B3C14-BC6E-4964-BD0B-5233428349B6} = {4EA56716-702B-485A-A23A-10E110A85D78} + {511BD310-4C03-407B-92EA-34110884C547} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9} = {511BD310-4C03-407B-92EA-34110884C547} + {8327C820-20D1-4095-8771-E03613D1969F} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {95E5595E-410B-4A6D-8822-4C07FDC3CF21} = {8327C820-20D1-4095-8771-E03613D1969F} + {FDEA400A-7F71-4A17-8419-030D80F74A3F} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {7DE66111-BBB6-4C93-B864-9E65CAFD505B} = {FDEA400A-7F71-4A17-8419-030D80F74A3F} + {C49636B1-231E-45A2-8901-10EC68C7CB55} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {A5C5400D-DD78-4192-B34B-06D81996F0DA} = {C49636B1-231E-45A2-8901-10EC68C7CB55} EndGlobalSection EndGlobal diff --git a/src/WebApplication.Elm/Elm.cs b/src/WebApplication.Elm/Elm.cs new file mode 100644 index 0000000..6b75fbc --- /dev/null +++ b/src/WebApplication.Elm/Elm.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ExtCore.Infrastructure; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Logging; + +namespace WebApplication.Elm +{ + public class Elm : IExtension + { + private IConfigurationRoot configurationRoot; + + public string Name + { + get + { + return "Extension Elm"; + } + } + + public IDictionary> RouteRegistrarsByPriorities + { + get + { + return null; + } + } + + + public int ConfigureServicesPriorities + { + get + { + return 100; + } + } + public int ConfigurePriorities + { + get + { + return 100; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + public void ConfigureServices(IServiceCollection services) + { + services.AddElm(options => + { + options.Path = new PathString("/Elm"); // defaults to "/Elm" + options.Filter = (name, level) => level >= LogLevel.Information; + }); + } + + public void Configure(IApplicationBuilder app) + { + app.UseElmPage(); // Shows the logs at the specified path + app.UseElmCapture(); // Adds the ElmLoggerProvider + var factory = app.ApplicationServices.GetService(); + var logger = factory.CreateLogger(); + using (logger.BeginScope("startup")) + { + logger.LogWarning("Starting up"); + } + + /*app.Run(async context => + { + await context.Response.WriteAsync("Hello world"); + using (logger.BeginScope("world")) + { + logger.LogInformation("Hello world!"); + logger.LogError("Mort"); + } + // This will not get logged because the filter has been set to LogLevel.Information and above + using (logger.BeginScope("debug")) + { + logger.LogDebug("some debug stuff"); + } + });*/ + logger.LogInformation("This message is not in a scope"); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.Elm/Properties/AssemblyInfo.cs b/src/WebApplication.Elm/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1052743 --- /dev/null +++ b/src/WebApplication.Elm/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +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: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebApplication.Elm")] +[assembly: AssemblyTrademark("")] + +// 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("a5c5400d-dd78-4192-b34b-06d81996f0da")] diff --git a/src/WebApplication.ExtensionB.Data.Models/WebApplication.ExtensionB.Data.Models.xproj b/src/WebApplication.Elm/WebApplication.Elm.xproj similarity index 82% rename from src/WebApplication.ExtensionB.Data.Models/WebApplication.ExtensionB.Data.Models.xproj rename to src/WebApplication.Elm/WebApplication.Elm.xproj index f8f547d..0031b3c 100644 --- a/src/WebApplication.ExtensionB.Data.Models/WebApplication.ExtensionB.Data.Models.xproj +++ b/src/WebApplication.Elm/WebApplication.Elm.xproj @@ -4,16 +4,18 @@ 14.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + - 6eb08c04-9ca2-48b7-9404-3188afa3e2df - WebApplication.ExtensionB.Data.Models + a5c5400d-dd78-4192-b34b-06d81996f0da + WebApplication.Elm .\obj .\bin\ - v4.6.1 + v4.6.1 + 2.0 - \ No newline at end of file + diff --git a/src/WebApplication.Elm/project.json b/src/WebApplication.Elm/project.json new file mode 100644 index 0000000..ed3341a --- /dev/null +++ b/src/WebApplication.Elm/project.json @@ -0,0 +1,17 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "NETStandard.Library": "1.6.0", + "ExtCore.Infrastructure": "1.0.0-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.0", + "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", + "Microsoft.AspNetCore.Diagnostics.Elm": "0.1.0" + }, + + "frameworks": { + "netstandard1.6": { + "imports": "dnxcore50" + } + } +} \ No newline at end of file diff --git a/src/WebApplication.ExtensionA/ExtensionA.cs b/src/WebApplication.ExtensionA/ExtensionA.cs index e583ddb..8116d77 100644 --- a/src/WebApplication.ExtensionA/ExtensionA.cs +++ b/src/WebApplication.ExtensionA/ExtensionA.cs @@ -11,47 +11,61 @@ namespace WebApplication.ExtensionA { - public class ExtensionA : IExtension - { - private IConfigurationRoot configurationRoot; - - public string Name + public class ExtensionA : IExtension { - get - { - return "Extension A"; - } - } + private IConfigurationRoot configurationRoot; - public IDictionary> RouteRegistrarsByPriorities - { - get - { - Dictionary> routeRegistrarsByPriorities = new Dictionary>(); - - routeRegistrarsByPriorities.Add( - 1000, - routeBuilder => - { - routeBuilder.MapRoute(name: "Extension A", template: "", defaults: new { controller = "ExtensionA", action = "Index" }); - } - ); - - return routeRegistrarsByPriorities; - } - } + public string Name + { + get + { + return "Extension A"; + } + } - public void SetConfigurationRoot(IConfigurationRoot configurationRoot) - { - this.configurationRoot = configurationRoot; - } + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); - public void ConfigureServices(IServiceCollection services) - { - } + routeRegistrarsByPriorities.Add( + 2500, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension A", template: "", defaults: new { controller = "ExtensionA", action = "Index" }); + } + ); - public void Configure(IApplicationBuilder applicationBuilder) - { + return routeRegistrarsByPriorities; + } + } + + public int ConfigureServicesPriorities + { + get + { + return 1000; + } + } + public int ConfigurePriorities + { + get + { + return 1000; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + public void ConfigureServices(IServiceCollection services) + { + } + + public void Configure(IApplicationBuilder applicationBuilder) + { + } } - } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionA/Views/ExtensionA/Index.cshtml b/src/WebApplication.ExtensionA/Views/ExtensionA/Index.cshtml index 1716286..c6212ae 100644 --- a/src/WebApplication.ExtensionA/Views/ExtensionA/Index.cshtml +++ b/src/WebApplication.ExtensionA/Views/ExtensionA/Index.cshtml @@ -18,6 +18,8 @@
  • @item
  • } +

    Go to Swagger

    Go to Extension B

    +

    Go to Elm

    \ No newline at end of file diff --git a/src/WebApplication.ExtensionA/project.json b/src/WebApplication.ExtensionA/project.json index 1c7c60e..29b1708 100644 --- a/src/WebApplication.ExtensionA/project.json +++ b/src/WebApplication.ExtensionA/project.json @@ -2,7 +2,7 @@ "authors": [ "Dmitry Sikorsky" ], "buildOptions": { "embed": [ "Styles/**", "Views/**" ] }, "dependencies": { - "ExtCore.Infrastructure": "1.0.0-alpha9", + "ExtCore.Infrastructure": "1.0.0-alpha901", "Microsoft.AspNetCore.Mvc": "1.0.0", "NETStandard.Library": "1.6.0" }, diff --git a/src/WebApplication.ExtensionB.Data.Abstractions/IItemRepository.cs b/src/WebApplication.ExtensionB.Data.Abstractions/IItemRepository.cs deleted file mode 100644 index aca9e36..0000000 --- a/src/WebApplication.ExtensionB.Data.Abstractions/IItemRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright © 2015 Dmitry Sikorsky. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using ExtCore.Data.Abstractions; -using WebApplication.ExtensionB.Data.Models; - -namespace WebApplication.ExtensionB.Data.Abstractions -{ - public interface IItemRepository : IRepository - { - IEnumerable All(); - } -} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB.Data.Abstractions/project.json b/src/WebApplication.ExtensionB.Data.Abstractions/project.json deleted file mode 100644 index dd40227..0000000 --- a/src/WebApplication.ExtensionB.Data.Abstractions/project.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "authors": [ "Dmitry Sikorsky" ], - "dependencies": { - "ExtCore.Data.Abstractions": "1.0.0-alpha9", - "ExtCore.Infrastructure": "1.0.0-alpha9", - "NETStandard.Library": "1.6.0", - "WebApplication.ExtensionB.Data.Models": "1.0.0" - }, - "frameworks": { - "netstandard1.6": { - "imports": [ - "dotnet5.6", - "dnxcore50", - "portable-net45+win8" - ] - } - }, - "version": "1.0.0-*" -} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/ItemRepository.cs b/src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/ItemRepository.cs deleted file mode 100644 index 2953df9..0000000 --- a/src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/ItemRepository.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright © 2015 Dmitry Sikorsky. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using ExtCore.Data.EntityFramework.Sqlite; -using WebApplication.ExtensionB.Data.Abstractions; -using WebApplication.ExtensionB.Data.Models; - -namespace WebApplication.ExtensionB.Data.EntityFramework.Sqlite -{ - public class ItemRepository : RepositoryBase, IItemRepository - { - public IEnumerable All() - { - return this.dbSet.OrderBy(i => i.Name); - } - } -} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/ModelRegistrar.cs b/src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/ModelRegistrar.cs deleted file mode 100644 index 14ca9c2..0000000 --- a/src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/ModelRegistrar.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright © 2015 Dmitry Sikorsky. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using ExtCore.Data.EntityFramework.Sqlite; -using Microsoft.EntityFrameworkCore; -using WebApplication.ExtensionB.Data.Models; - -namespace WebApplication.ExtensionB.Data.EntityFramework.Sqlite -{ - public class ModelRegistrar : IModelRegistrar - { - public void RegisterModels(ModelBuilder modelbuilder) - { - modelbuilder.Entity(etb => - { - etb.HasKey(e => e.Id); - etb.Property(e => e.Id); - etb.ForSqliteToTable("Items"); - } - ); - } - } -} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/project.json b/src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/project.json deleted file mode 100644 index a74454f..0000000 --- a/src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/project.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "authors": [ "Dmitry Sikorsky" ], - "dependencies": { - "ExtCore.Data.EntityFramework.Sqlite": "1.0.0-alpha9", - "ExtCore.Infrastructure": "1.0.0-alpha9", - "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0", - "NETStandard.Library": "1.6.0", - "WebApplication.ExtensionB.Data.Abstractions": "1.0.0", - "WebApplication.ExtensionB.Data.Models": "1.0.0" - }, - "frameworks": { - "netstandard1.6": { - "imports": [ - "dotnet5.6", - "dnxcore50", - "portable-net45+win8" - ] - } - }, - "version": "1.0.0-*" -} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB.Data.Models/Item.cs b/src/WebApplication.ExtensionB.Data.Models/Item.cs deleted file mode 100644 index d497136..0000000 --- a/src/WebApplication.ExtensionB.Data.Models/Item.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright © 2015 Dmitry Sikorsky. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using ExtCore.Data.Models.Abstractions; - -namespace WebApplication.ExtensionB.Data.Models -{ - public class Item : IEntity - { - public int Id { get; set; } - public string Name { get; set; } - } -} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB.Data.Models/project.json b/src/WebApplication.ExtensionB.Data.Models/project.json deleted file mode 100644 index 9fdba56..0000000 --- a/src/WebApplication.ExtensionB.Data.Models/project.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "authors": [ "Dmitry Sikorsky" ], - "dependencies": { - "ExtCore.Data.Models.Abstractions": "1.0.0-alpha9", - "ExtCore.Infrastructure": "1.0.0-alpha9", - "NETStandard.Library": "1.6.0" - }, - "frameworks": { - "netstandard1.6": { - "imports": [ - "dotnet5.6", - "dnxcore50", - "portable-net45+win8" - ] - } - }, - "version": "1.0.0-*" -} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Controllers/ExtensionBController.cs b/src/WebApplication.ExtensionB/Controllers/ExtensionBController.cs index 4606037..33e2aca 100644 --- a/src/WebApplication.ExtensionB/Controllers/ExtensionBController.cs +++ b/src/WebApplication.ExtensionB/Controllers/ExtensionBController.cs @@ -1,25 +1,24 @@ // Copyright © 2015 Dmitry Sikorsky. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using ExtCore.Data.Abstractions; using Microsoft.AspNetCore.Mvc; -using WebApplication.ExtensionB.Data.Abstractions; using WebApplication.ExtensionB.ViewModels.ExtenstionB; +using WebApplication.ExtensionB.Models; namespace WebApplication.ExtensionB.Controllers { - public class ExtensionBController : Controller - { - private IStorage storage; - - public ExtensionBController(IStorage storage) + public class ExtensionBController : Controller { - this.storage = storage; - } + private IItemRepository _itemRepository { get; set; } - public ActionResult Index() - { - return this.View(new IndexViewModelBuilder().Build(this.storage.GetRepository().All())); + public ExtensionBController(IItemRepository itemRepository) + { + _itemRepository = itemRepository; + } + + public ActionResult Index() + { + return this.View(new IndexViewModelBuilder().Build(_itemRepository.All())); + } } - } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/ExtensionB.cs b/src/WebApplication.ExtensionB/ExtensionB.cs index b7f71e4..4f4027b 100644 --- a/src/WebApplication.ExtensionB/ExtensionB.cs +++ b/src/WebApplication.ExtensionB/ExtensionB.cs @@ -8,50 +8,73 @@ using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.EntityFrameworkCore; +using WebApplication.ExtensionB.Models; namespace WebApplication.ExtensionB { - public class ExtensionB : IExtension - { - private IConfigurationRoot configurationRoot; - - public string Name + public class ExtensionB : IExtension { - get - { - return "Extension B"; - } - } + private IConfigurationRoot configurationRoot; - public IDictionary> RouteRegistrarsByPriorities - { - get - { - Dictionary> routeRegistrarsByPriorities = new Dictionary>(); - - routeRegistrarsByPriorities.Add( - 2000, - routeBuilder => - { - routeBuilder.MapRoute(name: "Extension B", template: "extension-b", defaults: new { controller = "ExtensionB", action = "Index" }); - } - ); - - return routeRegistrarsByPriorities; - } - } + public string Name + { + get + { + return "Extension B"; + } + } - public void SetConfigurationRoot(IConfigurationRoot configurationRoot) - { - this.configurationRoot = configurationRoot; - } + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); - public void ConfigureServices(IServiceCollection services) - { - } + routeRegistrarsByPriorities.Add( + 3000, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension B", template: "extension-b", defaults: new { controller = "ExtensionB", action = "Index" }); + } + ); - public void Configure(IApplicationBuilder applicationBuilder) - { + return routeRegistrarsByPriorities; + } + } + + + public int ConfigureServicesPriorities + { + get + { + return 2000; + } + } + public int ConfigurePriorities + { + get + { + return 2000; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + public void ConfigureServices(IServiceCollection services) + { + services.AddEntityFrameworkSqlite(); + services.AddDbContext(options => + { + options.UseSqlite(this.configurationRoot["Data:DefaultConnection:ConnectionString"]); + }); + services.AddScoped(); + } + + public void Configure(IApplicationBuilder applicationBuilder) + { + } } - } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Models/IItemRepository.cs b/src/WebApplication.ExtensionB/Models/IItemRepository.cs new file mode 100644 index 0000000..ffd86fc --- /dev/null +++ b/src/WebApplication.ExtensionB/Models/IItemRepository.cs @@ -0,0 +1,11 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +namespace WebApplication.ExtensionB.Models +{ + public interface IItemRepository + { + IEnumerable All(); + } +} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Models/Item.cs b/src/WebApplication.ExtensionB/Models/Item.cs new file mode 100644 index 0000000..fd3d533 --- /dev/null +++ b/src/WebApplication.ExtensionB/Models/Item.cs @@ -0,0 +1,11 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace WebApplication.ExtensionB.Models +{ + public class Item + { + public int Id { get; set; } + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Models/ItemDbContext.cs b/src/WebApplication.ExtensionB/Models/ItemDbContext.cs new file mode 100644 index 0000000..5c74414 --- /dev/null +++ b/src/WebApplication.ExtensionB/Models/ItemDbContext.cs @@ -0,0 +1,19 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.EntityFrameworkCore; + +namespace WebApplication.ExtensionB.Models +{ + public class ItemDbContext : DbContext + { + public ItemDbContext(DbContextOptions options) :base(options) + { } + public DbSet Items { get; set; } + public void OnModelCreating(ModelBuilder builder) + { + builder.Entity().HasKey(m => m.Id); + base.OnModelCreating(builder); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Models/ItemRepository.cs b/src/WebApplication.ExtensionB/Models/ItemRepository.cs new file mode 100644 index 0000000..2113d13 --- /dev/null +++ b/src/WebApplication.ExtensionB/Models/ItemRepository.cs @@ -0,0 +1,21 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; + +namespace WebApplication.ExtensionB.Models +{ + public class ItemRepository : IItemRepository + { + private ItemDbContext _itemDbContext { get; set; } + public ItemRepository(ItemDbContext itemDbContext) + { + _itemDbContext = itemDbContext; + } + public IEnumerable All() + { + return _itemDbContext.Items.OrderBy(i => i.Name); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/ViewModels/ExtensionB/Index/IndexViewModelBuilder.cs b/src/WebApplication.ExtensionB/ViewModels/ExtensionB/Index/IndexViewModelBuilder.cs index 3fb9be6..2b8dc03 100644 --- a/src/WebApplication.ExtensionB/ViewModels/ExtensionB/Index/IndexViewModelBuilder.cs +++ b/src/WebApplication.ExtensionB/ViewModels/ExtensionB/Index/IndexViewModelBuilder.cs @@ -3,19 +3,19 @@ using System.Collections.Generic; using System.Linq; -using WebApplication.ExtensionB.Data.Models; +using WebApplication.ExtensionB.Models; using WebApplication.ExtensionB.ViewModels.Shared; namespace WebApplication.ExtensionB.ViewModels.ExtenstionB { - public class IndexViewModelBuilder - { - public IndexViewModel Build(IEnumerable items) + public class IndexViewModelBuilder { - return new IndexViewModel() - { - Items = items.Select(i => new ItemViewModelBuilder().Build(i)) - }; + public IndexViewModel Build(IEnumerable items) + { + return new IndexViewModel() + { + Items = items.Select(i => new ItemViewModelBuilder().Build(i)) + }; + } } - } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/ViewModels/Shared/ItemViewModelBuilder.cs b/src/WebApplication.ExtensionB/ViewModels/Shared/ItemViewModelBuilder.cs index ece8fd2..f56bc53 100644 --- a/src/WebApplication.ExtensionB/ViewModels/Shared/ItemViewModelBuilder.cs +++ b/src/WebApplication.ExtensionB/ViewModels/Shared/ItemViewModelBuilder.cs @@ -1,18 +1,18 @@ // Copyright © 2015 Dmitry Sikorsky. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using WebApplication.ExtensionB.Data.Models; +using WebApplication.ExtensionB.Models; namespace WebApplication.ExtensionB.ViewModels.Shared { - public class ItemViewModelBuilder - { - public ItemViewModel Build(Item item) + public class ItemViewModelBuilder { - return new ItemViewModel() - { - Name = item.Name - }; + public ItemViewModel Build(Item item) + { + return new ItemViewModel() + { + Name = item.Name + }; + } } - } } \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/Views/ExtensionB/Index.cshtml b/src/WebApplication.ExtensionB/Views/ExtensionB/Index.cshtml index 338ffd2..7743a4e 100644 --- a/src/WebApplication.ExtensionB/Views/ExtensionB/Index.cshtml +++ b/src/WebApplication.ExtensionB/Views/ExtensionB/Index.cshtml @@ -19,6 +19,6 @@

    This line is red because of the rule in CSS-file added as resource (from Extension A).

    So any extension can use resources from any other extension.

    -

    * Precompiled views support has been suspended in ASP.NET Core 1.0 RC2.

    +

    * Precompiled views support has been suspended in ASP.NET Core 1.0 RTM.

    \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/project.json b/src/WebApplication.ExtensionB/project.json index fb9e2f8..ebd75b0 100644 --- a/src/WebApplication.ExtensionB/project.json +++ b/src/WebApplication.ExtensionB/project.json @@ -2,12 +2,10 @@ "authors": [ "Dmitry Sikorsky" ], "buildOptions": { "embed": [ "Views/**" ] }, "dependencies": { - "ExtCore.Data.Abstractions": "1.0.0-alpha9", - "ExtCore.Infrastructure": "1.0.0-alpha9", + "ExtCore.Infrastructure": "1.0.0-alpha901", "Microsoft.AspNetCore.Mvc": "1.0.0", "NETStandard.Library": "1.6.0", - "WebApplication.ExtensionB.Data.Abstractions": "1.0.0", - "WebApplication.ExtensionB.Data.Models": "1.0.0" + "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0" }, "frameworks": { "netstandard1.6": { diff --git a/src/WebApplication.NLog/NLog.cs b/src/WebApplication.NLog/NLog.cs new file mode 100644 index 0000000..1321c38 --- /dev/null +++ b/src/WebApplication.NLog/NLog.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ExtCore.Infrastructure; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using NLog.Web; +using NLog.Extensions.Logging; + +namespace WebApplication.NLog +{ + public class NLog : IExtension + { + private IConfigurationRoot configurationRoot; + + public string Name + { + get + { + return "Extension NLog"; + } + } + + public IDictionary> RouteRegistrarsByPriorities + { + get + { + return null; + } + } + + public int ConfigureServicesPriorities + { + get + { + return 100; + } + } + public int ConfigurePriorities + { + get + { + return 100; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + public void ConfigureServices(IServiceCollection services) + { + services.AddLogging(); + } + + public void Configure(IApplicationBuilder app) + { + var loggerFactory = app.ApplicationServices.GetService(); + var env = app.ApplicationServices.GetService(); + + //add NLog to ASP.NET Core + loggerFactory.AddNLog(); + + //add NLog.Web + app.AddNLogWeb(); + //needed for non-NETSTANDARD platforms: configure nlog.config in your project root + //env.ConfigureNLog("nlog.config"); + loggerFactory.AddConsole(); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.NLog/Properties/AssemblyInfo.cs b/src/WebApplication.NLog/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..609930a --- /dev/null +++ b/src/WebApplication.NLog/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +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: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebApplication.NLog")] +[assembly: AssemblyTrademark("")] + +// 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("9e4b65ab-3f34-4c81-b02d-8e5643d2b3b9")] diff --git a/src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/WebApplication.ExtensionB.Data.EntityFramework.Sqlite.xproj b/src/WebApplication.NLog/WebApplication.NLog.xproj similarity index 82% rename from src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/WebApplication.ExtensionB.Data.EntityFramework.Sqlite.xproj rename to src/WebApplication.NLog/WebApplication.NLog.xproj index b803df5..abf2298 100644 --- a/src/WebApplication.ExtensionB.Data.EntityFramework.Sqlite/WebApplication.ExtensionB.Data.EntityFramework.Sqlite.xproj +++ b/src/WebApplication.NLog/WebApplication.NLog.xproj @@ -4,16 +4,18 @@ 14.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + - af7b3c14-bc6e-4964-bd0b-5233428349b6 - WebApplication.ExtensionB.Data.EF.Sqlite + 9e4b65ab-3f34-4c81-b02d-8e5643d2b3b9 + WebApplication.NLog .\obj .\bin\ - v4.6.1 + v4.6.1 + 2.0 - \ No newline at end of file + diff --git a/src/WebApplication.NLog/project.json b/src/WebApplication.NLog/project.json new file mode 100644 index 0000000..c6f5370 --- /dev/null +++ b/src/WebApplication.NLog/project.json @@ -0,0 +1,24 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "ExtCore.Infrastructure": "1.0.0-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.0", + "NETStandard.Library": "1.6.0", + "Microsoft.Extensions.Logging": "1.0.0", + "Microsoft.Extensions.Logging.Console": "1.0.0", + "Microsoft.Extensions.Logging.Debug": "1.0.0", + "NLog.Extensions.Logging": "1.0.0-rtm-alpha2", + "NLog.Web.AspNetCore": "4.2.4" + }, + + "frameworks": { + "netstandard1.6": { + "imports": [ + "dotnet5.6", + "dnxcore50", + "portable-net45+win8" + ] + } + } +} diff --git a/src/WebApplication.Swagger/Properties/AssemblyInfo.cs b/src/WebApplication.Swagger/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..402d27a --- /dev/null +++ b/src/WebApplication.Swagger/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +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: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebApplication.Swagger")] +[assembly: AssemblyTrademark("")] + +// 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("95e5595e-410b-4a6d-8822-4c07fdc3cf21")] diff --git a/src/WebApplication.Swagger/Swagger.cs b/src/WebApplication.Swagger/Swagger.cs new file mode 100644 index 0000000..162f971 --- /dev/null +++ b/src/WebApplication.Swagger/Swagger.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ExtCore.Infrastructure; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Swashbuckle.Swagger.Model; + + +namespace WebApplication.Swagger +{ + public class Swagger : IExtension + { + private IConfigurationRoot configurationRoot; + + public string Name + { + get + { + return "Extension Swagger"; + } + } + + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); + + routeRegistrarsByPriorities.Add( + 9000, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension Swagger", template: "{controller=Home}/{action=Index}/{id?}"); + } + ); + + return routeRegistrarsByPriorities; + } + } + + public int ConfigureServicesPriorities + { + get + { + return 300; + } + } + public int ConfigurePriorities + { + get + { + return 9000; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + + public void ConfigureServices(IServiceCollection services) + { + //var pathToDoc = this.configurationRoot["Swagger:Path"]; + services.AddSwaggerGen(); + services.ConfigureSwaggerGen(options => + { + options.SingleApiVersion(new Info + { + Version = "v1", + Title = "Geo Search API", + Description = "A simple api to search using geo location in Elasticsearch", + TermsOfService = "None" + }); + //options.IncludeXmlComments(pathToDoc); + options.DescribeAllEnumsAsStrings(); + }); + } + + public void Configure(IApplicationBuilder applicationBuilder) + { + applicationBuilder.UseSwagger(); + applicationBuilder.UseSwaggerUi(); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB.Data.Abstractions/WebApplication.ExtensionB.Data.Abstractions.xproj b/src/WebApplication.Swagger/WebApplication.Swagger.xproj similarity index 81% rename from src/WebApplication.ExtensionB.Data.Abstractions/WebApplication.ExtensionB.Data.Abstractions.xproj rename to src/WebApplication.Swagger/WebApplication.Swagger.xproj index d64d7f1..7af6b7d 100644 --- a/src/WebApplication.ExtensionB.Data.Abstractions/WebApplication.ExtensionB.Data.Abstractions.xproj +++ b/src/WebApplication.Swagger/WebApplication.Swagger.xproj @@ -4,16 +4,18 @@ 14.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + - 922e22bd-10f8-4261-9acc-9cd10a4c8147 - WebApplication.ExtensionB.Data.Abstractions + 95e5595e-410b-4a6d-8822-4c07fdc3cf21 + WebApplication.Swagger .\obj .\bin\ - v4.6.1 + v4.6.1 + 2.0 - \ No newline at end of file + diff --git a/src/WebApplication.Swagger/project.json b/src/WebApplication.Swagger/project.json new file mode 100644 index 0000000..3ec61ca --- /dev/null +++ b/src/WebApplication.Swagger/project.json @@ -0,0 +1,21 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "ExtCore.Infrastructure": "1.0.0-alpha901", + "NETStandard.Library": "1.6.0", + "Microsoft.AspNetCore.Mvc": "1.0.0", + "Swashbuckle": "6.0.0-beta901", + "Swashbuckle.Swagger": "6.0.0-beta901" + }, + + "frameworks": { + "netstandard1.6": { + "imports": [ + "dotnet5.6", + "dnxcore50", + "portable-net45+win8" + ] + } + } +} diff --git a/src/WebApplication.WebAPI/Controllers/ItemsController.cs b/src/WebApplication.WebAPI/Controllers/ItemsController.cs new file mode 100644 index 0000000..02021e7 --- /dev/null +++ b/src/WebApplication.WebAPI/Controllers/ItemsController.cs @@ -0,0 +1,45 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Mvc; +using WebApplication.WebAPI.Models; + +namespace WebApplication.WebAPI.Controllers +{ + [Route("api/[controller]")] + public class ItemsController : Controller + { + private IItemRepository _itemRepository { get; set; } + + public ItemsController(IItemRepository itemRepository) + { + _itemRepository = itemRepository; + } + + [HttpGet] + public IActionResult Get() + { + return Ok(_itemRepository.All()); + } + [HttpGet("{id}")] + public IActionResult Get(long id) + { + return Ok(_itemRepository.Find(id)); + } + [HttpPost] + public void Post([FromBody]Item value) + { + _itemRepository.Add(value); + } + [HttpPut("{id}")] + public void Put(long id, [FromBody]Item value) + { + _itemRepository.Update(id, value); + } + [HttpDelete("{id}")] + public void Delete(long id) + { + _itemRepository.Delete(id); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Models/IItemRepository.cs b/src/WebApplication.WebAPI/Models/IItemRepository.cs new file mode 100644 index 0000000..41a1689 --- /dev/null +++ b/src/WebApplication.WebAPI/Models/IItemRepository.cs @@ -0,0 +1,15 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +namespace WebApplication.WebAPI.Models +{ + public interface IItemRepository + { + IEnumerable All(); + Item Find(long id); + void Add(Item value); + void Update(long id, Item value); + void Delete(long id); + } +} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Models/Item.cs b/src/WebApplication.WebAPI/Models/Item.cs new file mode 100644 index 0000000..31b9813 --- /dev/null +++ b/src/WebApplication.WebAPI/Models/Item.cs @@ -0,0 +1,11 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace WebApplication.WebAPI.Models +{ + public class Item + { + public int Id { get; set; } + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Models/ItemDbContext.cs b/src/WebApplication.WebAPI/Models/ItemDbContext.cs new file mode 100644 index 0000000..401a332 --- /dev/null +++ b/src/WebApplication.WebAPI/Models/ItemDbContext.cs @@ -0,0 +1,19 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.EntityFrameworkCore; + +namespace WebApplication.WebAPI.Models +{ + public class ItemDbContext : DbContext + { + public ItemDbContext(DbContextOptions options) :base(options) + { } + public DbSet Items { get; set; } + public void OnModelCreating(ModelBuilder builder) + { + builder.Entity().HasKey(m => m.Id); + base.OnModelCreating(builder); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Models/ItemRepository.cs b/src/WebApplication.WebAPI/Models/ItemRepository.cs new file mode 100644 index 0000000..869666d --- /dev/null +++ b/src/WebApplication.WebAPI/Models/ItemRepository.cs @@ -0,0 +1,44 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; + +namespace WebApplication.WebAPI.Models +{ + public class ItemRepository : IItemRepository + { + private ItemDbContext _itemDbContext { get; set; } + public ItemRepository(ItemDbContext itemDbContext) + { + _itemDbContext = itemDbContext; + } + public IEnumerable All() + { + return _itemDbContext.Items.OrderBy(i => i.Name); + } + public Item Find(long id) + { + return _itemDbContext.Items.Where(i => i.Id == id).First(); + } + public void Add(Item value) + { + _itemDbContext.Items.Add(value); + _itemDbContext.SaveChanges(); + return; + } + public void Update(long id, Item value) + { + _itemDbContext.Items.Update(value); + _itemDbContext.SaveChanges(); + return; + } + public void Delete(long id) + { + var value =_itemDbContext.Items.Where(i => i.Id == id).First(); + _itemDbContext.Items.Remove(value); + _itemDbContext.SaveChanges(); + return; + } + } +} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/Properties/AssemblyInfo.cs b/src/WebApplication.WebAPI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..881bd64 --- /dev/null +++ b/src/WebApplication.WebAPI/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +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: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebApplication.WebAPI")] +[assembly: AssemblyTrademark("")] + +// 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("7de66111-bbb6-4c93-b864-9e65cafd505b")] diff --git a/src/WebApplication.WebAPI/WebAPI.cs b/src/WebApplication.WebAPI/WebAPI.cs new file mode 100644 index 0000000..3cf3a9e --- /dev/null +++ b/src/WebApplication.WebAPI/WebAPI.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ExtCore.Infrastructure; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.EntityFrameworkCore; +using WebApplication.WebAPI.Models; + +namespace WebApplication.WebAPI +{ + public class WebAPI : IExtension + { + private IConfigurationRoot configurationRoot; + + public string Name + { + get + { + return "Extension WebAPI"; + } + } + + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); + + routeRegistrarsByPriorities.Add( + 2000, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension WebAPI", template: "{controller=Home}/{action=Index}/{id?}"); + } + ); + + return routeRegistrarsByPriorities; + } + } + + + public int ConfigureServicesPriorities + { + get + { + return 2001; + } + } + public int ConfigurePriorities + { + get + { + return 2001; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + public void ConfigureServices(IServiceCollection services) + { + services.AddEntityFrameworkSqlite(); + services.AddDbContext(options => + { + options.UseSqlite(this.configurationRoot["Data:DefaultConnection:ConnectionString"]); + }); + services.AddScoped(); + } + + public void Configure(IApplicationBuilder applicationBuilder) + { + } + } +} \ No newline at end of file diff --git a/src/WebApplication.WebAPI/WebApplication.WebAPI.xproj b/src/WebApplication.WebAPI/WebApplication.WebAPI.xproj new file mode 100644 index 0000000..9f3c301 --- /dev/null +++ b/src/WebApplication.WebAPI/WebApplication.WebAPI.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + 7de66111-bbb6-4c93-b864-9e65cafd505b + WebApplication.WebAPI + .\obj + .\bin\ + v4.6.1 + + + + 2.0 + + + diff --git a/src/WebApplication.WebAPI/project.json b/src/WebApplication.WebAPI/project.json new file mode 100644 index 0000000..87fe16f --- /dev/null +++ b/src/WebApplication.WebAPI/project.json @@ -0,0 +1,16 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "NETStandard.Library": "1.6.0", + "ExtCore.Infrastructure": "1.0.0-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.0", + "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0" + }, + + "frameworks": { + "netstandard1.6": { + "imports": "dnxcore50" + } + } +} diff --git a/src/WebApplication/gulpfile.js b/src/WebApplication/gulpfile.js index 7aefd59..c1f75df 100644 --- a/src/WebApplication/gulpfile.js +++ b/src/WebApplication/gulpfile.js @@ -2,11 +2,12 @@ gulp.task( "copy-extensions", function (cb) { + gulp.src(["../WebApplication.NLog/bin/Debug/netstandard1.6/WebApplication.NLog.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.Elm/bin/Debug/netstandard1.6/WebApplication.Elm.dll"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.ExtensionA/bin/Debug/netstandard1.6/WebApplication.ExtensionA.dll"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.ExtensionB/bin/Debug/netstandard1.6/WebApplication.ExtensionB.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.ExtensionB.Data.Abstractions/bin/Debug/netstandard1.6/WebApplication.ExtensionB.Data.Abstractions.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.ExtensionB.Data.EntityFramework.Sqlite/bin/Debug/netstandard1.6/WebApplication.ExtensionB.Data.EntityFramework.Sqlite.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.ExtensionB.Data.Models/bin/Debug/netstandard1.6/WebApplication.ExtensionB.Data.Models.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.Swagger/bin/Debug/netstandard1.6/WebApplication.Swagger.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.WebAPI/bin/Debug/netstandard1.6/WebApplication.WebAPI.dll"]).pipe(gulp.dest("Extensions")); cb(); } ); \ No newline at end of file diff --git a/src/WebApplication/nlog.config b/src/WebApplication/nlog.config new file mode 100644 index 0000000..53ac823 --- /dev/null +++ b/src/WebApplication/nlog.config @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/WebApplication/project.json b/src/WebApplication/project.json index 117e652..c148096 100644 --- a/src/WebApplication/project.json +++ b/src/WebApplication/project.json @@ -7,10 +7,8 @@ "preserveCompilationContext": true }, "dependencies": { - "ExtCore.Data": "1.0.0-alpha9", - "ExtCore.Data.EntityFramework.Sqlite": "1.0.0-alpha9", - "ExtCore.Infrastructure": "1.0.0-alpha9", - "ExtCore.WebApplication": "1.0.0-alpha9", + "ExtCore.Infrastructure": "1.0.0-alpha901", + "ExtCore.WebApplication": "1.0.0-alpha901", "Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", @@ -20,7 +18,18 @@ "version": "1.0.0", "type": "platform" }, - "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0" + "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0", + "Microsoft.Extensions.Logging": "1.0.0", + "Microsoft.Extensions.Logging.Console": "1.0.0", + "Microsoft.Extensions.Logging.Debug": "1.0.0", + "NLog.Extensions.Logging": "1.0.0-rtm-alpha2", + "NLog.Web.AspNetCore": "4.2.4", + "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0", + "NETStandard.Library": "1.6.0", + "Microsoft.AspNetCore.Mvc": "1.0.0", + "Microsoft.AspNetCore.Diagnostics.Elm": "0.1.0", + "Swashbuckle": "6.0.0-beta901", + "Swashbuckle.Swagger": "6.0.0-beta901" }, "frameworks": { "netcoreapp1.0": { @@ -36,7 +45,8 @@ "Views", "wwwroot", "config.json", - "web.config" + "web.config", + "nlog.config" ] }, "runtimeOptions": { From 1f6a338c8e595f762062e26aac26f4bf17fad4c0 Mon Sep 17 00:00:00 2001 From: USER001 F Date: Sun, 27 Nov 2016 22:37:35 +0900 Subject: [PATCH 04/18] Use CustomSchemaIds --- global.json | 2 +- src/WebApplication.Elm/project.json | 6 +++++- src/WebApplication.Swagger/Swagger.cs | 1 + src/WebApplication.Swagger/project.json | 4 ++-- src/WebApplication.WebAPI/project.json | 6 +++++- src/WebApplication/project.json | 4 ++-- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/global.json b/global.json index d5427d4..96bedd9 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "projects": [ "src" ], "sdk": { - "version": "1.0.0-preview2-003121" + "version": "1.0.0-preview2-003133" } } \ No newline at end of file diff --git a/src/WebApplication.Elm/project.json b/src/WebApplication.Elm/project.json index ed3341a..3438a4f 100644 --- a/src/WebApplication.Elm/project.json +++ b/src/WebApplication.Elm/project.json @@ -11,7 +11,11 @@ "frameworks": { "netstandard1.6": { - "imports": "dnxcore50" + "imports": [ + "dotnet5.6", + "dnxcore50", + "portable-net45+win8" + ] } } } \ No newline at end of file diff --git a/src/WebApplication.Swagger/Swagger.cs b/src/WebApplication.Swagger/Swagger.cs index 162f971..d3eaf1a 100644 --- a/src/WebApplication.Swagger/Swagger.cs +++ b/src/WebApplication.Swagger/Swagger.cs @@ -78,6 +78,7 @@ public void ConfigureServices(IServiceCollection services) }); //options.IncludeXmlComments(pathToDoc); options.DescribeAllEnumsAsStrings(); + options.CustomSchemaIds(otions => options.GetType().FullName); }); } diff --git a/src/WebApplication.Swagger/project.json b/src/WebApplication.Swagger/project.json index 3ec61ca..e799d59 100644 --- a/src/WebApplication.Swagger/project.json +++ b/src/WebApplication.Swagger/project.json @@ -5,8 +5,8 @@ "ExtCore.Infrastructure": "1.0.0-alpha901", "NETStandard.Library": "1.6.0", "Microsoft.AspNetCore.Mvc": "1.0.0", - "Swashbuckle": "6.0.0-beta901", - "Swashbuckle.Swagger": "6.0.0-beta901" + "Swashbuckle": "6.0.0-beta902", + "Swashbuckle.Swagger": "6.0.0-beta902" }, "frameworks": { diff --git a/src/WebApplication.WebAPI/project.json b/src/WebApplication.WebAPI/project.json index 87fe16f..e6ced2b 100644 --- a/src/WebApplication.WebAPI/project.json +++ b/src/WebApplication.WebAPI/project.json @@ -10,7 +10,11 @@ "frameworks": { "netstandard1.6": { - "imports": "dnxcore50" + "imports": [ + "dotnet5.6", + "dnxcore50", + "portable-net45+win8" + ] } } } diff --git a/src/WebApplication/project.json b/src/WebApplication/project.json index c148096..9544a34 100644 --- a/src/WebApplication/project.json +++ b/src/WebApplication/project.json @@ -28,8 +28,8 @@ "NETStandard.Library": "1.6.0", "Microsoft.AspNetCore.Mvc": "1.0.0", "Microsoft.AspNetCore.Diagnostics.Elm": "0.1.0", - "Swashbuckle": "6.0.0-beta901", - "Swashbuckle.Swagger": "6.0.0-beta901" + "Swashbuckle": "6.0.0-beta902", + "Swashbuckle.Swagger": "6.0.0-beta902" }, "frameworks": { "netcoreapp1.0": { From c83572de10f2829847a5ec32b3df5d51306e3ad6 Mon Sep 17 00:00:00 2001 From: USER001 F Date: Tue, 29 Nov 2016 00:13:35 +0900 Subject: [PATCH 05/18] Add Scripting API --- WebApplication.sln | 10 ++++++++++ src/WebApplication.ExtensionB/Models/ItemDbContext.cs | 2 +- src/WebApplication.WebAPI/Models/ItemDbContext.cs | 2 +- src/WebApplication/WebApplication.xproj | 2 +- src/WebApplication/gulpfile.js | 1 + src/WebApplication/project.json | 7 +++++-- 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/WebApplication.sln b/WebApplication.sln index 496c336..317d279 100644 --- a/WebApplication.sln +++ b/WebApplication.sln @@ -36,6 +36,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Elm", "Elm", "{C49636B1-231 EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.Elm", "src\WebApplication.Elm\WebApplication.Elm.xproj", "{A5C5400D-DD78-4192-B34B-06D81996F0DA}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Script", "Script", "{925D6751-630E-48FF-9AF8-8DA9E09968CF}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.Script", "src\WebApplication.Script\WebApplication.Script.xproj", "{8DC07B1F-ADAA-492C-8F2D-46B9EE579B44}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -70,6 +74,10 @@ Global {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Debug|Any CPU.Build.0 = Debug|Any CPU {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Release|Any CPU.ActiveCfg = Release|Any CPU {A5C5400D-DD78-4192-B34B-06D81996F0DA}.Release|Any CPU.Build.0 = Release|Any CPU + {8DC07B1F-ADAA-492C-8F2D-46B9EE579B44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8DC07B1F-ADAA-492C-8F2D-46B9EE579B44}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8DC07B1F-ADAA-492C-8F2D-46B9EE579B44}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8DC07B1F-ADAA-492C-8F2D-46B9EE579B44}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -88,5 +96,7 @@ Global {7DE66111-BBB6-4C93-B864-9E65CAFD505B} = {FDEA400A-7F71-4A17-8419-030D80F74A3F} {C49636B1-231E-45A2-8901-10EC68C7CB55} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} {A5C5400D-DD78-4192-B34B-06D81996F0DA} = {C49636B1-231E-45A2-8901-10EC68C7CB55} + {925D6751-630E-48FF-9AF8-8DA9E09968CF} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {8DC07B1F-ADAA-492C-8F2D-46B9EE579B44} = {925D6751-630E-48FF-9AF8-8DA9E09968CF} EndGlobalSection EndGlobal diff --git a/src/WebApplication.ExtensionB/Models/ItemDbContext.cs b/src/WebApplication.ExtensionB/Models/ItemDbContext.cs index 5c74414..4005061 100644 --- a/src/WebApplication.ExtensionB/Models/ItemDbContext.cs +++ b/src/WebApplication.ExtensionB/Models/ItemDbContext.cs @@ -10,7 +10,7 @@ public class ItemDbContext : DbContext public ItemDbContext(DbContextOptions options) :base(options) { } public DbSet Items { get; set; } - public void OnModelCreating(ModelBuilder builder) + protected override void OnModelCreating(ModelBuilder builder) { builder.Entity().HasKey(m => m.Id); base.OnModelCreating(builder); diff --git a/src/WebApplication.WebAPI/Models/ItemDbContext.cs b/src/WebApplication.WebAPI/Models/ItemDbContext.cs index 401a332..a5a4e6e 100644 --- a/src/WebApplication.WebAPI/Models/ItemDbContext.cs +++ b/src/WebApplication.WebAPI/Models/ItemDbContext.cs @@ -10,7 +10,7 @@ public class ItemDbContext : DbContext public ItemDbContext(DbContextOptions options) :base(options) { } public DbSet Items { get; set; } - public void OnModelCreating(ModelBuilder builder) + protected override void OnModelCreating(ModelBuilder builder) { builder.Entity().HasKey(m => m.Id); base.OnModelCreating(builder); diff --git a/src/WebApplication/WebApplication.xproj b/src/WebApplication/WebApplication.xproj index 56ee1ed..fff6a2d 100644 --- a/src/WebApplication/WebApplication.xproj +++ b/src/WebApplication/WebApplication.xproj @@ -10,7 +10,7 @@ WebApplication .\obj .\bin\ - v4.6.1 + v4.6.1 2.0 diff --git a/src/WebApplication/gulpfile.js b/src/WebApplication/gulpfile.js index c1f75df..a93db9a 100644 --- a/src/WebApplication/gulpfile.js +++ b/src/WebApplication/gulpfile.js @@ -6,6 +6,7 @@ gulp.task( gulp.src(["../WebApplication.Elm/bin/Debug/netstandard1.6/WebApplication.Elm.dll"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.ExtensionA/bin/Debug/netstandard1.6/WebApplication.ExtensionA.dll"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.ExtensionB/bin/Debug/netstandard1.6/WebApplication.ExtensionB.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.Script/bin/Debug/netstandard1.6/WebApplication.Script.dll"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.Swagger/bin/Debug/netstandard1.6/WebApplication.Swagger.dll"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.WebAPI/bin/Debug/netstandard1.6/WebApplication.WebAPI.dll"]).pipe(gulp.dest("Extensions")); cb(); diff --git a/src/WebApplication/project.json b/src/WebApplication/project.json index 9544a34..ba08102 100644 --- a/src/WebApplication/project.json +++ b/src/WebApplication/project.json @@ -25,14 +25,17 @@ "NLog.Extensions.Logging": "1.0.0-rtm-alpha2", "NLog.Web.AspNetCore": "4.2.4", "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0", - "NETStandard.Library": "1.6.0", + //"NETStandard.Library": "1.6.0", "Microsoft.AspNetCore.Mvc": "1.0.0", "Microsoft.AspNetCore.Diagnostics.Elm": "0.1.0", "Swashbuckle": "6.0.0-beta902", - "Swashbuckle.Swagger": "6.0.0-beta902" + "Swashbuckle.Swagger": "6.0.0-beta902", + "Microsoft.CodeAnalysis.CSharp.Scripting": "1.3.2" }, "frameworks": { + //"net46": {}, "netcoreapp1.0": { + //"netstandard1.6": { "imports": [ "dotnet5.6", "dnxcore50", From 936a94e7be53d1cf2da1726048aef4659c870e6c Mon Sep 17 00:00:00 2001 From: USER001 F Date: Tue, 29 Nov 2016 00:14:55 +0900 Subject: [PATCH 06/18] Add Scripting API Plugin --- .../Controllers/ScriptController.cs | 38 ++++++++++ .../Properties/AssemblyInfo.cs | 19 +++++ src/WebApplication.Script/Script.cs | 74 +++++++++++++++++++ .../WebApplication.Script.xproj | 21 ++++++ src/WebApplication.Script/project.json | 20 +++++ 5 files changed, 172 insertions(+) create mode 100644 src/WebApplication.Script/Controllers/ScriptController.cs create mode 100644 src/WebApplication.Script/Properties/AssemblyInfo.cs create mode 100644 src/WebApplication.Script/Script.cs create mode 100644 src/WebApplication.Script/WebApplication.Script.xproj create mode 100644 src/WebApplication.Script/project.json diff --git a/src/WebApplication.Script/Controllers/ScriptController.cs b/src/WebApplication.Script/Controllers/ScriptController.cs new file mode 100644 index 0000000..38b9981 --- /dev/null +++ b/src/WebApplication.Script/Controllers/ScriptController.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Microsoft.CodeAnalysis.CSharp.Scripting; + +namespace WebApplication.Script.Controllers +{ + [Route("api/[controller]")] + public class ScriptController : Controller + { + private ILogger _logger { get; set; } + + public ScriptController(ILoggerFactory loggerFactory) + { + _logger = loggerFactory.CreateLogger(); + } + [HttpGet] + public IActionResult Get() + { + //_logger.LogInformation("Get--------"); + var result = GetAsync(); + return Ok(result); + } + private int GetAsync() + { + var result = CSharpScript.EvaluateAsync(@" +var x = 1; +var y = 2; +x + y +").GetAwaiter().GetResult(); + _logger.LogInformation($"{result}--------GetAsync"); + return result; + } + } +} diff --git a/src/WebApplication.Script/Properties/AssemblyInfo.cs b/src/WebApplication.Script/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..70046c2 --- /dev/null +++ b/src/WebApplication.Script/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +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: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebApplication.Script")] +[assembly: AssemblyTrademark("")] + +// 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("8dc07b1f-adaa-492c-8f2d-46b9ee579b44")] diff --git a/src/WebApplication.Script/Script.cs b/src/WebApplication.Script/Script.cs new file mode 100644 index 0000000..194f41c --- /dev/null +++ b/src/WebApplication.Script/Script.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Scripting; +using Microsoft.CodeAnalysis.CSharp; +using ExtCore.Infrastructure; +using Microsoft.AspNetCore.Builder; +//using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; + +namespace WebApplication.Script +{ + public class Script : IExtension + { + private IConfigurationRoot configurationRoot; + + public string Name + { + get + { + return "Extension Script"; + } + } + + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); + + routeRegistrarsByPriorities.Add( + 2000, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension Script", template: "{controller=Home}/{action=Index}/{id?}"); + } + ); + + return routeRegistrarsByPriorities; + } + } + + public int ConfigureServicesPriorities + { + get + { + return 2000; + } + } + public int ConfigurePriorities + { + get + { + return 2002; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + + public void ConfigureServices(IServiceCollection services) + { + } + + public void Configure(IApplicationBuilder applicationBuilder) + { + } + } +} \ No newline at end of file diff --git a/src/WebApplication.Script/WebApplication.Script.xproj b/src/WebApplication.Script/WebApplication.Script.xproj new file mode 100644 index 0000000..8c1a8b5 --- /dev/null +++ b/src/WebApplication.Script/WebApplication.Script.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + 8dc07b1f-adaa-492c-8f2d-46b9ee579b44 + WebApplication.Script + .\obj + .\bin\ + v4.6.1 + + + + 2.0 + + + diff --git a/src/WebApplication.Script/project.json b/src/WebApplication.Script/project.json new file mode 100644 index 0000000..aa5a55f --- /dev/null +++ b/src/WebApplication.Script/project.json @@ -0,0 +1,20 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "NETStandard.Library": "1.6.0", + "Microsoft.CodeAnalysis.CSharp.Scripting": "1.3.2", + "ExtCore.Infrastructure": "1.0.0-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.0" + }, + + "frameworks": { + "netstandard1.6": { + "imports": [ + "dotnet5.6", + "dnxcore50", + "portable-net45+win8" + ] + } + } +} From 97c6129e2c398008a565dbf3d5bb21ecaa969046 Mon Sep 17 00:00:00 2001 From: USER001 F Date: Sun, 4 Dec 2016 14:44:09 +0900 Subject: [PATCH 07/18] Add Swagger Fillter --- ...orizationHeaderParameterOperationFilter.cs | 35 +++++++++++++++++++ src/WebApplication.Swagger/Swagger.cs | 1 + 2 files changed, 36 insertions(+) create mode 100644 src/WebApplication.Swagger/AuthorizationHeaderParameterOperationFilter.cs diff --git a/src/WebApplication.Swagger/AuthorizationHeaderParameterOperationFilter.cs b/src/WebApplication.Swagger/AuthorizationHeaderParameterOperationFilter.cs new file mode 100644 index 0000000..95b7070 --- /dev/null +++ b/src/WebApplication.Swagger/AuthorizationHeaderParameterOperationFilter.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Swashbuckle.Swagger.Model; +using Swashbuckle.SwaggerGen.Generator; +using Microsoft.AspNetCore.Mvc.Authorization; + +namespace WebApplication.Swagger +{ + public class AuthorizationHeaderParameterOperationFilter : IOperationFilter + { + public void Apply(Operation operation, OperationFilterContext context) + { + var filterPipeline = context.ApiDescription.ActionDescriptor.FilterDescriptors; + var isAuthorized = filterPipeline.Select(filterInfo => filterInfo.Filter).Any(filter => filter is AuthorizeFilter); + var allowAnonymous = filterPipeline.Select(filterInfo => filterInfo.Filter).Any(filter => filter is IAllowAnonymousFilter); + + if (isAuthorized && !allowAnonymous) + { + if (operation.Parameters == null) + operation.Parameters = new List(); + + operation.Parameters.Add(new NonBodyParameter + { + Name = "Authorization", + In = "header", + Description = "access token", + Required = false, // PopUp + Type = "string" + }); + } + } + } +} diff --git a/src/WebApplication.Swagger/Swagger.cs b/src/WebApplication.Swagger/Swagger.cs index d3eaf1a..215bbeb 100644 --- a/src/WebApplication.Swagger/Swagger.cs +++ b/src/WebApplication.Swagger/Swagger.cs @@ -79,6 +79,7 @@ public void ConfigureServices(IServiceCollection services) //options.IncludeXmlComments(pathToDoc); options.DescribeAllEnumsAsStrings(); options.CustomSchemaIds(otions => options.GetType().FullName); + options.OperationFilter(); }); } From 263380192a2ac4a58d282fb4df60f104419704f0 Mon Sep 17 00:00:00 2001 From: USER001 F Date: Mon, 5 Dec 2016 01:31:19 +0900 Subject: [PATCH 08/18] Working AddRawQuery --- WebApplication.sln | 10 ++ .../Controllers/ItemsController.cs | 45 ++++++++ .../EFCoreRawQuery.cs | 79 +++++++++++++ .../Models/IItemRepository.cs | 15 +++ .../Models/Item.cs | 11 ++ .../Models/ItemDbContext.cs | 19 ++++ .../Models/ItemRepository.cs | 62 +++++++++++ .../Properties/AssemblyInfo.cs | 19 ++++ .../RDFacadeExtensions.cs | 105 ++++++++++++++++++ .../WebApplication.EFCoreRawQuery.xproj | 21 ++++ .../project.json | 21 ++++ src/WebApplication.Swagger/Swagger.cs | 2 +- 12 files changed, 408 insertions(+), 1 deletion(-) create mode 100644 src/WebApplication.EFCoreRawQuery/Controllers/ItemsController.cs create mode 100644 src/WebApplication.EFCoreRawQuery/EFCoreRawQuery.cs create mode 100644 src/WebApplication.EFCoreRawQuery/Models/IItemRepository.cs create mode 100644 src/WebApplication.EFCoreRawQuery/Models/Item.cs create mode 100644 src/WebApplication.EFCoreRawQuery/Models/ItemDbContext.cs create mode 100644 src/WebApplication.EFCoreRawQuery/Models/ItemRepository.cs create mode 100644 src/WebApplication.EFCoreRawQuery/Properties/AssemblyInfo.cs create mode 100644 src/WebApplication.EFCoreRawQuery/RDFacadeExtensions.cs create mode 100644 src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.xproj create mode 100644 src/WebApplication.EFCoreRawQuery/project.json diff --git a/WebApplication.sln b/WebApplication.sln index 317d279..2c52f67 100644 --- a/WebApplication.sln +++ b/WebApplication.sln @@ -40,6 +40,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Script", "Script", "{925D67 EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.Script", "src\WebApplication.Script\WebApplication.Script.xproj", "{8DC07B1F-ADAA-492C-8F2D-46B9EE579B44}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EFCoreRawQuery", "EFCoreRawQuery", "{28B1769B-CEA4-4B6F-B383-8A0FAF22F108}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.EFCoreRawQuery", "src\WebApplication.EFCoreRawQuery\WebApplication.EFCoreRawQuery.xproj", "{9E153732-43ED-4DA7-B464-32C391CC443E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -78,6 +82,10 @@ Global {8DC07B1F-ADAA-492C-8F2D-46B9EE579B44}.Debug|Any CPU.Build.0 = Debug|Any CPU {8DC07B1F-ADAA-492C-8F2D-46B9EE579B44}.Release|Any CPU.ActiveCfg = Release|Any CPU {8DC07B1F-ADAA-492C-8F2D-46B9EE579B44}.Release|Any CPU.Build.0 = Release|Any CPU + {9E153732-43ED-4DA7-B464-32C391CC443E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9E153732-43ED-4DA7-B464-32C391CC443E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9E153732-43ED-4DA7-B464-32C391CC443E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9E153732-43ED-4DA7-B464-32C391CC443E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -98,5 +106,7 @@ Global {A5C5400D-DD78-4192-B34B-06D81996F0DA} = {C49636B1-231E-45A2-8901-10EC68C7CB55} {925D6751-630E-48FF-9AF8-8DA9E09968CF} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} {8DC07B1F-ADAA-492C-8F2D-46B9EE579B44} = {925D6751-630E-48FF-9AF8-8DA9E09968CF} + {28B1769B-CEA4-4B6F-B383-8A0FAF22F108} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {9E153732-43ED-4DA7-B464-32C391CC443E} = {28B1769B-CEA4-4B6F-B383-8A0FAF22F108} EndGlobalSection EndGlobal diff --git a/src/WebApplication.EFCoreRawQuery/Controllers/ItemsController.cs b/src/WebApplication.EFCoreRawQuery/Controllers/ItemsController.cs new file mode 100644 index 0000000..87540e8 --- /dev/null +++ b/src/WebApplication.EFCoreRawQuery/Controllers/ItemsController.cs @@ -0,0 +1,45 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Mvc; +using WebApplication.EFCoreRawQuery.Models; + +namespace WebApplication.EFCoreRawQuery.Controllers +{ + [Route("api/[controller]")] + public class ItemsController : Controller + { + private IItemRepository _itemRepository { get; set; } + + public ItemsController(IItemRepository itemRepository) + { + _itemRepository = itemRepository; + } + + [HttpGet] + public IActionResult Get() + { + return Ok(_itemRepository.All()); + } + [HttpGet("{id}")] + public IActionResult Get(long id) + { + return Ok(_itemRepository.Find(id)); + } + [HttpPost] + public void Post([FromBody]Item value) + { + _itemRepository.Add(value); + } + [HttpPut("{id}")] + public void Put(long id, [FromBody]Item value) + { + _itemRepository.Update(id, value); + } + [HttpDelete("{id}")] + public void Delete(long id) + { + _itemRepository.Delete(id); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.EFCoreRawQuery/EFCoreRawQuery.cs b/src/WebApplication.EFCoreRawQuery/EFCoreRawQuery.cs new file mode 100644 index 0000000..1a96532 --- /dev/null +++ b/src/WebApplication.EFCoreRawQuery/EFCoreRawQuery.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ExtCore.Infrastructure; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.EntityFrameworkCore; +using WebApplication.EFCoreRawQuery.Models; + +namespace WebApplication.EFCoreRawQuery +{ + public class EFCoreRawQuery : IExtension + { + private IConfigurationRoot configurationRoot; + + public string Name + { + get + { + return "Extension EFCoreRawQuery"; + } + } + + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); + + routeRegistrarsByPriorities.Add( + 2000, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension EFCoreRawQuery", template: "{controller=Home}/{action=Index}/{id?}"); + } + ); + + return routeRegistrarsByPriorities; + } + } + + + public int ConfigureServicesPriorities + { + get + { + return 2001; + } + } + public int ConfigurePriorities + { + get + { + return 2001; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + public void ConfigureServices(IServiceCollection services) + { + services.AddEntityFrameworkSqlite(); + services.AddDbContext(options => + { + options.UseSqlite(this.configurationRoot["Data:DefaultConnection:ConnectionString"]); + }); + services.AddScoped(); + } + + public void Configure(IApplicationBuilder applicationBuilder) + { + } + } +} diff --git a/src/WebApplication.EFCoreRawQuery/Models/IItemRepository.cs b/src/WebApplication.EFCoreRawQuery/Models/IItemRepository.cs new file mode 100644 index 0000000..b92343c --- /dev/null +++ b/src/WebApplication.EFCoreRawQuery/Models/IItemRepository.cs @@ -0,0 +1,15 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +namespace WebApplication.EFCoreRawQuery.Models +{ + public interface IItemRepository + { + IEnumerable All(); + Item Find(long id); + void Add(Item value); + void Update(long id, Item value); + void Delete(long id); + } +} \ No newline at end of file diff --git a/src/WebApplication.EFCoreRawQuery/Models/Item.cs b/src/WebApplication.EFCoreRawQuery/Models/Item.cs new file mode 100644 index 0000000..41d9a8e --- /dev/null +++ b/src/WebApplication.EFCoreRawQuery/Models/Item.cs @@ -0,0 +1,11 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace WebApplication.EFCoreRawQuery.Models +{ + public class Item + { + public int Id { get; set; } + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/WebApplication.EFCoreRawQuery/Models/ItemDbContext.cs b/src/WebApplication.EFCoreRawQuery/Models/ItemDbContext.cs new file mode 100644 index 0000000..ecef139 --- /dev/null +++ b/src/WebApplication.EFCoreRawQuery/Models/ItemDbContext.cs @@ -0,0 +1,19 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.EntityFrameworkCore; + +namespace WebApplication.EFCoreRawQuery.Models +{ + public class ItemDbContext : DbContext + { + public ItemDbContext(DbContextOptions options) :base(options) + { } + public DbSet Items { get; set; } + protected override void OnModelCreating(ModelBuilder builder) + { + builder.Entity().HasKey(m => m.Id); + base.OnModelCreating(builder); + } + } +} \ No newline at end of file diff --git a/src/WebApplication.EFCoreRawQuery/Models/ItemRepository.cs b/src/WebApplication.EFCoreRawQuery/Models/ItemRepository.cs new file mode 100644 index 0000000..22130aa --- /dev/null +++ b/src/WebApplication.EFCoreRawQuery/Models/ItemRepository.cs @@ -0,0 +1,62 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Storage; + +namespace WebApplication.EFCoreRawQuery.Models +{ + public class ItemRepository : IItemRepository + { + private ItemDbContext _itemDbContext { get; set; } + public ItemRepository(ItemDbContext itemDbContext) + { + _itemDbContext = itemDbContext; + } + public IEnumerable All() + { + var sql = @" +SELECT Id, Name +FROM Item +WHERE +Name IN ('Electro', 'Nitro') +"; + // Execute a query. + //var dr = await _itemDbContext.Database.ExecuteSqlQueryAsync(sql); + var dr = _itemDbContext.Database.ExecuteSqlQuery(sql); + var result = dr.DbDataReader.GetEnumerator(); + // Output rows. + while (dr.DbDataReader.Read()) + System.Console.Write("{0}\t{1}} \n", dr[0], dr[1]); + + // Don't forget to dispose the DataReader! + dr.Dispose(); + return result.; + } + public Item Find(long id) + { + return _itemDbContext.Items.Where(i => i.Id == id).First(); + } + public void Add(Item value) + { + _itemDbContext.Items.Add(value); + _itemDbContext.SaveChanges(); + return; + } + public void Update(long id, Item value) + { + _itemDbContext.Items.Update(value); + _itemDbContext.SaveChanges(); + return; + } + public void Delete(long id) + { + var value =_itemDbContext.Items.Where(i => i.Id == id).First(); + _itemDbContext.Items.Remove(value); + _itemDbContext.SaveChanges(); + return; + } + } +} \ No newline at end of file diff --git a/src/WebApplication.EFCoreRawQuery/Properties/AssemblyInfo.cs b/src/WebApplication.EFCoreRawQuery/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b7c68d6 --- /dev/null +++ b/src/WebApplication.EFCoreRawQuery/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +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: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebApplication.EFCoreRawQuery")] +[assembly: AssemblyTrademark("")] + +// 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("9e153732-43ed-4da7-b464-32c391cc443e")] diff --git a/src/WebApplication.EFCoreRawQuery/RDFacadeExtensions.cs b/src/WebApplication.EFCoreRawQuery/RDFacadeExtensions.cs new file mode 100644 index 0000000..035d708 --- /dev/null +++ b/src/WebApplication.EFCoreRawQuery/RDFacadeExtensions.cs @@ -0,0 +1,105 @@ +//using Microsoft.AspNetCore.Identity.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Internal; +using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.Extensions.DependencyInjection; +//using SirenTek.Areas.TechDemo.Areas.SirenTransferTests.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using System.Reflection; +using System.Data.Common; + +namespace Microsoft.EntityFrameworkCore +{ + public static class RDFacadeExtensions + { + public static RelationalDataReader ExecuteSqlQuery(this DatabaseFacade databaseFacade, string sql, params object[] parameters) + { + var concurrencyDetector = databaseFacade.GetService(); + + using (concurrencyDetector.EnterCriticalSection()) + { + var rawSqlCommand = databaseFacade + .GetService() + .Build(sql, parameters); + + return rawSqlCommand + .RelationalCommand + .ExecuteReader( + databaseFacade.GetService(), + parameterValues: rawSqlCommand.ParameterValues); + } + } + + public static async Task ExecuteSqlCommandAsync(this DatabaseFacade databaseFacade, + string sql, + CancellationToken cancellationToken = default(CancellationToken), + params object[] parameters) + { + + var concurrencyDetector = databaseFacade.GetService(); + + using (concurrencyDetector.EnterCriticalSection()) + { + var rawSqlCommand = databaseFacade + .GetService() + .Build(sql, parameters); + + return await rawSqlCommand + .RelationalCommand + .ExecuteReaderAsync( + databaseFacade.GetService(), + parameterValues: rawSqlCommand.ParameterValues, + cancellationToken: cancellationToken); + } + } + public static IEnumerable GetModelFromQuery(this DatabaseFacade databaseFacade, string sql, params object[] parameters) + where T : new() + { + using (DbDataReader dr = databaseFacade.ExecuteSqlQuery(sql, parameters).DbDataReader) + { + List lst = new List(); + PropertyInfo[] props = typeof(T).GetProperties(); + while (dr.Read()) + { + T t = new T(); + IEnumerable actualNames = dr.GetColumnSchema().Select(o => o.ColumnName); + for (int i = 0; i < props.Length; ++i) + { + PropertyInfo pi = props[i]; + + if (!pi.CanWrite) continue; + + System.ComponentModel.DataAnnotations.Schema.ColumnAttribute ca = pi.GetCustomAttribute(typeof(System.ComponentModel.DataAnnotations.Schema.ColumnAttribute)) as System.ComponentModel.DataAnnotations.Schema.ColumnAttribute; + string name = ca?.Name ?? pi.Name; + + if (pi == null) continue; + + if (!actualNames.Contains(name)) + { + continue; + } + object value = dr[name]; + Type pt = pi.DeclaringType; + bool nullable = pt.GetTypeInfo().IsGenericType && pt.GetGenericTypeDefinition() == typeof(Nullable<>); + if (value == DBNull.Value) + { + value = null; + } + if (value == null && pt.GetTypeInfo().IsValueType && !nullable) + { + value = Activator.CreateInstance(pt); + } + pi.SetValue(t, value); + }//for i + lst.Add(t); + }//while + return lst; + }//using dr + } + } +} \ No newline at end of file diff --git a/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.xproj b/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.xproj new file mode 100644 index 0000000..dfaf250 --- /dev/null +++ b/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + 9e153732-43ed-4da7-b464-32c391cc443e + WebApplication.EFCoreRawQuery + .\obj + .\bin\ + v4.5.2 + + + + 2.0 + + + diff --git a/src/WebApplication.EFCoreRawQuery/project.json b/src/WebApplication.EFCoreRawQuery/project.json new file mode 100644 index 0000000..e1e9815 --- /dev/null +++ b/src/WebApplication.EFCoreRawQuery/project.json @@ -0,0 +1,21 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "NETStandard.Library": "1.6.0", + "ExtCore.Infrastructure": "1.0.0-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.0", + "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0" + + }, + + "frameworks": { + "netstandard1.6": { + "imports": [ + "dotnet5.6", + "dnxcore50", + "portable-net45+win8" + ] + } + } +} diff --git a/src/WebApplication.Swagger/Swagger.cs b/src/WebApplication.Swagger/Swagger.cs index 215bbeb..b4fd564 100644 --- a/src/WebApplication.Swagger/Swagger.cs +++ b/src/WebApplication.Swagger/Swagger.cs @@ -78,7 +78,7 @@ public void ConfigureServices(IServiceCollection services) }); //options.IncludeXmlComments(pathToDoc); options.DescribeAllEnumsAsStrings(); - options.CustomSchemaIds(otions => options.GetType().FullName); + options.CustomSchemaIds(type => type.FullName); options.OperationFilter(); }); } From 3783049efbe57492d5c81019a6e9a680ce77c37a Mon Sep 17 00:00:00 2001 From: USER001 F Date: Tue, 6 Dec 2016 06:47:50 +0900 Subject: [PATCH 09/18] change src --- .../Controllers/ItemsController.cs | 2 +- .../Models/ItemRepository.cs | 16 +++------------- .../RDFacadeExtensions.cs | 4 +--- src/WebApplication/gulpfile.js | 1 + 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/WebApplication.EFCoreRawQuery/Controllers/ItemsController.cs b/src/WebApplication.EFCoreRawQuery/Controllers/ItemsController.cs index 87540e8..c00d17a 100644 --- a/src/WebApplication.EFCoreRawQuery/Controllers/ItemsController.cs +++ b/src/WebApplication.EFCoreRawQuery/Controllers/ItemsController.cs @@ -6,7 +6,7 @@ namespace WebApplication.EFCoreRawQuery.Controllers { - [Route("api/[controller]")] + [Route("api/sql/[controller]")] public class ItemsController : Controller { private IItemRepository _itemRepository { get; set; } diff --git a/src/WebApplication.EFCoreRawQuery/Models/ItemRepository.cs b/src/WebApplication.EFCoreRawQuery/Models/ItemRepository.cs index 22130aa..eddcfa7 100644 --- a/src/WebApplication.EFCoreRawQuery/Models/ItemRepository.cs +++ b/src/WebApplication.EFCoreRawQuery/Models/ItemRepository.cs @@ -19,21 +19,11 @@ public IEnumerable All() { var sql = @" SELECT Id, Name -FROM Item -WHERE -Name IN ('Electro', 'Nitro') +FROM Items "; - // Execute a query. - //var dr = await _itemDbContext.Database.ExecuteSqlQueryAsync(sql); - var dr = _itemDbContext.Database.ExecuteSqlQuery(sql); - var result = dr.DbDataReader.GetEnumerator(); - // Output rows. - while (dr.DbDataReader.Read()) - System.Console.Write("{0}\t{1}} \n", dr[0], dr[1]); + var result = _itemDbContext.Database.GetModelFromQuery(sql); - // Don't forget to dispose the DataReader! - dr.Dispose(); - return result.; + return result; } public Item Find(long id) { diff --git a/src/WebApplication.EFCoreRawQuery/RDFacadeExtensions.cs b/src/WebApplication.EFCoreRawQuery/RDFacadeExtensions.cs index 035d708..cc7021c 100644 --- a/src/WebApplication.EFCoreRawQuery/RDFacadeExtensions.cs +++ b/src/WebApplication.EFCoreRawQuery/RDFacadeExtensions.cs @@ -1,10 +1,8 @@ -//using Microsoft.AspNetCore.Identity.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Internal; using Microsoft.EntityFrameworkCore.Storage; using Microsoft.Extensions.DependencyInjection; -//using SirenTek.Areas.TechDemo.Areas.SirenTransferTests.Models; using System; using System.Collections.Generic; using System.Linq; diff --git a/src/WebApplication/gulpfile.js b/src/WebApplication/gulpfile.js index a93db9a..6dc8345 100644 --- a/src/WebApplication/gulpfile.js +++ b/src/WebApplication/gulpfile.js @@ -2,6 +2,7 @@ gulp.task( "copy-extensions", function (cb) { + gulp.src(["../WebApplication.EFCoreRawQuery/bin/Debug/netstandard1.6/WebApplication.EFCoreRawQuery.dll"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.NLog/bin/Debug/netstandard1.6/WebApplication.NLog.dll"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.Elm/bin/Debug/netstandard1.6/WebApplication.Elm.dll"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.ExtensionA/bin/Debug/netstandard1.6/WebApplication.ExtensionA.dll"]).pipe(gulp.dest("Extensions")); From dae77997d447899c5fc08d5a1d6f0a21629dd7c4 Mon Sep 17 00:00:00 2001 From: USER001 F Date: Fri, 10 Feb 2017 00:15:30 +0900 Subject: [PATCH 10/18] Add Cake-Build --- .gitignore | 5 +- NuGet.config | 5 +- build.cake | 118 +++++++++++ build.ps1 | 189 ++++++++++++++++++ build.sh | 101 ++++++++++ .../project.json | 6 +- src/WebApplication.Elm/project.json | 4 +- src/WebApplication.ExtensionA/project.json | 4 +- src/WebApplication.ExtensionB/project.json | 6 +- src/WebApplication.NLog/project.json | 4 +- src/WebApplication.Script/project.json | 4 +- src/WebApplication.Swagger/project.json | 4 +- src/WebApplication.WebAPI/project.json | 6 +- src/WebApplication/project.json | 10 +- 14 files changed, 437 insertions(+), 29 deletions(-) create mode 100644 build.cake create mode 100644 build.ps1 create mode 100644 build.sh diff --git a/.gitignore b/.gitignore index 9aefda2..c8e49b1 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,7 @@ src/WebApplication/node_modules/ *.xproj.user *.lock.json *.dll -*.log \ No newline at end of file +*.log +tools/ +packages/ +artifacts/ \ No newline at end of file diff --git a/NuGet.config b/NuGet.config index 590be3b..154a770 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,10 +1,7 @@  - + - - - \ No newline at end of file diff --git a/build.cake b/build.cake new file mode 100644 index 0000000..03f204f --- /dev/null +++ b/build.cake @@ -0,0 +1,118 @@ +var target = Argument("target", "Default"); +var configuration = Argument("configuration", "Release"); + +/////////////////////////////////////////////////////////////////////////////// +// GLOBAL VARIABLES +/////////////////////////////////////////////////////////////////////////////// +var isLocalBuild = !AppVeyor.IsRunningOnAppVeyor; +var packPath1 = Directory("./src/WebApplication"); +var packPath2 = Directory("./src/WebApplication.EFCoreRawQuery"); +var packPath3 = Directory("./src/WebApplication.Elm"); +var packPath4 = Directory("./src/WebApplication.ExtensionA"); +var packPath5 = Directory("./src/WebApplication.ExtensionB"); +var packPath6 = Directory("./src/WebApplication.NLog"); +var packPath7 = Directory("./src/WebApplication.Script"); +var packPath8 = Directory("./src/WebApplication.Swagger"); +var packPath9 = Directory("./src/WebApplication.WebAPI"); +var sourcePath = Directory("./src"); +var testsPath = Directory("test"); +var buildArtifacts = Directory("./artifacts/packages"); + +Task("Build") + .IsDependentOn("Clean") + .IsDependentOn("Restore") + .Does(() => +{ + var projects = GetFiles("./**/project.json"); + + foreach(var project in projects) + { + var settings = new DotNetCoreBuildSettings + { + Configuration = configuration + // Runtime = IsRunningOnWindows() ? null : "unix-x64" + }; + + DotNetCoreBuild(project.GetDirectory().FullPath, settings); + } +}); + +Task("RunTests") + .IsDependentOn("Restore") + .IsDependentOn("Clean") + .Does(() => +{ + var projects = GetFiles("./test/**/project.json"); + + foreach(var project in projects) + { + var settings = new DotNetCoreTestSettings + { + Configuration = configuration + }; + + if (!IsRunningOnWindows()) + { + Information("Not running on Windows - skipping tests for full .NET Framework"); + settings.Framework = "netcoreapp1.0"; + } + + DotNetCoreTest(project.GetDirectory().FullPath, settings); + } +}); + +Task("Pack") + .IsDependentOn("Restore") + .IsDependentOn("Clean") + .Does(() => +{ + var settings = new DotNetCorePackSettings + { + Configuration = configuration, + OutputDirectory = buildArtifacts, + }; + + // add build suffix for CI builds + if(!isLocalBuild) + { + settings.VersionSuffix = "build" + AppVeyor.Environment.Build.Number.ToString().PadLeft(5,'0'); + } + + DotNetCorePack(packPath1, settings); + DotNetCorePack(packPath2, settings); + DotNetCorePack(packPath3, settings); + DotNetCorePack(packPath4, settings); + DotNetCorePack(packPath5, settings); + DotNetCorePack(packPath6, settings); + DotNetCorePack(packPath7, settings); + DotNetCorePack(packPath8, settings); + DotNetCorePack(packPath9, settings); +}); + +Task("Clean") + .Does(() => +{ + CleanDirectories(new DirectoryPath[] { buildArtifacts }); +}); + +Task("Restore") + .Does(() => +{ + var settings = new DotNetCoreRestoreSettings + { + Sources = new [] { + "packages", + "https://api.nuget.org/v3/index.json" + } + }; + + DotNetCoreRestore(sourcePath, settings); + //DotNetCoreRestore(testsPath, settings); +}); + +Task("Default") + .IsDependentOn("Build"); + //.IsDependentOn("RunTests") + //.IsDependentOn("Pack"); + +RunTarget(target); \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..44de579 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,189 @@ +########################################################################## +# This is the Cake bootstrapper script for PowerShell. +# This file was downloaded from https://github.com/cake-build/resources +# Feel free to change this file to fit your needs. +########################################################################## + +<# + +.SYNOPSIS +This is a Powershell script to bootstrap a Cake build. + +.DESCRIPTION +This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) +and execute your Cake build script with the parameters you provide. + +.PARAMETER Script +The build script to execute. +.PARAMETER Target +The build script target to run. +.PARAMETER Configuration +The build configuration to use. +.PARAMETER Verbosity +Specifies the amount of information to be displayed. +.PARAMETER Experimental +Tells Cake to use the latest Roslyn release. +.PARAMETER WhatIf +Performs a dry run of the build script. +No tasks will be executed. +.PARAMETER Mono +Tells Cake to use the Mono scripting engine. +.PARAMETER SkipToolPackageRestore +Skips restoring of packages. +.PARAMETER ScriptArgs +Remaining arguments are added here. + +.LINK +http://cakebuild.net + +#> + +[CmdletBinding()] +Param( + [string]$Script = "build.cake", + [string]$Target = "Default", + [ValidateSet("Release", "Debug")] + [string]$Configuration = "Release", + [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] + [string]$Verbosity = "Verbose", + [switch]$Experimental, + [Alias("DryRun","Noop")] + [switch]$WhatIf, + [switch]$Mono, + [switch]$SkipToolPackageRestore, + [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] + [string[]]$ScriptArgs +) + +[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null +function MD5HashFile([string] $filePath) +{ + if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf)) + { + return $null + } + + [System.IO.Stream] $file = $null; + [System.Security.Cryptography.MD5] $md5 = $null; + try + { + $md5 = [System.Security.Cryptography.MD5]::Create() + $file = [System.IO.File]::OpenRead($filePath) + return [System.BitConverter]::ToString($md5.ComputeHash($file)) + } + finally + { + if ($file -ne $null) + { + $file.Dispose() + } + } +} + +Write-Host "Preparing to run build script..." + +if(!$PSScriptRoot){ + $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent +} + +$TOOLS_DIR = Join-Path $PSScriptRoot "tools" +$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" +$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" +$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" +$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" +$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum" + +# Should we use mono? +$UseMono = ""; +if($Mono.IsPresent) { + Write-Verbose -Message "Using the Mono based scripting engine." + $UseMono = "-mono" +} + +# Should we use the new Roslyn? +$UseExperimental = ""; +if($Experimental.IsPresent -and !($Mono.IsPresent)) { + Write-Verbose -Message "Using experimental version of Roslyn." + $UseExperimental = "-experimental" +} + +# Is this a dry run? +$UseDryRun = ""; +if($WhatIf.IsPresent) { + $UseDryRun = "-dryrun" +} + +# Make sure tools folder exists +if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { + Write-Verbose -Message "Creating tools directory..." + New-Item -Path $TOOLS_DIR -Type directory | out-null +} + +# Make sure that packages.config exist. +if (!(Test-Path $PACKAGES_CONFIG)) { + Write-Verbose -Message "Downloading packages.config..." + try { (New-Object System.Net.WebClient).DownloadFile("http://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch { + Throw "Could not download packages.config." + } +} + +# Try find NuGet.exe in path if not exists +if (!(Test-Path $NUGET_EXE)) { + Write-Verbose -Message "Trying to find nuget.exe in PATH..." + $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_) } + $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 + if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { + Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." + $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName + } +} + +# Try download NuGet.exe if not exists +if (!(Test-Path $NUGET_EXE)) { + Write-Verbose -Message "Downloading NuGet.exe..." + try { + (New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE) + } catch { + Throw "Could not download NuGet.exe." + } +} + +# Save nuget.exe path to environment to be available to child processed +$ENV:NUGET_EXE = $NUGET_EXE + +# Restore tools from NuGet? +if(-Not $SkipToolPackageRestore.IsPresent) { + Push-Location + Set-Location $TOOLS_DIR + + # Check for changes in packages.config and remove installed tools if true. + [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG) + if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or + ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { + Write-Verbose -Message "Missing or changed package.config hash..." + Remove-Item * -Recurse -Exclude packages.config,nuget.exe + } + + Write-Verbose -Message "Restoring tools from NuGet..." + $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" + + if ($LASTEXITCODE -ne 0) { + Throw "An error occured while restoring NuGet tools." + } + else + { + $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" + } + Write-Verbose -Message ($NuGetOutput | out-string) + Pop-Location +} + +# Make sure that Cake has been installed. +if (!(Test-Path $CAKE_EXE)) { + Throw "Could not find Cake.exe at $CAKE_EXE" +} + +# Start Cake +Write-Host "Running build script..." +Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs" +exit $LASTEXITCODE \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..6e8f207 --- /dev/null +++ b/build.sh @@ -0,0 +1,101 @@ +#!/usr/bin/env bash + +########################################################################## +# This is the Cake bootstrapper script for Linux and OS X. +# This file was downloaded from https://github.com/cake-build/resources +# Feel free to change this file to fit your needs. +########################################################################## + +# Define directories. +SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +TOOLS_DIR=$SCRIPT_DIR/tools +NUGET_EXE=$TOOLS_DIR/nuget.exe +CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe +PACKAGES_CONFIG=$TOOLS_DIR/packages.config +PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum + +# Define md5sum or md5 depending on Linux/OSX +MD5_EXE= +if [[ "$(uname -s)" == "Darwin" ]]; then + MD5_EXE="md5 -r" +else + MD5_EXE="md5sum" +fi + +# Define default arguments. +SCRIPT="build.cake" +TARGET="Default" +CONFIGURATION="Release" +VERBOSITY="verbose" +DRYRUN= +SHOW_VERSION=false +SCRIPT_ARGUMENTS=() + +# Parse arguments. +for i in "$@"; do + case $1 in + -s|--script) SCRIPT="$2"; shift ;; + -t|--target) TARGET="$2"; shift ;; + -c|--configuration) CONFIGURATION="$2"; shift ;; + -v|--verbosity) VERBOSITY="$2"; shift ;; + -d|--dryrun) DRYRUN="-dryrun" ;; + --version) SHOW_VERSION=true ;; + --) shift; SCRIPT_ARGUMENTS+=("$@"); break ;; + *) SCRIPT_ARGUMENTS+=("$1") ;; + esac + shift +done + +# Make sure the tools folder exist. +if [ ! -d "$TOOLS_DIR" ]; then + mkdir "$TOOLS_DIR" +fi + +# Make sure that packages.config exist. +if [ ! -f "$TOOLS_DIR/packages.config" ]; then + echo "Downloading packages.config..." + curl -Lsfo "$TOOLS_DIR/packages.config" http://cakebuild.net/download/bootstrapper/packages + if [ $? -ne 0 ]; then + echo "An error occured while downloading packages.config." + exit 1 + fi +fi + +# Download NuGet if it does not exist. +if [ ! -f "$NUGET_EXE" ]; then + echo "Downloading NuGet..." + curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe + if [ $? -ne 0 ]; then + echo "An error occured while downloading nuget.exe." + exit 1 + fi +fi + +# Restore tools from NuGet. +pushd "$TOOLS_DIR" >/dev/null +if [ ! -f $PACKAGES_CONFIG_MD5 ] || [ "$( cat $PACKAGES_CONFIG_MD5 | sed 's/\r$//' )" != "$( $MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' )" ]; then + find . -type d ! -name . | xargs rm -rf +fi + +mono "$NUGET_EXE" install -ExcludeVersion +if [ $? -ne 0 ]; then + echo "Could not restore NuGet packages." + exit 1 +fi + +$MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' >| $PACKAGES_CONFIG_MD5 + +popd >/dev/null + +# Make sure that Cake has been installed. +if [ ! -f "$CAKE_EXE" ]; then + echo "Could not find Cake.exe at '$CAKE_EXE'." + exit 1 +fi + +# Start Cake +if $SHOW_VERSION; then + exec mono "$CAKE_EXE" -version +else + exec mono "$CAKE_EXE" $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}" +fi \ No newline at end of file diff --git a/src/WebApplication.EFCoreRawQuery/project.json b/src/WebApplication.EFCoreRawQuery/project.json index e1e9815..49998d0 100644 --- a/src/WebApplication.EFCoreRawQuery/project.json +++ b/src/WebApplication.EFCoreRawQuery/project.json @@ -3,9 +3,9 @@ "dependencies": { "NETStandard.Library": "1.6.0", - "ExtCore.Infrastructure": "1.0.0-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.0", - "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0" + "ExtCore.Infrastructure": "1.0.1-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.1", + "Microsoft.EntityFrameworkCore.Sqlite": "1.0.1" }, diff --git a/src/WebApplication.Elm/project.json b/src/WebApplication.Elm/project.json index 3438a4f..b0f0e96 100644 --- a/src/WebApplication.Elm/project.json +++ b/src/WebApplication.Elm/project.json @@ -3,8 +3,8 @@ "dependencies": { "NETStandard.Library": "1.6.0", - "ExtCore.Infrastructure": "1.0.0-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.0", + "ExtCore.Infrastructure": "1.0.1-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.1", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", "Microsoft.AspNetCore.Diagnostics.Elm": "0.1.0" }, diff --git a/src/WebApplication.ExtensionA/project.json b/src/WebApplication.ExtensionA/project.json index 29b1708..65db730 100644 --- a/src/WebApplication.ExtensionA/project.json +++ b/src/WebApplication.ExtensionA/project.json @@ -2,8 +2,8 @@ "authors": [ "Dmitry Sikorsky" ], "buildOptions": { "embed": [ "Styles/**", "Views/**" ] }, "dependencies": { - "ExtCore.Infrastructure": "1.0.0-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.0", + "ExtCore.Infrastructure": "1.0.1-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.1", "NETStandard.Library": "1.6.0" }, "frameworks": { diff --git a/src/WebApplication.ExtensionB/project.json b/src/WebApplication.ExtensionB/project.json index ebd75b0..fa25109 100644 --- a/src/WebApplication.ExtensionB/project.json +++ b/src/WebApplication.ExtensionB/project.json @@ -2,10 +2,10 @@ "authors": [ "Dmitry Sikorsky" ], "buildOptions": { "embed": [ "Views/**" ] }, "dependencies": { - "ExtCore.Infrastructure": "1.0.0-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.0", + "ExtCore.Infrastructure": "1.0.1-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.1", "NETStandard.Library": "1.6.0", - "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0" + "Microsoft.EntityFrameworkCore.Sqlite": "1.0.1" }, "frameworks": { "netstandard1.6": { diff --git a/src/WebApplication.NLog/project.json b/src/WebApplication.NLog/project.json index c6f5370..9c4e9ac 100644 --- a/src/WebApplication.NLog/project.json +++ b/src/WebApplication.NLog/project.json @@ -2,8 +2,8 @@ "version": "1.0.0-*", "dependencies": { - "ExtCore.Infrastructure": "1.0.0-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.0", + "ExtCore.Infrastructure": "1.0.1-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.1", "NETStandard.Library": "1.6.0", "Microsoft.Extensions.Logging": "1.0.0", "Microsoft.Extensions.Logging.Console": "1.0.0", diff --git a/src/WebApplication.Script/project.json b/src/WebApplication.Script/project.json index aa5a55f..b6fc3e0 100644 --- a/src/WebApplication.Script/project.json +++ b/src/WebApplication.Script/project.json @@ -4,8 +4,8 @@ "dependencies": { "NETStandard.Library": "1.6.0", "Microsoft.CodeAnalysis.CSharp.Scripting": "1.3.2", - "ExtCore.Infrastructure": "1.0.0-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.0" + "ExtCore.Infrastructure": "1.0.1-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.1" }, "frameworks": { diff --git a/src/WebApplication.Swagger/project.json b/src/WebApplication.Swagger/project.json index e799d59..918df76 100644 --- a/src/WebApplication.Swagger/project.json +++ b/src/WebApplication.Swagger/project.json @@ -2,9 +2,9 @@ "version": "1.0.0-*", "dependencies": { - "ExtCore.Infrastructure": "1.0.0-alpha901", + "ExtCore.Infrastructure": "1.0.1-alpha901", "NETStandard.Library": "1.6.0", - "Microsoft.AspNetCore.Mvc": "1.0.0", + "Microsoft.AspNetCore.Mvc": "1.0.1", "Swashbuckle": "6.0.0-beta902", "Swashbuckle.Swagger": "6.0.0-beta902" }, diff --git a/src/WebApplication.WebAPI/project.json b/src/WebApplication.WebAPI/project.json index e6ced2b..e18cbbd 100644 --- a/src/WebApplication.WebAPI/project.json +++ b/src/WebApplication.WebAPI/project.json @@ -3,9 +3,9 @@ "dependencies": { "NETStandard.Library": "1.6.0", - "ExtCore.Infrastructure": "1.0.0-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.0", - "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0" + "ExtCore.Infrastructure": "1.0.1-alpha901", + "Microsoft.AspNetCore.Mvc": "1.0.1", + "Microsoft.EntityFrameworkCore.Sqlite": "1.0.1" }, "frameworks": { diff --git a/src/WebApplication/project.json b/src/WebApplication/project.json index ba08102..f1838e1 100644 --- a/src/WebApplication/project.json +++ b/src/WebApplication/project.json @@ -7,12 +7,12 @@ "preserveCompilationContext": true }, "dependencies": { - "ExtCore.Infrastructure": "1.0.0-alpha901", - "ExtCore.WebApplication": "1.0.0-alpha901", + "ExtCore.Infrastructure": "1.0.1-alpha901", + "ExtCore.WebApplication": "1.0.1-alpha901", "Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", - "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", + "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", "Microsoft.Extensions.Configuration.Json": "1.0.0", "Microsoft.NETCore.App": { "version": "1.0.0", @@ -24,9 +24,9 @@ "Microsoft.Extensions.Logging.Debug": "1.0.0", "NLog.Extensions.Logging": "1.0.0-rtm-alpha2", "NLog.Web.AspNetCore": "4.2.4", - "Microsoft.EntityFrameworkCore.Sqlite": "1.0.0", + "Microsoft.EntityFrameworkCore.Sqlite": "1.0.1", //"NETStandard.Library": "1.6.0", - "Microsoft.AspNetCore.Mvc": "1.0.0", + "Microsoft.AspNetCore.Mvc": "1.0.1", "Microsoft.AspNetCore.Diagnostics.Elm": "0.1.0", "Swashbuckle": "6.0.0-beta902", "Swashbuckle.Swagger": "6.0.0-beta902", From 003073ba0d5755b9e60d4b69a293b91b8b057e0d Mon Sep 17 00:00:00 2001 From: USER001 F Date: Sat, 22 Apr 2017 14:05:17 +0900 Subject: [PATCH 11/18] Update Visual Sudio 2017 --- WebApplication.sln | 57 +++++++++--------- global.json | 6 -- packages/.gitkeep | 0 .../WebApplication.EFCoreRawQuery.csproj | 20 +++++++ .../WebApplication.EFCoreRawQuery.xproj | 21 ------- .../project.json | 21 ------- .../WebApplication.Elm.csproj | 21 +++++++ .../WebApplication.Elm.xproj | 21 ------- src/WebApplication.Elm/project.json | 21 ------- .../WebApplication.ExtensionA.csproj | 21 +++++++ .../WebApplication.ExtensionA.xproj | 19 ------ src/WebApplication.ExtensionA/project.json | 19 ------ .../WebApplication.ExtensionB.csproj | 22 +++++++ .../WebApplication.ExtensionB.xproj | 19 ------ src/WebApplication.ExtensionB/project.json | 20 ------- .../WebApplication.NLog.csproj | 24 ++++++++ .../WebApplication.NLog.xproj | 21 ------- src/WebApplication.NLog/project.json | 24 -------- .../WebApplication.Script.csproj | 20 +++++++ .../WebApplication.Script.xproj | 21 ------- src/WebApplication.Script/project.json | 20 ------- .../WebApplication.Swagger.csproj | 21 +++++++ .../WebApplication.Swagger.xproj | 21 ------- src/WebApplication.Swagger/project.json | 21 ------- .../WebApplication.WebAPI.csproj | 20 +++++++ .../WebApplication.WebAPI.xproj | 21 ------- src/WebApplication.WebAPI/project.json | 20 ------- src/WebApplication/WebApplication.csproj | 42 +++++++++++++ src/WebApplication/WebApplication.xproj | 19 ------ src/WebApplication/project.json | 59 ------------------- .../runtimeconfig.template.json | 3 + 31 files changed, 241 insertions(+), 444 deletions(-) delete mode 100644 global.json create mode 100644 packages/.gitkeep create mode 100644 src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.csproj delete mode 100644 src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.xproj delete mode 100644 src/WebApplication.EFCoreRawQuery/project.json create mode 100644 src/WebApplication.Elm/WebApplication.Elm.csproj delete mode 100644 src/WebApplication.Elm/WebApplication.Elm.xproj delete mode 100644 src/WebApplication.Elm/project.json create mode 100644 src/WebApplication.ExtensionA/WebApplication.ExtensionA.csproj delete mode 100644 src/WebApplication.ExtensionA/WebApplication.ExtensionA.xproj delete mode 100644 src/WebApplication.ExtensionA/project.json create mode 100644 src/WebApplication.ExtensionB/WebApplication.ExtensionB.csproj delete mode 100644 src/WebApplication.ExtensionB/WebApplication.ExtensionB.xproj delete mode 100644 src/WebApplication.ExtensionB/project.json create mode 100644 src/WebApplication.NLog/WebApplication.NLog.csproj delete mode 100644 src/WebApplication.NLog/WebApplication.NLog.xproj delete mode 100644 src/WebApplication.NLog/project.json create mode 100644 src/WebApplication.Script/WebApplication.Script.csproj delete mode 100644 src/WebApplication.Script/WebApplication.Script.xproj delete mode 100644 src/WebApplication.Script/project.json create mode 100644 src/WebApplication.Swagger/WebApplication.Swagger.csproj delete mode 100644 src/WebApplication.Swagger/WebApplication.Swagger.xproj delete mode 100644 src/WebApplication.Swagger/project.json create mode 100644 src/WebApplication.WebAPI/WebApplication.WebAPI.csproj delete mode 100644 src/WebApplication.WebAPI/WebApplication.WebAPI.xproj delete mode 100644 src/WebApplication.WebAPI/project.json create mode 100644 src/WebApplication/WebApplication.csproj delete mode 100644 src/WebApplication/WebApplication.xproj delete mode 100644 src/WebApplication/project.json create mode 100644 src/WebApplication/runtimeconfig.template.json diff --git a/WebApplication.sln b/WebApplication.sln index 2c52f67..443aed3 100644 --- a/WebApplication.sln +++ b/WebApplication.sln @@ -1,48 +1,45 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{ABB81F71-8F88-41F7-A235-9458DB99BB7D}" - ProjectSection(SolutionItems) = preProject - global.json = global.json - EndProjectSection -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication", "src\WebApplication\WebApplication.xproj", "{B511B595-A980-4D5C-BC2A-BCCB4065B433}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionA", "src\WebApplication.ExtensionA\WebApplication.ExtensionA.xproj", "{8D722841-4E2C-4673-A7CC-C2690EFE3915}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExtensionA", "ExtensionA", "{F92B44CF-63EE-4781-8244-48ACC5386A8C}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExtensionB", "ExtensionB", "{4EA56716-702B-485A-A23A-10E110A85D78}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.ExtensionB", "src\WebApplication.ExtensionB\WebApplication.ExtensionB.xproj", "{396A8530-C500-469E-9F6F-A2D9C286C47D}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NLog", "NLog", "{511BD310-4C03-407B-92EA-34110884C547}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.NLog", "src\WebApplication.NLog\WebApplication.NLog.xproj", "{9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Swagger", "Swagger", "{8327C820-20D1-4095-8771-E03613D1969F}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.Swagger", "src\WebApplication.Swagger\WebApplication.Swagger.xproj", "{95E5595E-410B-4A6D-8822-4C07FDC3CF21}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebAPI", "WebAPI", "{FDEA400A-7F71-4A17-8419-030D80F74A3F}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.WebAPI", "src\WebApplication.WebAPI\WebApplication.WebAPI.xproj", "{7DE66111-BBB6-4C93-B864-9E65CAFD505B}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Elm", "Elm", "{C49636B1-231E-45A2-8901-10EC68C7CB55}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.Elm", "src\WebApplication.Elm\WebApplication.Elm.xproj", "{A5C5400D-DD78-4192-B34B-06D81996F0DA}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Script", "Script", "{925D6751-630E-48FF-9AF8-8DA9E09968CF}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.Script", "src\WebApplication.Script\WebApplication.Script.xproj", "{8DC07B1F-ADAA-492C-8F2D-46B9EE579B44}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EFCoreRawQuery", "EFCoreRawQuery", "{28B1769B-CEA4-4B6F-B383-8A0FAF22F108}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebApplication.EFCoreRawQuery", "src\WebApplication.EFCoreRawQuery\WebApplication.EFCoreRawQuery.xproj", "{9E153732-43ED-4DA7-B464-32C391CC443E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication", "src\WebApplication\WebApplication.csproj", "{B511B595-A980-4D5C-BC2A-BCCB4065B433}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication.ExtensionA", "src\WebApplication.ExtensionA\WebApplication.ExtensionA.csproj", "{8D722841-4E2C-4673-A7CC-C2690EFE3915}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication.ExtensionB", "src\WebApplication.ExtensionB\WebApplication.ExtensionB.csproj", "{396A8530-C500-469E-9F6F-A2D9C286C47D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication.NLog", "src\WebApplication.NLog\WebApplication.NLog.csproj", "{9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication.Swagger", "src\WebApplication.Swagger\WebApplication.Swagger.csproj", "{95E5595E-410B-4A6D-8822-4C07FDC3CF21}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication.WebAPI", "src\WebApplication.WebAPI\WebApplication.WebAPI.csproj", "{7DE66111-BBB6-4C93-B864-9E65CAFD505B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication.Elm", "src\WebApplication.Elm\WebApplication.Elm.csproj", "{A5C5400D-DD78-4192-B34B-06D81996F0DA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication.Script", "src\WebApplication.Script\WebApplication.Script.csproj", "{8DC07B1F-ADAA-492C-8F2D-46B9EE579B44}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication.EFCoreRawQuery", "src\WebApplication.EFCoreRawQuery\WebApplication.EFCoreRawQuery.csproj", "{9E153732-43ED-4DA7-B464-32C391CC443E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -91,22 +88,22 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {B511B595-A980-4D5C-BC2A-BCCB4065B433} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} - {8D722841-4E2C-4673-A7CC-C2690EFE3915} = {F92B44CF-63EE-4781-8244-48ACC5386A8C} {F92B44CF-63EE-4781-8244-48ACC5386A8C} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} {4EA56716-702B-485A-A23A-10E110A85D78} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} - {396A8530-C500-469E-9F6F-A2D9C286C47D} = {4EA56716-702B-485A-A23A-10E110A85D78} {511BD310-4C03-407B-92EA-34110884C547} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} - {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9} = {511BD310-4C03-407B-92EA-34110884C547} {8327C820-20D1-4095-8771-E03613D1969F} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} - {95E5595E-410B-4A6D-8822-4C07FDC3CF21} = {8327C820-20D1-4095-8771-E03613D1969F} {FDEA400A-7F71-4A17-8419-030D80F74A3F} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} - {7DE66111-BBB6-4C93-B864-9E65CAFD505B} = {FDEA400A-7F71-4A17-8419-030D80F74A3F} {C49636B1-231E-45A2-8901-10EC68C7CB55} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} - {A5C5400D-DD78-4192-B34B-06D81996F0DA} = {C49636B1-231E-45A2-8901-10EC68C7CB55} {925D6751-630E-48FF-9AF8-8DA9E09968CF} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} - {8DC07B1F-ADAA-492C-8F2D-46B9EE579B44} = {925D6751-630E-48FF-9AF8-8DA9E09968CF} {28B1769B-CEA4-4B6F-B383-8A0FAF22F108} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {B511B595-A980-4D5C-BC2A-BCCB4065B433} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {8D722841-4E2C-4673-A7CC-C2690EFE3915} = {F92B44CF-63EE-4781-8244-48ACC5386A8C} + {396A8530-C500-469E-9F6F-A2D9C286C47D} = {4EA56716-702B-485A-A23A-10E110A85D78} + {9E4B65AB-3F34-4C81-B02D-8E5643D2B3B9} = {511BD310-4C03-407B-92EA-34110884C547} + {95E5595E-410B-4A6D-8822-4C07FDC3CF21} = {8327C820-20D1-4095-8771-E03613D1969F} + {7DE66111-BBB6-4C93-B864-9E65CAFD505B} = {FDEA400A-7F71-4A17-8419-030D80F74A3F} + {A5C5400D-DD78-4192-B34B-06D81996F0DA} = {C49636B1-231E-45A2-8901-10EC68C7CB55} + {8DC07B1F-ADAA-492C-8F2D-46B9EE579B44} = {925D6751-630E-48FF-9AF8-8DA9E09968CF} {9E153732-43ED-4DA7-B464-32C391CC443E} = {28B1769B-CEA4-4B6F-B383-8A0FAF22F108} EndGlobalSection EndGlobal diff --git a/global.json b/global.json deleted file mode 100644 index 96bedd9..0000000 --- a/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "projects": [ "src" ], - "sdk": { - "version": "1.0.0-preview2-003133" - } -} \ No newline at end of file diff --git a/packages/.gitkeep b/packages/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.csproj b/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.csproj new file mode 100644 index 0000000..a237f0b --- /dev/null +++ b/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.csproj @@ -0,0 +1,20 @@ + + + + netstandard1.6 + WebApplication.EFCoreRawQuery + WebApplication.EFCoreRawQuery + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + + + + + + + + + diff --git a/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.xproj b/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.xproj deleted file mode 100644 index dfaf250..0000000 --- a/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - 9e153732-43ed-4da7-b464-32c391cc443e - WebApplication.EFCoreRawQuery - .\obj - .\bin\ - v4.5.2 - - - - 2.0 - - - diff --git a/src/WebApplication.EFCoreRawQuery/project.json b/src/WebApplication.EFCoreRawQuery/project.json deleted file mode 100644 index 49998d0..0000000 --- a/src/WebApplication.EFCoreRawQuery/project.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "NETStandard.Library": "1.6.0", - "ExtCore.Infrastructure": "1.0.1-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.1", - "Microsoft.EntityFrameworkCore.Sqlite": "1.0.1" - - }, - - "frameworks": { - "netstandard1.6": { - "imports": [ - "dotnet5.6", - "dnxcore50", - "portable-net45+win8" - ] - } - } -} diff --git a/src/WebApplication.Elm/WebApplication.Elm.csproj b/src/WebApplication.Elm/WebApplication.Elm.csproj new file mode 100644 index 0000000..0ecac14 --- /dev/null +++ b/src/WebApplication.Elm/WebApplication.Elm.csproj @@ -0,0 +1,21 @@ + + + + netstandard1.6 + WebApplication.Elm + WebApplication.Elm + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + + + + + + + + + + diff --git a/src/WebApplication.Elm/WebApplication.Elm.xproj b/src/WebApplication.Elm/WebApplication.Elm.xproj deleted file mode 100644 index 0031b3c..0000000 --- a/src/WebApplication.Elm/WebApplication.Elm.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - a5c5400d-dd78-4192-b34b-06d81996f0da - WebApplication.Elm - .\obj - .\bin\ - v4.6.1 - - - - 2.0 - - - diff --git a/src/WebApplication.Elm/project.json b/src/WebApplication.Elm/project.json deleted file mode 100644 index b0f0e96..0000000 --- a/src/WebApplication.Elm/project.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "NETStandard.Library": "1.6.0", - "ExtCore.Infrastructure": "1.0.1-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.1", - "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", - "Microsoft.AspNetCore.Diagnostics.Elm": "0.1.0" - }, - - "frameworks": { - "netstandard1.6": { - "imports": [ - "dotnet5.6", - "dnxcore50", - "portable-net45+win8" - ] - } - } -} \ No newline at end of file diff --git a/src/WebApplication.ExtensionA/WebApplication.ExtensionA.csproj b/src/WebApplication.ExtensionA/WebApplication.ExtensionA.csproj new file mode 100644 index 0000000..1e77c65 --- /dev/null +++ b/src/WebApplication.ExtensionA/WebApplication.ExtensionA.csproj @@ -0,0 +1,21 @@ + + + + Dmitry Sikorsky + netstandard1.6 + WebApplication.ExtensionA + WebApplication.ExtensionA + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + + + + + + + + + + + + diff --git a/src/WebApplication.ExtensionA/WebApplication.ExtensionA.xproj b/src/WebApplication.ExtensionA/WebApplication.ExtensionA.xproj deleted file mode 100644 index 9a0f6a3..0000000 --- a/src/WebApplication.ExtensionA/WebApplication.ExtensionA.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 8d722841-4e2c-4673-a7cc-c2690efe3915 - WebApplication.ExtensionA - .\obj - .\bin\ - v4.6.1 - - - 2.0 - - - \ No newline at end of file diff --git a/src/WebApplication.ExtensionA/project.json b/src/WebApplication.ExtensionA/project.json deleted file mode 100644 index 65db730..0000000 --- a/src/WebApplication.ExtensionA/project.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "authors": [ "Dmitry Sikorsky" ], - "buildOptions": { "embed": [ "Styles/**", "Views/**" ] }, - "dependencies": { - "ExtCore.Infrastructure": "1.0.1-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.1", - "NETStandard.Library": "1.6.0" - }, - "frameworks": { - "netstandard1.6": { - "imports": [ - "dotnet5.6", - "dnxcore50", - "portable-net45+win8" - ] - } - }, - "version": "1.0.0-*" -} \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/WebApplication.ExtensionB.csproj b/src/WebApplication.ExtensionB/WebApplication.ExtensionB.csproj new file mode 100644 index 0000000..1b26926 --- /dev/null +++ b/src/WebApplication.ExtensionB/WebApplication.ExtensionB.csproj @@ -0,0 +1,22 @@ + + + + Dmitry Sikorsky + netstandard1.6 + WebApplication.ExtensionB + WebApplication.ExtensionB + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + + + + + + + + + + + + + diff --git a/src/WebApplication.ExtensionB/WebApplication.ExtensionB.xproj b/src/WebApplication.ExtensionB/WebApplication.ExtensionB.xproj deleted file mode 100644 index 04bbd58..0000000 --- a/src/WebApplication.ExtensionB/WebApplication.ExtensionB.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 396a8530-c500-469e-9f6f-a2d9c286c47d - WebApplication.ExtensionB - .\obj - .\bin\ - v4.6.1 - - - 2.0 - - - \ No newline at end of file diff --git a/src/WebApplication.ExtensionB/project.json b/src/WebApplication.ExtensionB/project.json deleted file mode 100644 index fa25109..0000000 --- a/src/WebApplication.ExtensionB/project.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "authors": [ "Dmitry Sikorsky" ], - "buildOptions": { "embed": [ "Views/**" ] }, - "dependencies": { - "ExtCore.Infrastructure": "1.0.1-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.1", - "NETStandard.Library": "1.6.0", - "Microsoft.EntityFrameworkCore.Sqlite": "1.0.1" - }, - "frameworks": { - "netstandard1.6": { - "imports": [ - "dotnet5.6", - "dnxcore50", - "portable-net45+win8" - ] - } - }, - "version": "1.0.0-*" -} \ No newline at end of file diff --git a/src/WebApplication.NLog/WebApplication.NLog.csproj b/src/WebApplication.NLog/WebApplication.NLog.csproj new file mode 100644 index 0000000..342e5b6 --- /dev/null +++ b/src/WebApplication.NLog/WebApplication.NLog.csproj @@ -0,0 +1,24 @@ + + + + netstandard1.6 + WebApplication.NLog + WebApplication.NLog + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + + + + + + + + + + + + + diff --git a/src/WebApplication.NLog/WebApplication.NLog.xproj b/src/WebApplication.NLog/WebApplication.NLog.xproj deleted file mode 100644 index abf2298..0000000 --- a/src/WebApplication.NLog/WebApplication.NLog.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - 9e4b65ab-3f34-4c81-b02d-8e5643d2b3b9 - WebApplication.NLog - .\obj - .\bin\ - v4.6.1 - - - - 2.0 - - - diff --git a/src/WebApplication.NLog/project.json b/src/WebApplication.NLog/project.json deleted file mode 100644 index 9c4e9ac..0000000 --- a/src/WebApplication.NLog/project.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "ExtCore.Infrastructure": "1.0.1-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.1", - "NETStandard.Library": "1.6.0", - "Microsoft.Extensions.Logging": "1.0.0", - "Microsoft.Extensions.Logging.Console": "1.0.0", - "Microsoft.Extensions.Logging.Debug": "1.0.0", - "NLog.Extensions.Logging": "1.0.0-rtm-alpha2", - "NLog.Web.AspNetCore": "4.2.4" - }, - - "frameworks": { - "netstandard1.6": { - "imports": [ - "dotnet5.6", - "dnxcore50", - "portable-net45+win8" - ] - } - } -} diff --git a/src/WebApplication.Script/WebApplication.Script.csproj b/src/WebApplication.Script/WebApplication.Script.csproj new file mode 100644 index 0000000..bbfea50 --- /dev/null +++ b/src/WebApplication.Script/WebApplication.Script.csproj @@ -0,0 +1,20 @@ + + + + netstandard1.6 + WebApplication.Script + WebApplication.Script + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + + + + + + + + + diff --git a/src/WebApplication.Script/WebApplication.Script.xproj b/src/WebApplication.Script/WebApplication.Script.xproj deleted file mode 100644 index 8c1a8b5..0000000 --- a/src/WebApplication.Script/WebApplication.Script.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - 8dc07b1f-adaa-492c-8f2d-46b9ee579b44 - WebApplication.Script - .\obj - .\bin\ - v4.6.1 - - - - 2.0 - - - diff --git a/src/WebApplication.Script/project.json b/src/WebApplication.Script/project.json deleted file mode 100644 index b6fc3e0..0000000 --- a/src/WebApplication.Script/project.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "NETStandard.Library": "1.6.0", - "Microsoft.CodeAnalysis.CSharp.Scripting": "1.3.2", - "ExtCore.Infrastructure": "1.0.1-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.1" - }, - - "frameworks": { - "netstandard1.6": { - "imports": [ - "dotnet5.6", - "dnxcore50", - "portable-net45+win8" - ] - } - } -} diff --git a/src/WebApplication.Swagger/WebApplication.Swagger.csproj b/src/WebApplication.Swagger/WebApplication.Swagger.csproj new file mode 100644 index 0000000..014e204 --- /dev/null +++ b/src/WebApplication.Swagger/WebApplication.Swagger.csproj @@ -0,0 +1,21 @@ + + + + netstandard1.6 + WebApplication.Swagger + WebApplication.Swagger + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + + + + + + + + + + diff --git a/src/WebApplication.Swagger/WebApplication.Swagger.xproj b/src/WebApplication.Swagger/WebApplication.Swagger.xproj deleted file mode 100644 index 7af6b7d..0000000 --- a/src/WebApplication.Swagger/WebApplication.Swagger.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - 95e5595e-410b-4a6d-8822-4c07fdc3cf21 - WebApplication.Swagger - .\obj - .\bin\ - v4.6.1 - - - - 2.0 - - - diff --git a/src/WebApplication.Swagger/project.json b/src/WebApplication.Swagger/project.json deleted file mode 100644 index 918df76..0000000 --- a/src/WebApplication.Swagger/project.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "ExtCore.Infrastructure": "1.0.1-alpha901", - "NETStandard.Library": "1.6.0", - "Microsoft.AspNetCore.Mvc": "1.0.1", - "Swashbuckle": "6.0.0-beta902", - "Swashbuckle.Swagger": "6.0.0-beta902" - }, - - "frameworks": { - "netstandard1.6": { - "imports": [ - "dotnet5.6", - "dnxcore50", - "portable-net45+win8" - ] - } - } -} diff --git a/src/WebApplication.WebAPI/WebApplication.WebAPI.csproj b/src/WebApplication.WebAPI/WebApplication.WebAPI.csproj new file mode 100644 index 0000000..9c21b29 --- /dev/null +++ b/src/WebApplication.WebAPI/WebApplication.WebAPI.csproj @@ -0,0 +1,20 @@ + + + + netstandard1.6 + WebApplication.WebAPI + WebApplication.WebAPI + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + + + + + + + + + diff --git a/src/WebApplication.WebAPI/WebApplication.WebAPI.xproj b/src/WebApplication.WebAPI/WebApplication.WebAPI.xproj deleted file mode 100644 index 9f3c301..0000000 --- a/src/WebApplication.WebAPI/WebApplication.WebAPI.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - 7de66111-bbb6-4c93-b864-9e65cafd505b - WebApplication.WebAPI - .\obj - .\bin\ - v4.6.1 - - - - 2.0 - - - diff --git a/src/WebApplication.WebAPI/project.json b/src/WebApplication.WebAPI/project.json deleted file mode 100644 index e18cbbd..0000000 --- a/src/WebApplication.WebAPI/project.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "version": "1.0.0-*", - - "dependencies": { - "NETStandard.Library": "1.6.0", - "ExtCore.Infrastructure": "1.0.1-alpha901", - "Microsoft.AspNetCore.Mvc": "1.0.1", - "Microsoft.EntityFrameworkCore.Sqlite": "1.0.1" - }, - - "frameworks": { - "netstandard1.6": { - "imports": [ - "dotnet5.6", - "dnxcore50", - "portable-net45+win8" - ] - } - } -} diff --git a/src/WebApplication/WebApplication.csproj b/src/WebApplication/WebApplication.csproj new file mode 100644 index 0000000..52ed6c9 --- /dev/null +++ b/src/WebApplication/WebApplication.csproj @@ -0,0 +1,42 @@ + + + + Dmitry Sikorsky + netcoreapp1.0 + true + WebApplication + Exe + WebApplication + 1.0.4 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + + + + + PreserveNewest + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/WebApplication/WebApplication.xproj b/src/WebApplication/WebApplication.xproj deleted file mode 100644 index fff6a2d..0000000 --- a/src/WebApplication/WebApplication.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - b511b595-a980-4d5c-bc2a-bccb4065b433 - WebApplication - .\obj - .\bin\ - v4.6.1 - - - 2.0 - - - \ No newline at end of file diff --git a/src/WebApplication/project.json b/src/WebApplication/project.json deleted file mode 100644 index f1838e1..0000000 --- a/src/WebApplication/project.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "authors": [ - "Dmitry Sikorsky" - ], - "buildOptions": { - "emitEntryPoint": true, - "preserveCompilationContext": true - }, - "dependencies": { - "ExtCore.Infrastructure": "1.0.1-alpha901", - "ExtCore.WebApplication": "1.0.1-alpha901", - "Microsoft.AspNetCore.Diagnostics": "1.0.0", - "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0", - "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", - "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", - "Microsoft.Extensions.Configuration.Json": "1.0.0", - "Microsoft.NETCore.App": { - "version": "1.0.0", - "type": "platform" - }, - "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0", - "Microsoft.Extensions.Logging": "1.0.0", - "Microsoft.Extensions.Logging.Console": "1.0.0", - "Microsoft.Extensions.Logging.Debug": "1.0.0", - "NLog.Extensions.Logging": "1.0.0-rtm-alpha2", - "NLog.Web.AspNetCore": "4.2.4", - "Microsoft.EntityFrameworkCore.Sqlite": "1.0.1", - //"NETStandard.Library": "1.6.0", - "Microsoft.AspNetCore.Mvc": "1.0.1", - "Microsoft.AspNetCore.Diagnostics.Elm": "0.1.0", - "Swashbuckle": "6.0.0-beta902", - "Swashbuckle.Swagger": "6.0.0-beta902", - "Microsoft.CodeAnalysis.CSharp.Scripting": "1.3.2" - }, - "frameworks": { - //"net46": {}, - "netcoreapp1.0": { - //"netstandard1.6": { - "imports": [ - "dotnet5.6", - "dnxcore50", - "portable-net45+win8" - ] - } - }, - "publishOptions": { - "include": [ - "Views", - "wwwroot", - "config.json", - "web.config", - "nlog.config" - ] - }, - "runtimeOptions": { - "gcServer": true - }, - "version": "1.0.0-*" -} \ No newline at end of file diff --git a/src/WebApplication/runtimeconfig.template.json b/src/WebApplication/runtimeconfig.template.json new file mode 100644 index 0000000..3dc8eba --- /dev/null +++ b/src/WebApplication/runtimeconfig.template.json @@ -0,0 +1,3 @@ +{ + "gcServer": true +} \ No newline at end of file From 28788a5930435654185710f5ff6f4c2a5a37cf90 Mon Sep 17 00:00:00 2001 From: USER001 F Date: Sat, 22 Apr 2017 14:36:34 +0900 Subject: [PATCH 12/18] Add Dapper Raw Query --- .../Models/ItemRepository.cs | 17 +++++++++++++++-- .../WebApplication.EFCoreRawQuery.csproj | 1 + src/WebApplication/WebApplication.csproj | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/WebApplication.EFCoreRawQuery/Models/ItemRepository.cs b/src/WebApplication.EFCoreRawQuery/Models/ItemRepository.cs index eddcfa7..5f2d8a3 100644 --- a/src/WebApplication.EFCoreRawQuery/Models/ItemRepository.cs +++ b/src/WebApplication.EFCoreRawQuery/Models/ItemRepository.cs @@ -5,6 +5,7 @@ using System.Linq; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Storage; +using Dapper; namespace WebApplication.EFCoreRawQuery.Models { @@ -21,13 +22,25 @@ public IEnumerable All() SELECT Id, Name FROM Items "; - var result = _itemDbContext.Database.GetModelFromQuery(sql); + var connection = _itemDbContext.Database.GetDbConnection(); + var result = connection.Query(sql); return result; } public Item Find(long id) { - return _itemDbContext.Items.Where(i => i.Id == id).First(); + var sql = $@" +SELECT Id, Name +FROM Items +WHERE + 1 = 1 +LIMIT 1 +OFFSET {id} -- true +"; + var connection = _itemDbContext.Database.GetDbConnection(); + var result = connection.Query(sql); + + return result.First(); } public void Add(Item value) { diff --git a/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.csproj b/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.csproj index a237f0b..d753918 100644 --- a/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.csproj +++ b/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.csproj @@ -12,6 +12,7 @@ + diff --git a/src/WebApplication/WebApplication.csproj b/src/WebApplication/WebApplication.csproj index 52ed6c9..edcad00 100644 --- a/src/WebApplication/WebApplication.csproj +++ b/src/WebApplication/WebApplication.csproj @@ -18,6 +18,7 @@ + From 5166a0a5e4b605d9ff554cd04468bc04e8cc6ae0 Mon Sep 17 00:00:00 2001 From: USER001 F Date: Sun, 23 Apr 2017 10:59:59 +0900 Subject: [PATCH 13/18] Change Packages Use MetaPackages --- build.cake | 160 ++++++++++++------ .../WebApplication.EFCoreRawQuery.csproj | 5 +- .../WebApplication.Elm.csproj | 5 +- .../WebApplication.ExtensionA.csproj | 3 +- .../WebApplication.ExtensionB.csproj | 4 +- .../WebApplication.NLog.csproj | 8 +- .../WebApplication.Script.csproj | 4 +- .../WebApplication.Swagger.csproj | 5 +- .../WebApplication.WebAPI.csproj | 4 +- src/WebApplication/WebApplication.csproj | 21 +-- src/WebApplication/gulpfile.js | 36 ++-- 11 files changed, 146 insertions(+), 109 deletions(-) diff --git a/build.cake b/build.cake index 03f204f..aa254de 100644 --- a/build.cake +++ b/build.cake @@ -4,7 +4,6 @@ var configuration = Argument("configuration", "Release"); /////////////////////////////////////////////////////////////////////////////// // GLOBAL VARIABLES /////////////////////////////////////////////////////////////////////////////// -var isLocalBuild = !AppVeyor.IsRunningOnAppVeyor; var packPath1 = Directory("./src/WebApplication"); var packPath2 = Directory("./src/WebApplication.EFCoreRawQuery"); var packPath3 = Directory("./src/WebApplication.Elm"); @@ -14,58 +13,142 @@ var packPath6 = Directory("./src/WebApplication.NLog"); var packPath7 = Directory("./src/WebApplication.Script"); var packPath8 = Directory("./src/WebApplication.Swagger"); var packPath9 = Directory("./src/WebApplication.WebAPI"); -var sourcePath = Directory("./src"); -var testsPath = Directory("test"); -var buildArtifacts = Directory("./artifacts/packages"); +var buildArtifacts = Directory("./artifacts/packages"); +var isAppVeyor = AppVeyor.IsRunningOnAppVeyor; +var isWindows = IsRunningOnWindows(); +var netcore = "netcoreapp1.0"; +var netstandard = "netstandard1.6"; + +/////////////////////////////////////////////////////////////////////////////// +// Clean +/////////////////////////////////////////////////////////////////////////////// +Task("Clean") + .Does(() => +{ + CleanDirectories(new DirectoryPath[] { buildArtifacts }); +}); + +/////////////////////////////////////////////////////////////////////////////// +// Restore +/////////////////////////////////////////////////////////////////////////////// +Task("Restore") + .Does(() => +{ + var settings = new DotNetCoreRestoreSettings + { + Sources = new [] { + "packages", + "https://api.nuget.org/v3/index.json" + } + }; + + var projects = GetFiles("./**/*.csproj"); + + foreach(var project in projects) + { + DotNetCoreRestore(project.GetDirectory().FullPath, settings); + } +}); + +/////////////////////////////////////////////////////////////////////////////// +// Build +/////////////////////////////////////////////////////////////////////////////// Task("Build") .IsDependentOn("Clean") .IsDependentOn("Restore") .Does(() => { - var projects = GetFiles("./**/project.json"); + var settings = new DotNetCoreBuildSettings + { + Configuration = configuration + }; + + // libraries + var projects = GetFiles("./src/**/*.csproj"); + if (!isWindows) + { + Information("Not on Windows - building only for " + netstandard); + settings.Framework = netstandard; + } + + /* foreach(var project in projects) { - var settings = new DotNetCoreBuildSettings - { - Configuration = configuration - // Runtime = IsRunningOnWindows() ? null : "unix-x64" - }; + DotNetCoreBuild(project.GetDirectory().FullPath, settings); + } + */ + //settings.Framework = netstandard; + DotNetCoreBuild(packPath2, settings); + DotNetCoreBuild(packPath3, settings); + DotNetCoreBuild(packPath4, settings); + DotNetCoreBuild(packPath5, settings); + DotNetCoreBuild(packPath6, settings); + DotNetCoreBuild(packPath7, settings); + DotNetCoreBuild(packPath8, settings); + DotNetCoreBuild(packPath9, settings); + //settings.Framework = netcore; + DotNetCoreBuild(packPath1, settings); + + // tests + projects = GetFiles("./test/**/*.csproj"); + + if (!isWindows) + { + Information("Not on Windows - building only for " + netcore); + settings.Framework = netcore; + } + /* + foreach(var project in projects) + { DotNetCoreBuild(project.GetDirectory().FullPath, settings); } + */ }); -Task("RunTests") +/////////////////////////////////////////////////////////////////////////////// +// Test +/////////////////////////////////////////////////////////////////////////////// +Task("Test") .IsDependentOn("Restore") .IsDependentOn("Clean") .Does(() => { - var projects = GetFiles("./test/**/project.json"); + var settings = new DotNetCoreTestSettings + { + Configuration = configuration + }; + + var projects = GetFiles("./test/**/*.csproj"); + + if (!isWindows) + { + Information("Not on Windows - testing only for " + netcore); + settings.Framework = netcore; + } foreach(var project in projects) { - var settings = new DotNetCoreTestSettings - { - Configuration = configuration - }; - - if (!IsRunningOnWindows()) - { - Information("Not running on Windows - skipping tests for full .NET Framework"); - settings.Framework = "netcoreapp1.0"; - } - - DotNetCoreTest(project.GetDirectory().FullPath, settings); + DotNetCoreTest(project.FullPath, settings); } }); +/////////////////////////////////////////////////////////////////////////////// +// Pack +/////////////////////////////////////////////////////////////////////////////// Task("Pack") .IsDependentOn("Restore") .IsDependentOn("Clean") .Does(() => { + if (!isWindows) + { + Information("Not on Windows - skipping pack"); + return; + } + var settings = new DotNetCorePackSettings { Configuration = configuration, @@ -73,12 +156,11 @@ Task("Pack") }; // add build suffix for CI builds - if(!isLocalBuild) + if(isAppVeyor) { settings.VersionSuffix = "build" + AppVeyor.Environment.Build.Number.ToString().PadLeft(5,'0'); } - - DotNetCorePack(packPath1, settings); + //settings.Framework = netstandard; DotNetCorePack(packPath2, settings); DotNetCorePack(packPath3, settings); DotNetCorePack(packPath4, settings); @@ -87,32 +169,14 @@ Task("Pack") DotNetCorePack(packPath7, settings); DotNetCorePack(packPath8, settings); DotNetCorePack(packPath9, settings); + //settings.Framework = netcore; + DotNetCorePack(packPath1, settings); }); -Task("Clean") - .Does(() => -{ - CleanDirectories(new DirectoryPath[] { buildArtifacts }); -}); - -Task("Restore") - .Does(() => -{ - var settings = new DotNetCoreRestoreSettings - { - Sources = new [] { - "packages", - "https://api.nuget.org/v3/index.json" - } - }; - - DotNetCoreRestore(sourcePath, settings); - //DotNetCoreRestore(testsPath, settings); -}); Task("Default") .IsDependentOn("Build"); - //.IsDependentOn("RunTests") + //.IsDependentOn("Test") //.IsDependentOn("Pack"); RunTarget(target); \ No newline at end of file diff --git a/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.csproj b/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.csproj index d753918..ced0571 100644 --- a/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.csproj +++ b/src/WebApplication.EFCoreRawQuery/WebApplication.EFCoreRawQuery.csproj @@ -12,10 +12,7 @@ - - - - + diff --git a/src/WebApplication.Elm/WebApplication.Elm.csproj b/src/WebApplication.Elm/WebApplication.Elm.csproj index 0ecac14..3bf881f 100644 --- a/src/WebApplication.Elm/WebApplication.Elm.csproj +++ b/src/WebApplication.Elm/WebApplication.Elm.csproj @@ -12,10 +12,7 @@ - - - - + diff --git a/src/WebApplication.ExtensionA/WebApplication.ExtensionA.csproj b/src/WebApplication.ExtensionA/WebApplication.ExtensionA.csproj index 1e77c65..5d67c10 100644 --- a/src/WebApplication.ExtensionA/WebApplication.ExtensionA.csproj +++ b/src/WebApplication.ExtensionA/WebApplication.ExtensionA.csproj @@ -14,8 +14,7 @@ - - + diff --git a/src/WebApplication.ExtensionB/WebApplication.ExtensionB.csproj b/src/WebApplication.ExtensionB/WebApplication.ExtensionB.csproj index 1b26926..4a0ad84 100644 --- a/src/WebApplication.ExtensionB/WebApplication.ExtensionB.csproj +++ b/src/WebApplication.ExtensionB/WebApplication.ExtensionB.csproj @@ -14,9 +14,7 @@ - - - + diff --git a/src/WebApplication.NLog/WebApplication.NLog.csproj b/src/WebApplication.NLog/WebApplication.NLog.csproj index 342e5b6..a22e91c 100644 --- a/src/WebApplication.NLog/WebApplication.NLog.csproj +++ b/src/WebApplication.NLog/WebApplication.NLog.csproj @@ -12,13 +12,7 @@ - - - - - - - + diff --git a/src/WebApplication.Script/WebApplication.Script.csproj b/src/WebApplication.Script/WebApplication.Script.csproj index bbfea50..bda03ba 100644 --- a/src/WebApplication.Script/WebApplication.Script.csproj +++ b/src/WebApplication.Script/WebApplication.Script.csproj @@ -12,9 +12,7 @@ - - - + diff --git a/src/WebApplication.Swagger/WebApplication.Swagger.csproj b/src/WebApplication.Swagger/WebApplication.Swagger.csproj index 014e204..1e6e517 100644 --- a/src/WebApplication.Swagger/WebApplication.Swagger.csproj +++ b/src/WebApplication.Swagger/WebApplication.Swagger.csproj @@ -12,10 +12,7 @@ - - - - + diff --git a/src/WebApplication.WebAPI/WebApplication.WebAPI.csproj b/src/WebApplication.WebAPI/WebApplication.WebAPI.csproj index 9c21b29..2a2a737 100644 --- a/src/WebApplication.WebAPI/WebApplication.WebAPI.csproj +++ b/src/WebApplication.WebAPI/WebApplication.WebAPI.csproj @@ -12,9 +12,7 @@ - - - + diff --git a/src/WebApplication/WebApplication.csproj b/src/WebApplication/WebApplication.csproj index edcad00..1083c9d 100644 --- a/src/WebApplication/WebApplication.csproj +++ b/src/WebApplication/WebApplication.csproj @@ -18,26 +18,7 @@ - - - - - - - - - - - - - - - - - - - - + diff --git a/src/WebApplication/gulpfile.js b/src/WebApplication/gulpfile.js index 6dc8345..253b8f5 100644 --- a/src/WebApplication/gulpfile.js +++ b/src/WebApplication/gulpfile.js @@ -1,15 +1,29 @@ var gulp = require("gulp"); gulp.task( - "copy-extensions", function (cb) { - gulp.src(["../WebApplication.EFCoreRawQuery/bin/Debug/netstandard1.6/WebApplication.EFCoreRawQuery.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.NLog/bin/Debug/netstandard1.6/WebApplication.NLog.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.Elm/bin/Debug/netstandard1.6/WebApplication.Elm.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.ExtensionA/bin/Debug/netstandard1.6/WebApplication.ExtensionA.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.ExtensionB/bin/Debug/netstandard1.6/WebApplication.ExtensionB.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.Script/bin/Debug/netstandard1.6/WebApplication.Script.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.Swagger/bin/Debug/netstandard1.6/WebApplication.Swagger.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../WebApplication.WebAPI/bin/Debug/netstandard1.6/WebApplication.WebAPI.dll"]).pipe(gulp.dest("Extensions")); - cb(); - } + "copy-extensions-debug", function (cb) { + gulp.src(["../WebApplication.EFCoreRawQuery/bin/Debug/netstandard1.6/WebApplication.EFCoreRawQuery.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.NLog/bin/Debug/netstandard1.6/WebApplication.NLog.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.Elm/bin/Debug/netstandard1.6/WebApplication.Elm.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.ExtensionA/bin/Debug/netstandard1.6/WebApplication.ExtensionA.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.ExtensionB/bin/Debug/netstandard1.6/WebApplication.ExtensionB.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.Script/bin/Debug/netstandard1.6/WebApplication.Script.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.Swagger/bin/Debug/netstandard1.6/WebApplication.Swagger.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.WebAPI/bin/Debug/netstandard1.6/WebApplication.WebAPI.dll"]).pipe(gulp.dest("Extensions")); + cb(); + } +); + +gulp.task( + "copy-extensions-release", function (cb) { + gulp.src(["../WebApplication.EFCoreRawQuery/bin/Release/netstandard1.6/WebApplication.EFCoreRawQuery.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.NLog/bin/Release/netstandard1.6/WebApplication.NLog.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.Elm/bin/Release/netstandard1.6/WebApplication.Elm.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.ExtensionA/bin/Release/netstandard1.6/WebApplication.ExtensionA.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.ExtensionB/bin/Release/netstandard1.6/WebApplication.ExtensionB.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.Script/bin/Release/netstandard1.6/WebApplication.Script.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.Swagger/bin/Release/netstandard1.6/WebApplication.Swagger.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.WebAPI/bin/Release/netstandard1.6/WebApplication.WebAPI.dll"]).pipe(gulp.dest("Extensions")); + cb(); + } ); \ No newline at end of file From c0ada05a139b2330f212a39af2acac8eb14f5494 Mon Sep 17 00:00:00 2001 From: USER001 F Date: Mon, 24 Apr 2017 00:17:47 +0900 Subject: [PATCH 14/18] Merge MyCore.App and MyStandard.Library --- LICENSE.txt | 6 +++-- README.md | 23 ++++--------------- .../WebApplication.ExtensionA.csproj | 2 +- .../WebApplication.ExtensionB.csproj | 4 ++-- src/WebApplication/WebApplication.csproj | 2 +- 5 files changed, 12 insertions(+), 25 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index b864880..f740c05 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright © 2015 Dmitry Sikorsky. All rights reserved. +Copyright © 2017 f7q. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the @@ -9,4 +9,6 @@ http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the -specific language governing permissions and limitations under the License. \ No newline at end of file +specific language governing permissions and limitations under the License. + +Fork by Product http://github.com/ExtCore/ExtCore diff --git a/README.md b/README.md index 01dd987..35fe9ac 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ -# ExtCore 1.0.0-alpha9 Sample - -[![Join the chat at https://gitter.im/ExtCore/ExtCore](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ExtCore/ExtCore?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +# ExtCore 1.0.0-alpha901 Sample ## Introduction -[ExtCore](https://github.com/ExtCore/ExtCore) is free, open source and cross-platform framework for creating +[ExtCore](https://github.com/f7q/ExtCore) is free, open source and cross-platform framework for creating modular and extendable web applications based on ASP.NET Core. It is built using the best and the most modern tools and languages (Visual Studio 2015, C# etc). Join our team! @@ -36,19 +34,6 @@ All you need to do to have modular and extendable web application is: Please take a look at this sample. -You can also download our [ready to use sample](http://extcore.net/files/ExtCore-Sample-1.0.0-alpha9.zip). -It contains everything you need to run ExtCore-based web application from Visual Studio 2015, including SQLite +You can also download our [ready to use sample](https://github.com/f7q/ExtCore-Sample). +It contains everything you need to run ExtCore-based web application from Visual Studio 2017, including SQLite database with the test data. - -### Projects - -Please take a look at [Platformus](https://github.com/Platformus/Platformus) on GitHub. It is CMS -built on ExtCore framework with 8 extensions and 58 projects. - -## Links - -Sources on GitHub: https://github.com/ExtCore/ExtCore - -Website: http://extcore.net/ (under construction) - -Docs: http://docs.extcore.net/ (under construction) \ No newline at end of file diff --git a/src/WebApplication.ExtensionA/WebApplication.ExtensionA.csproj b/src/WebApplication.ExtensionA/WebApplication.ExtensionA.csproj index 5d67c10..466edc1 100644 --- a/src/WebApplication.ExtensionA/WebApplication.ExtensionA.csproj +++ b/src/WebApplication.ExtensionA/WebApplication.ExtensionA.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/WebApplication.ExtensionB/WebApplication.ExtensionB.csproj b/src/WebApplication.ExtensionB/WebApplication.ExtensionB.csproj index 4a0ad84..5c43ea6 100644 --- a/src/WebApplication.ExtensionB/WebApplication.ExtensionB.csproj +++ b/src/WebApplication.ExtensionB/WebApplication.ExtensionB.csproj @@ -1,7 +1,7 @@  - Dmitry Sikorsky + f7q netstandard1.6 WebApplication.ExtensionB WebApplication.ExtensionB @@ -10,7 +10,7 @@ - + diff --git a/src/WebApplication/WebApplication.csproj b/src/WebApplication/WebApplication.csproj index 1083c9d..84dd271 100644 --- a/src/WebApplication/WebApplication.csproj +++ b/src/WebApplication/WebApplication.csproj @@ -18,7 +18,7 @@ - + From 9f0f3c2a11e22f606495316f826485245fb72d6b Mon Sep 17 00:00:00 2001 From: USER001 F Date: Wed, 26 Apr 2017 00:42:56 +0900 Subject: [PATCH 15/18] Add Domain Model Pattan --- .gitignore | 1 + WebApplication.sln | 75 ++++++++++++++++ .../DomainModel.Controllers.csproj | 20 +++++ src/DomainModel/Controllers/ItemController.cs | 44 ++++++++++ .../Extentions/DomainModel.Extentions.csproj | 23 +++++ src/DomainModel/Extentions/Extention.cs | 85 +++++++++++++++++++ ...ainModel.Infrastracture.Repositorys.csproj | 19 +++++ .../IInRepositorys.cs | 12 +++ .../IOutRepositorys.cs | 12 +++ .../Infrastracture.Repository/IRepository.cs | 15 ++++ ...DomainModel.Infrastracture.Services.csproj | 23 +++++ .../Infrastracture.Service/IInService.cs | 12 +++ .../Infrastracture.Service/IOutService.cs | 12 +++ .../Infrastracture.Service/IService.cs | 15 ++++ .../Models/DomainModel.Models.csproj | 19 +++++ src/DomainModel/Models/Item.cs | 11 +++ src/DomainModel/Models/ItemDbContext.cs | 19 +++++ .../Repository/DomainModel.Repositorys.csproj | 20 +++++ src/DomainModel/Repository/ItemRepository.cs | 44 ++++++++++ .../Services/DomainModel.Services.csproj | 21 +++++ src/DomainModel/Services/ItemService.cs | 43 ++++++++++ src/WebApplication/gulpfile.js | 9 ++ 22 files changed, 554 insertions(+) create mode 100644 src/DomainModel/Controllers/DomainModel.Controllers.csproj create mode 100644 src/DomainModel/Controllers/ItemController.cs create mode 100644 src/DomainModel/Extentions/DomainModel.Extentions.csproj create mode 100644 src/DomainModel/Extentions/Extention.cs create mode 100644 src/DomainModel/Infrastracture.Repository/DomainModel.Infrastracture.Repositorys.csproj create mode 100644 src/DomainModel/Infrastracture.Repository/IInRepositorys.cs create mode 100644 src/DomainModel/Infrastracture.Repository/IOutRepositorys.cs create mode 100644 src/DomainModel/Infrastracture.Repository/IRepository.cs create mode 100644 src/DomainModel/Infrastracture.Service/DomainModel.Infrastracture.Services.csproj create mode 100644 src/DomainModel/Infrastracture.Service/IInService.cs create mode 100644 src/DomainModel/Infrastracture.Service/IOutService.cs create mode 100644 src/DomainModel/Infrastracture.Service/IService.cs create mode 100644 src/DomainModel/Models/DomainModel.Models.csproj create mode 100644 src/DomainModel/Models/Item.cs create mode 100644 src/DomainModel/Models/ItemDbContext.cs create mode 100644 src/DomainModel/Repository/DomainModel.Repositorys.csproj create mode 100644 src/DomainModel/Repository/ItemRepository.cs create mode 100644 src/DomainModel/Services/DomainModel.Services.csproj create mode 100644 src/DomainModel/Services/ItemService.cs diff --git a/.gitignore b/.gitignore index c8e49b1..75874de 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ src/WebApplication/node_modules/ *.xproj.user *.lock.json *.dll +*.pdb *.log tools/ packages/ diff --git a/WebApplication.sln b/WebApplication.sln index 443aed3..c58b3da 100644 --- a/WebApplication.sln +++ b/WebApplication.sln @@ -41,6 +41,45 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication.Script", "sr EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApplication.EFCoreRawQuery", "src\WebApplication.EFCoreRawQuery\WebApplication.EFCoreRawQuery.csproj", "{9E153732-43ED-4DA7-B464-32C391CC443E}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DomainModel", "DomainModel", "{CA30C73C-6C4B-410F-AFDB-07A2BCEED456}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Extentions", "src\DomainModel\Extentions\DomainModel.Extentions.csproj", "{95B1064A-D20B-4867-A208-057F54E0F984}" + ProjectSection(ProjectDependencies) = postProject + {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F} = {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F} + {C948C12E-D584-46FF-B85C-A81AA341A1ED} = {C948C12E-D584-46FF-B85C-A81AA341A1ED} + {B0AA4F66-55A2-4DA2-A3E6-65824A3EBF38} = {B0AA4F66-55A2-4DA2-A3E6-65824A3EBF38} + {BB096868-3D0B-431F-BDF5-37388F1E4D18} = {BB096868-3D0B-431F-BDF5-37388F1E4D18} + {37D1D188-9191-4766-8171-678620C702C4} = {37D1D188-9191-4766-8171-678620C702C4} + {DE6A91AA-3C4B-4723-8B6B-82E31B5DE127} = {DE6A91AA-3C4B-4723-8B6B-82E31B5DE127} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Controllers", "src\DomainModel\Controllers\DomainModel.Controllers.csproj", "{B0AA4F66-55A2-4DA2-A3E6-65824A3EBF38}" + ProjectSection(ProjectDependencies) = postProject + {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F} = {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F} + {BB096868-3D0B-431F-BDF5-37388F1E4D18} = {BB096868-3D0B-431F-BDF5-37388F1E4D18} + {DE6A91AA-3C4B-4723-8B6B-82E31B5DE127} = {DE6A91AA-3C4B-4723-8B6B-82E31B5DE127} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Services", "src\DomainModel\Services\DomainModel.Services.csproj", "{37D1D188-9191-4766-8171-678620C702C4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Infrastracture.Services", "src\DomainModel\Infrastracture.Service\DomainModel.Infrastracture.Services.csproj", "{DE6A91AA-3C4B-4723-8B6B-82E31B5DE127}" + ProjectSection(ProjectDependencies) = postProject + {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F} = {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Infrastracture.Repositorys", "src\DomainModel\Infrastracture.Repository\DomainModel.Infrastracture.Repositorys.csproj", "{BB096868-3D0B-431F-BDF5-37388F1E4D18}" + ProjectSection(ProjectDependencies) = postProject + {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F} = {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Repositorys", "src\DomainModel\Repository\DomainModel.Repositorys.csproj", "{C948C12E-D584-46FF-B85C-A81AA341A1ED}" + ProjectSection(ProjectDependencies) = postProject + {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F} = {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F} + {BB096868-3D0B-431F-BDF5-37388F1E4D18} = {BB096868-3D0B-431F-BDF5-37388F1E4D18} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Models", "src\DomainModel\Models\DomainModel.Models.csproj", "{4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -83,6 +122,34 @@ Global {9E153732-43ED-4DA7-B464-32C391CC443E}.Debug|Any CPU.Build.0 = Debug|Any CPU {9E153732-43ED-4DA7-B464-32C391CC443E}.Release|Any CPU.ActiveCfg = Release|Any CPU {9E153732-43ED-4DA7-B464-32C391CC443E}.Release|Any CPU.Build.0 = Release|Any CPU + {95B1064A-D20B-4867-A208-057F54E0F984}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95B1064A-D20B-4867-A208-057F54E0F984}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95B1064A-D20B-4867-A208-057F54E0F984}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95B1064A-D20B-4867-A208-057F54E0F984}.Release|Any CPU.Build.0 = Release|Any CPU + {B0AA4F66-55A2-4DA2-A3E6-65824A3EBF38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0AA4F66-55A2-4DA2-A3E6-65824A3EBF38}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0AA4F66-55A2-4DA2-A3E6-65824A3EBF38}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0AA4F66-55A2-4DA2-A3E6-65824A3EBF38}.Release|Any CPU.Build.0 = Release|Any CPU + {37D1D188-9191-4766-8171-678620C702C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {37D1D188-9191-4766-8171-678620C702C4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {37D1D188-9191-4766-8171-678620C702C4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {37D1D188-9191-4766-8171-678620C702C4}.Release|Any CPU.Build.0 = Release|Any CPU + {DE6A91AA-3C4B-4723-8B6B-82E31B5DE127}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DE6A91AA-3C4B-4723-8B6B-82E31B5DE127}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DE6A91AA-3C4B-4723-8B6B-82E31B5DE127}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DE6A91AA-3C4B-4723-8B6B-82E31B5DE127}.Release|Any CPU.Build.0 = Release|Any CPU + {BB096868-3D0B-431F-BDF5-37388F1E4D18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BB096868-3D0B-431F-BDF5-37388F1E4D18}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BB096868-3D0B-431F-BDF5-37388F1E4D18}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BB096868-3D0B-431F-BDF5-37388F1E4D18}.Release|Any CPU.Build.0 = Release|Any CPU + {C948C12E-D584-46FF-B85C-A81AA341A1ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C948C12E-D584-46FF-B85C-A81AA341A1ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C948C12E-D584-46FF-B85C-A81AA341A1ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C948C12E-D584-46FF-B85C-A81AA341A1ED}.Release|Any CPU.Build.0 = Release|Any CPU + {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -105,5 +172,13 @@ Global {A5C5400D-DD78-4192-B34B-06D81996F0DA} = {C49636B1-231E-45A2-8901-10EC68C7CB55} {8DC07B1F-ADAA-492C-8F2D-46B9EE579B44} = {925D6751-630E-48FF-9AF8-8DA9E09968CF} {9E153732-43ED-4DA7-B464-32C391CC443E} = {28B1769B-CEA4-4B6F-B383-8A0FAF22F108} + {CA30C73C-6C4B-410F-AFDB-07A2BCEED456} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {95B1064A-D20B-4867-A208-057F54E0F984} = {CA30C73C-6C4B-410F-AFDB-07A2BCEED456} + {B0AA4F66-55A2-4DA2-A3E6-65824A3EBF38} = {CA30C73C-6C4B-410F-AFDB-07A2BCEED456} + {37D1D188-9191-4766-8171-678620C702C4} = {CA30C73C-6C4B-410F-AFDB-07A2BCEED456} + {DE6A91AA-3C4B-4723-8B6B-82E31B5DE127} = {CA30C73C-6C4B-410F-AFDB-07A2BCEED456} + {BB096868-3D0B-431F-BDF5-37388F1E4D18} = {CA30C73C-6C4B-410F-AFDB-07A2BCEED456} + {C948C12E-D584-46FF-B85C-A81AA341A1ED} = {CA30C73C-6C4B-410F-AFDB-07A2BCEED456} + {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F} = {CA30C73C-6C4B-410F-AFDB-07A2BCEED456} EndGlobalSection EndGlobal diff --git a/src/DomainModel/Controllers/DomainModel.Controllers.csproj b/src/DomainModel/Controllers/DomainModel.Controllers.csproj new file mode 100644 index 0000000..8d81cf9 --- /dev/null +++ b/src/DomainModel/Controllers/DomainModel.Controllers.csproj @@ -0,0 +1,20 @@ + + + + netstandard1.6 + DomainModel.Controllers + DomainModel.Controllers + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + DomainModel.Controllers + + + + + + + + + \ No newline at end of file diff --git a/src/DomainModel/Controllers/ItemController.cs b/src/DomainModel/Controllers/ItemController.cs new file mode 100644 index 0000000..3ed4461 --- /dev/null +++ b/src/DomainModel/Controllers/ItemController.cs @@ -0,0 +1,44 @@ +using System; +using Microsoft.AspNetCore.Mvc; +using DomainModel.Infrastracture.Services; +using DomainModel.Models; + +namespace DomainModel.Controllers +{ + [Route("api/domainmodel/[controller]")] + public class ItemsController : Controller + { + private IService _itemService { get; set; } + + public ItemsController(IService itemService) + { + _itemService = itemService; + } + + [HttpGet] + public IActionResult Get() + { + return Ok(_itemService.All()); + } + [HttpGet("{id}")] + public IActionResult Get(long id) + { + return Ok(_itemService.Find(id)); + } + [HttpPost] + public void Post([FromBody]Item value) + { + _itemService.Add(value); + } + [HttpPut("{id}")] + public void Put(long id, [FromBody]Item value) + { + _itemService.Update(id, value); + } + [HttpDelete("{id}")] + public void Delete(long id) + { + _itemService.Delete(id); + } + } +} \ No newline at end of file diff --git a/src/DomainModel/Extentions/DomainModel.Extentions.csproj b/src/DomainModel/Extentions/DomainModel.Extentions.csproj new file mode 100644 index 0000000..540b803 --- /dev/null +++ b/src/DomainModel/Extentions/DomainModel.Extentions.csproj @@ -0,0 +1,23 @@ + + + + netstandard1.6 + DomainModel.Extentions + DomainModel.Extentions + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + DomainModel.Extentions + + + + + + + + + + + + \ No newline at end of file diff --git a/src/DomainModel/Extentions/Extention.cs b/src/DomainModel/Extentions/Extention.cs new file mode 100644 index 0000000..de8f15f --- /dev/null +++ b/src/DomainModel/Extentions/Extention.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ExtCore.Infrastructure; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.EntityFrameworkCore; +using DomainModel.Infrastracture.Repositorys; +using DomainModel.Infrastracture.Services; +using DomainModel.Repositorys; +using DomainModel.Services; +using DomainModel.Models; +using DomainModel.Controllers; + +namespace DomainModel.Extentions +{ + public class Extention : IExtension + { + private IConfigurationRoot configurationRoot; + + public string Name + { + get + { + return "Extension DomainModel"; + } + } + + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); + + routeRegistrarsByPriorities.Add( + 2000, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension DomainModel", template: "{controller=Home}/{action=Index}/{id?}"); + } + ); + + return routeRegistrarsByPriorities; + } + } + + + public int ConfigureServicesPriorities + { + get + { + return 2001; + } + } + public int ConfigurePriorities + { + get + { + return 2001; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + public void ConfigureServices(IServiceCollection services) + { + services.AddEntityFrameworkSqlite(); + services.AddDbContext(options => + { + options.UseSqlite(this.configurationRoot["Data:DefaultConnection:ConnectionString"]); + }); + services.AddScoped, ItemService>(); + services.AddScoped, ItemRepository>(); + } + + public void Configure(IApplicationBuilder applicationBuilder) + { + } + } +} \ No newline at end of file diff --git a/src/DomainModel/Infrastracture.Repository/DomainModel.Infrastracture.Repositorys.csproj b/src/DomainModel/Infrastracture.Repository/DomainModel.Infrastracture.Repositorys.csproj new file mode 100644 index 0000000..c45afaf --- /dev/null +++ b/src/DomainModel/Infrastracture.Repository/DomainModel.Infrastracture.Repositorys.csproj @@ -0,0 +1,19 @@ + + + + netstandard1.6 + DomainModel.Infrastracture.Repositorys + DomainModel.Infrastracture.Repositorys + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + DomainModel.Infrastracture.Repositorys + + + + + + + \ No newline at end of file diff --git a/src/DomainModel/Infrastracture.Repository/IInRepositorys.cs b/src/DomainModel/Infrastracture.Repository/IInRepositorys.cs new file mode 100644 index 0000000..fe8b41c --- /dev/null +++ b/src/DomainModel/Infrastracture.Repository/IInRepositorys.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace DomainModel.Infrastracture.Repositorys +{ + public interface IInRepositorys + { + void Add(T value); + void Update(long id, T value); + } +} diff --git a/src/DomainModel/Infrastracture.Repository/IOutRepositorys.cs b/src/DomainModel/Infrastracture.Repository/IOutRepositorys.cs new file mode 100644 index 0000000..f5c2b42 --- /dev/null +++ b/src/DomainModel/Infrastracture.Repository/IOutRepositorys.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace DomainModel.Infrastracture.Repositorys +{ + public interface IOutRepositorys + { + IEnumerable All(); + T Find(long id); + } +} diff --git a/src/DomainModel/Infrastracture.Repository/IRepository.cs b/src/DomainModel/Infrastracture.Repository/IRepository.cs new file mode 100644 index 0000000..7fb08d5 --- /dev/null +++ b/src/DomainModel/Infrastracture.Repository/IRepository.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using DomainModel.Models; + +namespace DomainModel.Infrastracture.Repositorys +{ + public interface IRepository : IInRepositorys, IOutRepositorys + { + new IEnumerable All(); + new T Find(long id); + new void Add(T value); + new void Update(long id, T value); + void Delete(long id); + } +} diff --git a/src/DomainModel/Infrastracture.Service/DomainModel.Infrastracture.Services.csproj b/src/DomainModel/Infrastracture.Service/DomainModel.Infrastracture.Services.csproj new file mode 100644 index 0000000..6c84ce6 --- /dev/null +++ b/src/DomainModel/Infrastracture.Service/DomainModel.Infrastracture.Services.csproj @@ -0,0 +1,23 @@ + + + + netstandard1.6 + DomainModel.Infrastracture.Service + DomainModel.Infrastracture.Service + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + DomainModel.Infrastracture.Services + + + + + + + + + + + \ No newline at end of file diff --git a/src/DomainModel/Infrastracture.Service/IInService.cs b/src/DomainModel/Infrastracture.Service/IInService.cs new file mode 100644 index 0000000..b6aa0a5 --- /dev/null +++ b/src/DomainModel/Infrastracture.Service/IInService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace DomainModel.Infrastracture.Services +{ + public interface IInService + { + void Add(T value); + void Update(long id, T value); + } +} diff --git a/src/DomainModel/Infrastracture.Service/IOutService.cs b/src/DomainModel/Infrastracture.Service/IOutService.cs new file mode 100644 index 0000000..a6932d1 --- /dev/null +++ b/src/DomainModel/Infrastracture.Service/IOutService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace DomainModel.Infrastracture.Services +{ + public interface IOutService + { + IEnumerable All(); + T Find(long id); + } +} diff --git a/src/DomainModel/Infrastracture.Service/IService.cs b/src/DomainModel/Infrastracture.Service/IService.cs new file mode 100644 index 0000000..be726f2 --- /dev/null +++ b/src/DomainModel/Infrastracture.Service/IService.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using DomainModel.Models; + +namespace DomainModel.Infrastracture.Services +{ + public interface IService : IInService, IOutService + { + new IEnumerable All(); + new T Find(long id); + new void Add(T value); + new void Update(long id, T value); + void Delete(long id); + } +} diff --git a/src/DomainModel/Models/DomainModel.Models.csproj b/src/DomainModel/Models/DomainModel.Models.csproj new file mode 100644 index 0000000..095b30c --- /dev/null +++ b/src/DomainModel/Models/DomainModel.Models.csproj @@ -0,0 +1,19 @@ + + + + netstandard1.6 + DomainModel.Models + DomainModel.Models + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + DomainModel.Models + + + + + + + \ No newline at end of file diff --git a/src/DomainModel/Models/Item.cs b/src/DomainModel/Models/Item.cs new file mode 100644 index 0000000..ce5f556 --- /dev/null +++ b/src/DomainModel/Models/Item.cs @@ -0,0 +1,11 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace DomainModel.Models +{ + public class Item + { + public int Id { get; set; } + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/DomainModel/Models/ItemDbContext.cs b/src/DomainModel/Models/ItemDbContext.cs new file mode 100644 index 0000000..3cdc976 --- /dev/null +++ b/src/DomainModel/Models/ItemDbContext.cs @@ -0,0 +1,19 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.EntityFrameworkCore; + +namespace DomainModel.Models +{ + public class ItemDbContext : DbContext + { + public ItemDbContext(DbContextOptions options) :base(options) + { } + public DbSet Items { get; set; } + protected override void OnModelCreating(ModelBuilder builder) + { + builder.Entity().HasKey(m => m.Id); + base.OnModelCreating(builder); + } + } +} \ No newline at end of file diff --git a/src/DomainModel/Repository/DomainModel.Repositorys.csproj b/src/DomainModel/Repository/DomainModel.Repositorys.csproj new file mode 100644 index 0000000..c7acd1d --- /dev/null +++ b/src/DomainModel/Repository/DomainModel.Repositorys.csproj @@ -0,0 +1,20 @@ + + + + netstandard1.6 + DomainModel.Repository + DomainModel.Repository + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + DomainModel.Repositorys + + + + + + + + \ No newline at end of file diff --git a/src/DomainModel/Repository/ItemRepository.cs b/src/DomainModel/Repository/ItemRepository.cs new file mode 100644 index 0000000..650ada2 --- /dev/null +++ b/src/DomainModel/Repository/ItemRepository.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using DomainModel.Models; +using DomainModel.Infrastracture.Repositorys; + +namespace DomainModel.Repositorys +{ + public class ItemRepository : IRepository + { + private ItemDbContext _itemDbContext { get; set; } + public ItemRepository(ItemDbContext itemDbContext) + { + _itemDbContext = itemDbContext; + } + public IEnumerable All() + { + return _itemDbContext.Items.OrderBy(i => i.Name); + } + public Item Find(long id) + { + return _itemDbContext.Items.Where(i => i.Id == id).First(); + } + public void Add(Item value) + { + _itemDbContext.Items.Add(value); + _itemDbContext.SaveChanges(); + return; + } + public void Update(long id, Item value) + { + _itemDbContext.Items.Update(value); + _itemDbContext.SaveChanges(); + return; + } + public void Delete(long id) + { + var value = _itemDbContext.Items.Where(i => i.Id == id).First(); + _itemDbContext.Items.Remove(value); + _itemDbContext.SaveChanges(); + return; + } + } +} \ No newline at end of file diff --git a/src/DomainModel/Services/DomainModel.Services.csproj b/src/DomainModel/Services/DomainModel.Services.csproj new file mode 100644 index 0000000..b04a7dd --- /dev/null +++ b/src/DomainModel/Services/DomainModel.Services.csproj @@ -0,0 +1,21 @@ + + + + netstandard1.6 + DomainModel.Services + DomainModel.Services + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + DomainModel.Services + + + + + + + + + \ No newline at end of file diff --git a/src/DomainModel/Services/ItemService.cs b/src/DomainModel/Services/ItemService.cs new file mode 100644 index 0000000..b474591 --- /dev/null +++ b/src/DomainModel/Services/ItemService.cs @@ -0,0 +1,43 @@ +using System; +using DomainModel.Models; +using DomainModel.Infrastracture.Services; +using DomainModel.Infrastracture.Repositorys; +using System.Collections.Generic; + +namespace DomainModel.Services +{ + public class ItemService : IService + { + private IRepository _itemRepository { get; set; } + + public ItemService(IRepository itemRepository) + { + _itemRepository = itemRepository; + } + + public IEnumerable All() + { + return _itemRepository.All(); + } + + public Item Find(long id) + { + return _itemRepository.Find(id); + } + + public void Add(Item value) + { + _itemRepository.Add(value); + } + + public void Update(long id, Item value) + { + _itemRepository.Update(id, value); + } + + public void Delete(long id) + { + _itemRepository.Delete(id); + } + } +} \ No newline at end of file diff --git a/src/WebApplication/gulpfile.js b/src/WebApplication/gulpfile.js index 253b8f5..2324bfa 100644 --- a/src/WebApplication/gulpfile.js +++ b/src/WebApplication/gulpfile.js @@ -26,4 +26,13 @@ gulp.task( gulp.src(["../WebApplication.WebAPI/bin/Release/netstandard1.6/WebApplication.WebAPI.dll"]).pipe(gulp.dest("Extensions")); cb(); } +); + +gulp.task( + "copy-extensions-domainmodel", function (cb) { + gulp.src(["../WebApplication.ExtensionA/bin/Release/netstandard1.6/WebApplication.ExtensionA.dll"]).pipe(gulp.dest("Extensions")); + gulp.src(["../DomainModel/Extentions/bin/Debug/netstandard1.6/*"]).pipe(gulp.dest("Extensions")); + gulp.src(["../WebApplication.Swagger/bin/Debug/netstandard1.6/WebApplication.Swagger.dll"]).pipe(gulp.dest("Extensions")); + cb(); + } ); \ No newline at end of file From e9fab77c12e01e4376a2b823cde53289797c0cef Mon Sep 17 00:00:00 2001 From: USER001 F Date: Wed, 26 Apr 2017 00:51:09 +0900 Subject: [PATCH 16/18] Add build.cmd --- build.cake | 3 +++ build.cmd | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 build.cmd diff --git a/build.cake b/build.cake index aa254de..e91f3fb 100644 --- a/build.cake +++ b/build.cake @@ -13,6 +13,7 @@ var packPath6 = Directory("./src/WebApplication.NLog"); var packPath7 = Directory("./src/WebApplication.Script"); var packPath8 = Directory("./src/WebApplication.Swagger"); var packPath9 = Directory("./src/WebApplication.WebAPI"); +var packPath10 = Directory("./src/DomainModel/Extentions"); var buildArtifacts = Directory("./artifacts/packages"); var isAppVeyor = AppVeyor.IsRunningOnAppVeyor; @@ -88,6 +89,7 @@ Task("Build") DotNetCoreBuild(packPath7, settings); DotNetCoreBuild(packPath8, settings); DotNetCoreBuild(packPath9, settings); + DotNetCoreBuild(packPath10, settings); //settings.Framework = netcore; DotNetCoreBuild(packPath1, settings); @@ -169,6 +171,7 @@ Task("Pack") DotNetCorePack(packPath7, settings); DotNetCorePack(packPath8, settings); DotNetCorePack(packPath9, settings); + DotNetCorePack(packPath10, settings); //settings.Framework = netcore; DotNetCorePack(packPath1, settings); }); diff --git a/build.cmd b/build.cmd new file mode 100644 index 0000000..7d4894c --- /dev/null +++ b/build.cmd @@ -0,0 +1,2 @@ +@ECHO OFF +PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE" \ No newline at end of file From 661d018538bc0133658823b21110bc0630168941 Mon Sep 17 00:00:00 2001 From: USER001 F Date: Sun, 30 Apr 2017 01:17:40 +0900 Subject: [PATCH 17/18] Add Overrried Try Codeing --- WebApplication.sln | 127 ++++++++++++++++++ .../DomainModel.Daos/DomainModel.Daos.csproj | 19 +++ src/DomainModel/DomainModel.Daos/WorkDao.cs | 48 +++++++ .../DomainModel.Infrastracture.Daos.csproj | 7 + .../DomainModel.Infrastracture.Daos/IDao.cs | 14 ++ .../IInDaos.cs | 12 ++ .../IOutDaos.cs | 12 ++ .../Extentions/DomainModel.Extentions.csproj | 2 + src/DomainModel/Extentions/Extention.cs | 3 + ...ainModel.Infrastracture.Repositorys.csproj | 4 - .../Infrastracture.Repository/IRepository.cs | 1 - ...DomainModel.Infrastracture.Services.csproj | 8 -- .../Infrastracture.Service/IService.cs | 4 +- .../Package.Controllers/ItemsController.cs | 44 ++++++ .../Package.Controllers.csproj | 20 +++ src/Package/Package.Extentions/Extention.cs | 9 ++ .../Package.Extentions.csproj | 7 + .../IInRepositorys.cs | 12 ++ .../IOutRepositorys.cs | 12 ++ .../IRepository.cs | 14 ++ .../Package.Infrastracture.Repositorys.csproj | 15 +++ .../IInService.cs | 12 ++ .../IOutService.cs | 12 ++ .../IService.cs | 14 ++ .../Package.Infrastracture.Services.csproj | 15 +++ src/Package/Package.Models/Item.cs | 11 ++ src/Package/Package.Models/ItemDbContext.cs | 19 +++ .../Package.Models/Package.Models.csproj | 19 +++ .../Package.Repositorys/ItemRepository.cs | 45 +++++++ .../Package.Repositorys.csproj | 20 +++ src/Package/Package.Services/ItemService.cs | 43 ++++++ .../Package.Services/Package.Services.csproj | 21 +++ .../Items2Controller.cs | 44 ++++++ .../PackageCustum.Controllers.csproj | 22 +++ .../PackageCustum.Models/Item.cs | 10 ++ .../PackageCustum.Models/Item2DbContext.cs | 16 +++ .../PackageCustum.Models.csproj | 19 +++ .../ItemCustumRepository.cs | 44 ++++++ .../PackageCustum.Repositorys.csproj | 21 +++ .../ItemCustumService.cs | 43 ++++++ .../PackageCustum.Services.csproj | 21 +++ .../PackageCusum.Extentions/Extention.cs | 87 ++++++++++++ .../PackageCusum.Extentions.csproj | 21 +++ src/WebApplication/Program.cs | 25 ++-- src/WebApplication/db.sqlite | Bin 3072 -> 4096 bytes src/WebApplication/gulpfile.js | 2 + 46 files changed, 973 insertions(+), 27 deletions(-) create mode 100644 src/DomainModel/DomainModel.Daos/DomainModel.Daos.csproj create mode 100644 src/DomainModel/DomainModel.Daos/WorkDao.cs create mode 100644 src/DomainModel/DomainModel.Infrastracture.Daos/DomainModel.Infrastracture.Daos.csproj create mode 100644 src/DomainModel/DomainModel.Infrastracture.Daos/IDao.cs create mode 100644 src/DomainModel/DomainModel.Infrastracture.Daos/IInDaos.cs create mode 100644 src/DomainModel/DomainModel.Infrastracture.Daos/IOutDaos.cs create mode 100644 src/Package/Package.Controllers/ItemsController.cs create mode 100644 src/Package/Package.Controllers/Package.Controllers.csproj create mode 100644 src/Package/Package.Extentions/Extention.cs create mode 100644 src/Package/Package.Extentions/Package.Extentions.csproj create mode 100644 src/Package/Package.Infrastracture.Repositorys/IInRepositorys.cs create mode 100644 src/Package/Package.Infrastracture.Repositorys/IOutRepositorys.cs create mode 100644 src/Package/Package.Infrastracture.Repositorys/IRepository.cs create mode 100644 src/Package/Package.Infrastracture.Repositorys/Package.Infrastracture.Repositorys.csproj create mode 100644 src/Package/Package.Infrastracture.Services/IInService.cs create mode 100644 src/Package/Package.Infrastracture.Services/IOutService.cs create mode 100644 src/Package/Package.Infrastracture.Services/IService.cs create mode 100644 src/Package/Package.Infrastracture.Services/Package.Infrastracture.Services.csproj create mode 100644 src/Package/Package.Models/Item.cs create mode 100644 src/Package/Package.Models/ItemDbContext.cs create mode 100644 src/Package/Package.Models/Package.Models.csproj create mode 100644 src/Package/Package.Repositorys/ItemRepository.cs create mode 100644 src/Package/Package.Repositorys/Package.Repositorys.csproj create mode 100644 src/Package/Package.Services/ItemService.cs create mode 100644 src/Package/Package.Services/Package.Services.csproj create mode 100644 src/PackageCustum/PackageCustum.Controllers/Items2Controller.cs create mode 100644 src/PackageCustum/PackageCustum.Controllers/PackageCustum.Controllers.csproj create mode 100644 src/PackageCustum/PackageCustum.Models/Item.cs create mode 100644 src/PackageCustum/PackageCustum.Models/Item2DbContext.cs create mode 100644 src/PackageCustum/PackageCustum.Models/PackageCustum.Models.csproj create mode 100644 src/PackageCustum/PackageCustum.Repositorys/ItemCustumRepository.cs create mode 100644 src/PackageCustum/PackageCustum.Repositorys/PackageCustum.Repositorys.csproj create mode 100644 src/PackageCustum/PackageCustum.Services/ItemCustumService.cs create mode 100644 src/PackageCustum/PackageCustum.Services/PackageCustum.Services.csproj create mode 100644 src/PackageCustum/PackageCusum.Extentions/Extention.cs create mode 100644 src/PackageCustum/PackageCusum.Extentions/PackageCusum.Extentions.csproj diff --git a/WebApplication.sln b/WebApplication.sln index c58b3da..d0bdead 100644 --- a/WebApplication.sln +++ b/WebApplication.sln @@ -47,10 +47,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Extentions", "s ProjectSection(ProjectDependencies) = postProject {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F} = {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F} {C948C12E-D584-46FF-B85C-A81AA341A1ED} = {C948C12E-D584-46FF-B85C-A81AA341A1ED} + {F16CCC3E-227F-48ED-95B7-64B39622B530} = {F16CCC3E-227F-48ED-95B7-64B39622B530} {B0AA4F66-55A2-4DA2-A3E6-65824A3EBF38} = {B0AA4F66-55A2-4DA2-A3E6-65824A3EBF38} {BB096868-3D0B-431F-BDF5-37388F1E4D18} = {BB096868-3D0B-431F-BDF5-37388F1E4D18} {37D1D188-9191-4766-8171-678620C702C4} = {37D1D188-9191-4766-8171-678620C702C4} {DE6A91AA-3C4B-4723-8B6B-82E31B5DE127} = {DE6A91AA-3C4B-4723-8B6B-82E31B5DE127} + {AF6B52DE-2DB1-4328-9F70-BAFAD7B06C22} = {AF6B52DE-2DB1-4328-9F70-BAFAD7B06C22} EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Controllers", "src\DomainModel\Controllers\DomainModel.Controllers.csproj", "{B0AA4F66-55A2-4DA2-A3E6-65824A3EBF38}" @@ -80,6 +82,59 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Repositorys", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Models", "src\DomainModel\Models\DomainModel.Models.csproj", "{4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Infrastracture.Daos", "src\DomainModel\DomainModel.Infrastracture.Daos\DomainModel.Infrastracture.Daos.csproj", "{F16CCC3E-227F-48ED-95B7-64B39622B530}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Daos", "src\DomainModel\DomainModel.Daos\DomainModel.Daos.csproj", "{AF6B52DE-2DB1-4328-9F70-BAFAD7B06C22}" + ProjectSection(ProjectDependencies) = postProject + {F16CCC3E-227F-48ED-95B7-64B39622B530} = {F16CCC3E-227F-48ED-95B7-64B39622B530} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Package", "Package", "{51171CE2-9F5D-4DF3-B3A8-0CAB3AB537F6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Package.Extentions", "src\Package\Package.Extentions\Package.Extentions.csproj", "{371DF498-06E5-4E4E-9A1F-59C83D5AB013}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Package.Controllers", "src\Package\Package.Controllers\Package.Controllers.csproj", "{4911558D-1790-4C07-8375-8B26A209BFC2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Package.Models", "src\Package\Package.Models\Package.Models.csproj", "{633AB8A0-F6CB-4ECF-9AB0-E087B7DCBC2F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Package.Infrastracture.Repositorys", "src\Package\Package.Infrastracture.Repositorys\Package.Infrastracture.Repositorys.csproj", "{E0D7FFAC-116E-422C-8261-33E8DFEE0CBB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Package.Repositorys", "src\Package\Package.Repositorys\Package.Repositorys.csproj", "{36A51092-10EE-4D1A-B10A-2E0ADDF235D8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Package.Infrastracture.Services", "src\Package\Package.Infrastracture.Services\Package.Infrastracture.Services.csproj", "{8A3F63E4-7DC5-44B0-97B6-3CF14275A31B}" + ProjectSection(ProjectDependencies) = postProject + {E0D7FFAC-116E-422C-8261-33E8DFEE0CBB} = {E0D7FFAC-116E-422C-8261-33E8DFEE0CBB} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Package.Services", "src\Package\Package.Services\Package.Services.csproj", "{A69333CC-A224-49C7-9107-F00EA30448C4}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PackageCustum", "PackageCustum", "{4F4FE0B9-BADD-456C-A970-799F85FB7AC9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageCustum.Models", "src\PackageCustum\PackageCustum.Models\PackageCustum.Models.csproj", "{19F406F8-4E9A-4B56-84C6-3E26E22427C5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageCustum.Repositorys", "src\PackageCustum\PackageCustum.Repositorys\PackageCustum.Repositorys.csproj", "{5F2ADE5B-6CC1-47AF-9263-7DC44EE79A6A}" + ProjectSection(ProjectDependencies) = postProject + {36A51092-10EE-4D1A-B10A-2E0ADDF235D8} = {36A51092-10EE-4D1A-B10A-2E0ADDF235D8} + {633AB8A0-F6CB-4ECF-9AB0-E087B7DCBC2F} = {633AB8A0-F6CB-4ECF-9AB0-E087B7DCBC2F} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageCustum.Services", "src\PackageCustum\PackageCustum.Services\PackageCustum.Services.csproj", "{8FD1C854-9C2D-49A9-9BD4-07DBF59F95A9}" + ProjectSection(ProjectDependencies) = postProject + {E0D7FFAC-116E-422C-8261-33E8DFEE0CBB} = {E0D7FFAC-116E-422C-8261-33E8DFEE0CBB} + {8A3F63E4-7DC5-44B0-97B6-3CF14275A31B} = {8A3F63E4-7DC5-44B0-97B6-3CF14275A31B} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageCustum.Controllers", "src\PackageCustum\PackageCustum.Controllers\PackageCustum.Controllers.csproj", "{49616BDF-FD9B-4B58-AAC3-162B56F2EB66}" + ProjectSection(ProjectDependencies) = postProject + {8FD1C854-9C2D-49A9-9BD4-07DBF59F95A9} = {8FD1C854-9C2D-49A9-9BD4-07DBF59F95A9} + {19F406F8-4E9A-4B56-84C6-3E26E22427C5} = {19F406F8-4E9A-4B56-84C6-3E26E22427C5} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageCusum.Extentions", "src\PackageCustum\PackageCusum.Extentions\PackageCusum.Extentions.csproj", "{2D12879E-225A-42D6-B8F9-EA02A596AE28}" + ProjectSection(ProjectDependencies) = postProject + {19F406F8-4E9A-4B56-84C6-3E26E22427C5} = {19F406F8-4E9A-4B56-84C6-3E26E22427C5} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -150,6 +205,62 @@ Global {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F}.Debug|Any CPU.Build.0 = Debug|Any CPU {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F}.Release|Any CPU.ActiveCfg = Release|Any CPU {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F}.Release|Any CPU.Build.0 = Release|Any CPU + {F16CCC3E-227F-48ED-95B7-64B39622B530}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F16CCC3E-227F-48ED-95B7-64B39622B530}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F16CCC3E-227F-48ED-95B7-64B39622B530}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F16CCC3E-227F-48ED-95B7-64B39622B530}.Release|Any CPU.Build.0 = Release|Any CPU + {AF6B52DE-2DB1-4328-9F70-BAFAD7B06C22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF6B52DE-2DB1-4328-9F70-BAFAD7B06C22}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF6B52DE-2DB1-4328-9F70-BAFAD7B06C22}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF6B52DE-2DB1-4328-9F70-BAFAD7B06C22}.Release|Any CPU.Build.0 = Release|Any CPU + {371DF498-06E5-4E4E-9A1F-59C83D5AB013}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {371DF498-06E5-4E4E-9A1F-59C83D5AB013}.Debug|Any CPU.Build.0 = Debug|Any CPU + {371DF498-06E5-4E4E-9A1F-59C83D5AB013}.Release|Any CPU.ActiveCfg = Release|Any CPU + {371DF498-06E5-4E4E-9A1F-59C83D5AB013}.Release|Any CPU.Build.0 = Release|Any CPU + {4911558D-1790-4C07-8375-8B26A209BFC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4911558D-1790-4C07-8375-8B26A209BFC2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4911558D-1790-4C07-8375-8B26A209BFC2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4911558D-1790-4C07-8375-8B26A209BFC2}.Release|Any CPU.Build.0 = Release|Any CPU + {633AB8A0-F6CB-4ECF-9AB0-E087B7DCBC2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {633AB8A0-F6CB-4ECF-9AB0-E087B7DCBC2F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {633AB8A0-F6CB-4ECF-9AB0-E087B7DCBC2F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {633AB8A0-F6CB-4ECF-9AB0-E087B7DCBC2F}.Release|Any CPU.Build.0 = Release|Any CPU + {E0D7FFAC-116E-422C-8261-33E8DFEE0CBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E0D7FFAC-116E-422C-8261-33E8DFEE0CBB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E0D7FFAC-116E-422C-8261-33E8DFEE0CBB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E0D7FFAC-116E-422C-8261-33E8DFEE0CBB}.Release|Any CPU.Build.0 = Release|Any CPU + {36A51092-10EE-4D1A-B10A-2E0ADDF235D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {36A51092-10EE-4D1A-B10A-2E0ADDF235D8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {36A51092-10EE-4D1A-B10A-2E0ADDF235D8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {36A51092-10EE-4D1A-B10A-2E0ADDF235D8}.Release|Any CPU.Build.0 = Release|Any CPU + {8A3F63E4-7DC5-44B0-97B6-3CF14275A31B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8A3F63E4-7DC5-44B0-97B6-3CF14275A31B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8A3F63E4-7DC5-44B0-97B6-3CF14275A31B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8A3F63E4-7DC5-44B0-97B6-3CF14275A31B}.Release|Any CPU.Build.0 = Release|Any CPU + {A69333CC-A224-49C7-9107-F00EA30448C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A69333CC-A224-49C7-9107-F00EA30448C4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A69333CC-A224-49C7-9107-F00EA30448C4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A69333CC-A224-49C7-9107-F00EA30448C4}.Release|Any CPU.Build.0 = Release|Any CPU + {19F406F8-4E9A-4B56-84C6-3E26E22427C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F406F8-4E9A-4B56-84C6-3E26E22427C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F406F8-4E9A-4B56-84C6-3E26E22427C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F406F8-4E9A-4B56-84C6-3E26E22427C5}.Release|Any CPU.Build.0 = Release|Any CPU + {5F2ADE5B-6CC1-47AF-9263-7DC44EE79A6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F2ADE5B-6CC1-47AF-9263-7DC44EE79A6A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5F2ADE5B-6CC1-47AF-9263-7DC44EE79A6A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5F2ADE5B-6CC1-47AF-9263-7DC44EE79A6A}.Release|Any CPU.Build.0 = Release|Any CPU + {8FD1C854-9C2D-49A9-9BD4-07DBF59F95A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8FD1C854-9C2D-49A9-9BD4-07DBF59F95A9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8FD1C854-9C2D-49A9-9BD4-07DBF59F95A9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8FD1C854-9C2D-49A9-9BD4-07DBF59F95A9}.Release|Any CPU.Build.0 = Release|Any CPU + {49616BDF-FD9B-4B58-AAC3-162B56F2EB66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {49616BDF-FD9B-4B58-AAC3-162B56F2EB66}.Debug|Any CPU.Build.0 = Debug|Any CPU + {49616BDF-FD9B-4B58-AAC3-162B56F2EB66}.Release|Any CPU.ActiveCfg = Release|Any CPU + {49616BDF-FD9B-4B58-AAC3-162B56F2EB66}.Release|Any CPU.Build.0 = Release|Any CPU + {2D12879E-225A-42D6-B8F9-EA02A596AE28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2D12879E-225A-42D6-B8F9-EA02A596AE28}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2D12879E-225A-42D6-B8F9-EA02A596AE28}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2D12879E-225A-42D6-B8F9-EA02A596AE28}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -180,5 +291,21 @@ Global {BB096868-3D0B-431F-BDF5-37388F1E4D18} = {CA30C73C-6C4B-410F-AFDB-07A2BCEED456} {C948C12E-D584-46FF-B85C-A81AA341A1ED} = {CA30C73C-6C4B-410F-AFDB-07A2BCEED456} {4D5CA518-C87B-4886-BD63-DA3FBDF5DE8F} = {CA30C73C-6C4B-410F-AFDB-07A2BCEED456} + {F16CCC3E-227F-48ED-95B7-64B39622B530} = {CA30C73C-6C4B-410F-AFDB-07A2BCEED456} + {AF6B52DE-2DB1-4328-9F70-BAFAD7B06C22} = {CA30C73C-6C4B-410F-AFDB-07A2BCEED456} + {51171CE2-9F5D-4DF3-B3A8-0CAB3AB537F6} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {371DF498-06E5-4E4E-9A1F-59C83D5AB013} = {51171CE2-9F5D-4DF3-B3A8-0CAB3AB537F6} + {4911558D-1790-4C07-8375-8B26A209BFC2} = {51171CE2-9F5D-4DF3-B3A8-0CAB3AB537F6} + {633AB8A0-F6CB-4ECF-9AB0-E087B7DCBC2F} = {51171CE2-9F5D-4DF3-B3A8-0CAB3AB537F6} + {E0D7FFAC-116E-422C-8261-33E8DFEE0CBB} = {51171CE2-9F5D-4DF3-B3A8-0CAB3AB537F6} + {36A51092-10EE-4D1A-B10A-2E0ADDF235D8} = {51171CE2-9F5D-4DF3-B3A8-0CAB3AB537F6} + {8A3F63E4-7DC5-44B0-97B6-3CF14275A31B} = {51171CE2-9F5D-4DF3-B3A8-0CAB3AB537F6} + {A69333CC-A224-49C7-9107-F00EA30448C4} = {51171CE2-9F5D-4DF3-B3A8-0CAB3AB537F6} + {4F4FE0B9-BADD-456C-A970-799F85FB7AC9} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {19F406F8-4E9A-4B56-84C6-3E26E22427C5} = {4F4FE0B9-BADD-456C-A970-799F85FB7AC9} + {5F2ADE5B-6CC1-47AF-9263-7DC44EE79A6A} = {4F4FE0B9-BADD-456C-A970-799F85FB7AC9} + {8FD1C854-9C2D-49A9-9BD4-07DBF59F95A9} = {4F4FE0B9-BADD-456C-A970-799F85FB7AC9} + {49616BDF-FD9B-4B58-AAC3-162B56F2EB66} = {4F4FE0B9-BADD-456C-A970-799F85FB7AC9} + {2D12879E-225A-42D6-B8F9-EA02A596AE28} = {4F4FE0B9-BADD-456C-A970-799F85FB7AC9} EndGlobalSection EndGlobal diff --git a/src/DomainModel/DomainModel.Daos/DomainModel.Daos.csproj b/src/DomainModel/DomainModel.Daos/DomainModel.Daos.csproj new file mode 100644 index 0000000..061bdfd --- /dev/null +++ b/src/DomainModel/DomainModel.Daos/DomainModel.Daos.csproj @@ -0,0 +1,19 @@ + + + + netstandard1.6 + DomainModel.Daos + DomainModel.Daos + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + DomainModel.Daos + + + + + + + + \ No newline at end of file diff --git a/src/DomainModel/DomainModel.Daos/WorkDao.cs b/src/DomainModel/DomainModel.Daos/WorkDao.cs new file mode 100644 index 0000000..26bcbe7 --- /dev/null +++ b/src/DomainModel/DomainModel.Daos/WorkDao.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using DomainModel.Infrastracture.Daos; +using DomainModel.Models; +using Dapper; +using Microsoft.EntityFrameworkCore; +using System.Dynamic; + +namespace DomainModel.Daos +{ + public class WorkDao : IDao + { + private ItemDbContext _itemDbContext { get; set; } + public WorkDao(ItemDbContext itemDbContext) + { + _itemDbContext = itemDbContext; + } + + public void Add(Item value) + { + var connection = _itemDbContext.Database.GetDbConnection(); + dynamic exObj = connection.Query(@"select * from item"); + ExpandoObject obj = new ExpandoObject(); + throw new NotImplementedException(); + } + + public System.Collections.Generic.IEnumerable All() + { + throw new NotImplementedException(); + } + + public void Delete(long id) + { + throw new NotImplementedException(); + } + + public Item Find(long id) + { + throw new NotImplementedException(); + } + + public void Update(long id, Item value) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/DomainModel/DomainModel.Infrastracture.Daos/DomainModel.Infrastracture.Daos.csproj b/src/DomainModel/DomainModel.Infrastracture.Daos/DomainModel.Infrastracture.Daos.csproj new file mode 100644 index 0000000..954020d --- /dev/null +++ b/src/DomainModel/DomainModel.Infrastracture.Daos/DomainModel.Infrastracture.Daos.csproj @@ -0,0 +1,7 @@ + + + + netstandard1.4 + + + \ No newline at end of file diff --git a/src/DomainModel/DomainModel.Infrastracture.Daos/IDao.cs b/src/DomainModel/DomainModel.Infrastracture.Daos/IDao.cs new file mode 100644 index 0000000..fc32a82 --- /dev/null +++ b/src/DomainModel/DomainModel.Infrastracture.Daos/IDao.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; + +namespace DomainModel.Infrastracture.Daos +{ + public interface IDao : IInDaos, IOutDaos + { + new IEnumerable All(); + new T Find(long id); + new void Add(T value); + new void Update(long id, T value); + void Delete(long id); + } +} diff --git a/src/DomainModel/DomainModel.Infrastracture.Daos/IInDaos.cs b/src/DomainModel/DomainModel.Infrastracture.Daos/IInDaos.cs new file mode 100644 index 0000000..e011b7b --- /dev/null +++ b/src/DomainModel/DomainModel.Infrastracture.Daos/IInDaos.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace DomainModel.Infrastracture.Daos +{ + public interface IInDaos + { + void Add(T value); + void Update(long id, T value); + } +} diff --git a/src/DomainModel/DomainModel.Infrastracture.Daos/IOutDaos.cs b/src/DomainModel/DomainModel.Infrastracture.Daos/IOutDaos.cs new file mode 100644 index 0000000..7eecf61 --- /dev/null +++ b/src/DomainModel/DomainModel.Infrastracture.Daos/IOutDaos.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace DomainModel.Infrastracture.Daos +{ + public interface IOutDaos + { + IEnumerable All(); + T Find(long id); + } +} \ No newline at end of file diff --git a/src/DomainModel/Extentions/DomainModel.Extentions.csproj b/src/DomainModel/Extentions/DomainModel.Extentions.csproj index 540b803..ea88a9c 100644 --- a/src/DomainModel/Extentions/DomainModel.Extentions.csproj +++ b/src/DomainModel/Extentions/DomainModel.Extentions.csproj @@ -13,6 +13,8 @@ + + diff --git a/src/DomainModel/Extentions/Extention.cs b/src/DomainModel/Extentions/Extention.cs index de8f15f..eebad09 100644 --- a/src/DomainModel/Extentions/Extention.cs +++ b/src/DomainModel/Extentions/Extention.cs @@ -10,10 +10,12 @@ using Microsoft.EntityFrameworkCore; using DomainModel.Infrastracture.Repositorys; using DomainModel.Infrastracture.Services; +using DomainModel.Infrastracture.Daos; using DomainModel.Repositorys; using DomainModel.Services; using DomainModel.Models; using DomainModel.Controllers; +//using DomainModel.Daos; namespace DomainModel.Extentions { @@ -76,6 +78,7 @@ public void ConfigureServices(IServiceCollection services) }); services.AddScoped, ItemService>(); services.AddScoped, ItemRepository>(); + //services.AddScoped, WorkDao>(); } public void Configure(IApplicationBuilder applicationBuilder) diff --git a/src/DomainModel/Infrastracture.Repository/DomainModel.Infrastracture.Repositorys.csproj b/src/DomainModel/Infrastracture.Repository/DomainModel.Infrastracture.Repositorys.csproj index c45afaf..ae5c4fd 100644 --- a/src/DomainModel/Infrastracture.Repository/DomainModel.Infrastracture.Repositorys.csproj +++ b/src/DomainModel/Infrastracture.Repository/DomainModel.Infrastracture.Repositorys.csproj @@ -12,8 +12,4 @@ DomainModel.Infrastracture.Repositorys - - - - \ No newline at end of file diff --git a/src/DomainModel/Infrastracture.Repository/IRepository.cs b/src/DomainModel/Infrastracture.Repository/IRepository.cs index 7fb08d5..10e5d4b 100644 --- a/src/DomainModel/Infrastracture.Repository/IRepository.cs +++ b/src/DomainModel/Infrastracture.Repository/IRepository.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using DomainModel.Models; namespace DomainModel.Infrastracture.Repositorys { diff --git a/src/DomainModel/Infrastracture.Service/DomainModel.Infrastracture.Services.csproj b/src/DomainModel/Infrastracture.Service/DomainModel.Infrastracture.Services.csproj index 6c84ce6..d161c46 100644 --- a/src/DomainModel/Infrastracture.Service/DomainModel.Infrastracture.Services.csproj +++ b/src/DomainModel/Infrastracture.Service/DomainModel.Infrastracture.Services.csproj @@ -12,12 +12,4 @@ DomainModel.Infrastracture.Services - - - - - - - - \ No newline at end of file diff --git a/src/DomainModel/Infrastracture.Service/IService.cs b/src/DomainModel/Infrastracture.Service/IService.cs index be726f2..d474fba 100644 --- a/src/DomainModel/Infrastracture.Service/IService.cs +++ b/src/DomainModel/Infrastracture.Service/IService.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using DomainModel.Models; +using System.Collections.Generic; namespace DomainModel.Infrastracture.Services { diff --git a/src/Package/Package.Controllers/ItemsController.cs b/src/Package/Package.Controllers/ItemsController.cs new file mode 100644 index 0000000..947d31e --- /dev/null +++ b/src/Package/Package.Controllers/ItemsController.cs @@ -0,0 +1,44 @@ +using System; +using Microsoft.AspNetCore.Mvc; +using Package.Infrastracture.Services; +using Package.Models; + +namespace Package.Controllers +{ + [Route("api/package/[controller]")] + public class ItemsController : Controller + { + private IService _itemService { get; set; } + + public ItemsController(IService itemService) + { + _itemService = itemService; + } + + [HttpGet] + public virtual IActionResult Get() + { + return Ok(_itemService.All()); + } + [HttpGet("{id}")] + public virtual IActionResult Get(long id) + { + return Ok(_itemService.Find(id)); + } + [HttpPost] + public virtual void Post([FromBody]Item value) + { + _itemService.Add(value); + } + [HttpPut("{id}")] + public virtual void Put(long id, [FromBody]Item value) + { + _itemService.Update(id, value); + } + [HttpDelete("{id}")] + public virtual void Delete(long id) + { + _itemService.Delete(id); + } + } +} \ No newline at end of file diff --git a/src/Package/Package.Controllers/Package.Controllers.csproj b/src/Package/Package.Controllers/Package.Controllers.csproj new file mode 100644 index 0000000..18ba33c --- /dev/null +++ b/src/Package/Package.Controllers/Package.Controllers.csproj @@ -0,0 +1,20 @@ + + + + netstandard1.6 + Package.Controllers + Package.Controllers + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + Package.Controllers + + + + + + + + \ No newline at end of file diff --git a/src/Package/Package.Extentions/Extention.cs b/src/Package/Package.Extentions/Extention.cs new file mode 100644 index 0000000..6465a24 --- /dev/null +++ b/src/Package/Package.Extentions/Extention.cs @@ -0,0 +1,9 @@ +namespace Package.Extentions +{ + /// + /// 実装しない。 カスタマイズ版で提供 + /// + public class Extention + { + } +} diff --git a/src/Package/Package.Extentions/Package.Extentions.csproj b/src/Package/Package.Extentions/Package.Extentions.csproj new file mode 100644 index 0000000..954020d --- /dev/null +++ b/src/Package/Package.Extentions/Package.Extentions.csproj @@ -0,0 +1,7 @@ + + + + netstandard1.4 + + + \ No newline at end of file diff --git a/src/Package/Package.Infrastracture.Repositorys/IInRepositorys.cs b/src/Package/Package.Infrastracture.Repositorys/IInRepositorys.cs new file mode 100644 index 0000000..5dcfd8b --- /dev/null +++ b/src/Package/Package.Infrastracture.Repositorys/IInRepositorys.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Package.Infrastracture.Repositorys +{ + public interface IInRepositorys + { + void Add(TEntity value); + void Update(long id, TEntity value); + } +} diff --git a/src/Package/Package.Infrastracture.Repositorys/IOutRepositorys.cs b/src/Package/Package.Infrastracture.Repositorys/IOutRepositorys.cs new file mode 100644 index 0000000..dbd2168 --- /dev/null +++ b/src/Package/Package.Infrastracture.Repositorys/IOutRepositorys.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Package.Infrastracture.Repositorys +{ + public interface IOutRepositorys + { + IEnumerable All(); + TEntity Find(long id); + } +} diff --git a/src/Package/Package.Infrastracture.Repositorys/IRepository.cs b/src/Package/Package.Infrastracture.Repositorys/IRepository.cs new file mode 100644 index 0000000..0b0d0a6 --- /dev/null +++ b/src/Package/Package.Infrastracture.Repositorys/IRepository.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; + +namespace Package.Infrastracture.Repositorys +{ + public interface IRepository : IInRepositorys, IOutRepositorys + { + new IEnumerable All(); + new TEntity Find(long id); + new void Add(TEntity value); + new void Update(long id, TEntity value); + void Delete(long id); + } +} diff --git a/src/Package/Package.Infrastracture.Repositorys/Package.Infrastracture.Repositorys.csproj b/src/Package/Package.Infrastracture.Repositorys/Package.Infrastracture.Repositorys.csproj new file mode 100644 index 0000000..cdcb148 --- /dev/null +++ b/src/Package/Package.Infrastracture.Repositorys/Package.Infrastracture.Repositorys.csproj @@ -0,0 +1,15 @@ + + + + netstandard1.6 + Package.Infrastracture.Repositorys + Package.Infrastracture.Repositorys + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + Package.Infrastracture.Repositorys + + + \ No newline at end of file diff --git a/src/Package/Package.Infrastracture.Services/IInService.cs b/src/Package/Package.Infrastracture.Services/IInService.cs new file mode 100644 index 0000000..60d01c2 --- /dev/null +++ b/src/Package/Package.Infrastracture.Services/IInService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Package.Infrastracture.Services +{ + public interface IInService + { + void Add(T value); + void Update(long id, T value); + } +} diff --git a/src/Package/Package.Infrastracture.Services/IOutService.cs b/src/Package/Package.Infrastracture.Services/IOutService.cs new file mode 100644 index 0000000..e899d42 --- /dev/null +++ b/src/Package/Package.Infrastracture.Services/IOutService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Package.Infrastracture.Services +{ + public interface IOutService + { + IEnumerable All(); + T Find(long id); + } +} diff --git a/src/Package/Package.Infrastracture.Services/IService.cs b/src/Package/Package.Infrastracture.Services/IService.cs new file mode 100644 index 0000000..8a51c22 --- /dev/null +++ b/src/Package/Package.Infrastracture.Services/IService.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; + +namespace Package.Infrastracture.Services +{ + public interface IService : IInService, IOutService + { + new IEnumerable All(); + new T Find(long id); + new void Add(T value); + new void Update(long id, T value); + void Delete(long id); + } +} diff --git a/src/Package/Package.Infrastracture.Services/Package.Infrastracture.Services.csproj b/src/Package/Package.Infrastracture.Services/Package.Infrastracture.Services.csproj new file mode 100644 index 0000000..2e67061 --- /dev/null +++ b/src/Package/Package.Infrastracture.Services/Package.Infrastracture.Services.csproj @@ -0,0 +1,15 @@ + + + + netstandard1.6 + Package.Infrastracture.Services + Package.Infrastracture.Services + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + Package.Infrastracture.Services + + + \ No newline at end of file diff --git a/src/Package/Package.Models/Item.cs b/src/Package/Package.Models/Item.cs new file mode 100644 index 0000000..66e7aff --- /dev/null +++ b/src/Package/Package.Models/Item.cs @@ -0,0 +1,11 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Package.Models +{ + public class Item + { + public int Id { get; set; } + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/Package/Package.Models/ItemDbContext.cs b/src/Package/Package.Models/ItemDbContext.cs new file mode 100644 index 0000000..7a512f8 --- /dev/null +++ b/src/Package/Package.Models/ItemDbContext.cs @@ -0,0 +1,19 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.EntityFrameworkCore; + +namespace Package.Models +{ + public class ItemDbContext : DbContext + { + public ItemDbContext(DbContextOptions options) :base(options) + { } + public DbSet Items { get; set; } + protected override void OnModelCreating(ModelBuilder builder) + { + builder.Entity().HasKey(m => m.Id); + base.OnModelCreating(builder); + } + } +} \ No newline at end of file diff --git a/src/Package/Package.Models/Package.Models.csproj b/src/Package/Package.Models/Package.Models.csproj new file mode 100644 index 0000000..9e6ff36 --- /dev/null +++ b/src/Package/Package.Models/Package.Models.csproj @@ -0,0 +1,19 @@ + + + + netstandard1.6 + Package.Models + Package.Models + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + Package.Models + + + + + + + \ No newline at end of file diff --git a/src/Package/Package.Repositorys/ItemRepository.cs b/src/Package/Package.Repositorys/ItemRepository.cs new file mode 100644 index 0000000..5547216 --- /dev/null +++ b/src/Package/Package.Repositorys/ItemRepository.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Package.Models; +using Package.Infrastracture.Repositorys; +using Microsoft.EntityFrameworkCore; + +namespace Package.Repositorys +{ + public class ItemRepository : IRepository + { + private ItemDbContext _itemDbContext { get; set; } + public ItemRepository(ItemDbContext itemDbContext) + { + _itemDbContext = itemDbContext; + } + public virtual IEnumerable All() + { + return _itemDbContext.Items.OrderBy(i => i.Name); + } + public virtual Item Find(long id) + { + return _itemDbContext.Items.Where(i => i.Id == id).First(); + } + public virtual void Add(Item value) + { + _itemDbContext.Items.Add(value); + _itemDbContext.SaveChanges(); + return; + } + public virtual void Update(long id, Item value) + { + _itemDbContext.Items.Update(value); + _itemDbContext.SaveChanges(); + return; + } + public virtual void Delete(long id) + { + var value = _itemDbContext.Items.Where(i => i.Id == id).First(); + _itemDbContext.Items.Remove(value); + _itemDbContext.SaveChanges(); + return; + } + } +} \ No newline at end of file diff --git a/src/Package/Package.Repositorys/Package.Repositorys.csproj b/src/Package/Package.Repositorys/Package.Repositorys.csproj new file mode 100644 index 0000000..98fca96 --- /dev/null +++ b/src/Package/Package.Repositorys/Package.Repositorys.csproj @@ -0,0 +1,20 @@ + + + + netstandard1.6 + Package.Repositorys + Package.Repositorys + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + Package.Repositorys + + + + + + + + \ No newline at end of file diff --git a/src/Package/Package.Services/ItemService.cs b/src/Package/Package.Services/ItemService.cs new file mode 100644 index 0000000..480e9ac --- /dev/null +++ b/src/Package/Package.Services/ItemService.cs @@ -0,0 +1,43 @@ +using System; +using Package.Models; +using Package.Infrastracture.Services; +using Package.Infrastracture.Repositorys; +using System.Collections.Generic; + +namespace Package.Services +{ + public class ItemService : IService + { + private IRepository _itemRepository { get; set; } + + public ItemService(IRepository itemRepository) + { + _itemRepository = itemRepository; + } + + public IEnumerable All() + { + return _itemRepository.All(); + } + + public Item Find(long id) + { + return _itemRepository.Find(id); + } + + public void Add(Item value) + { + _itemRepository.Add(value); + } + + public void Update(long id, Item value) + { + _itemRepository.Update(id, value); + } + + public void Delete(long id) + { + _itemRepository.Delete(id); + } + } +} \ No newline at end of file diff --git a/src/Package/Package.Services/Package.Services.csproj b/src/Package/Package.Services/Package.Services.csproj new file mode 100644 index 0000000..acf15e6 --- /dev/null +++ b/src/Package/Package.Services/Package.Services.csproj @@ -0,0 +1,21 @@ + + + + netstandard1.6 + Package.Services + Package.Services + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + Package.Services + + + + + + + + + \ No newline at end of file diff --git a/src/PackageCustum/PackageCustum.Controllers/Items2Controller.cs b/src/PackageCustum/PackageCustum.Controllers/Items2Controller.cs new file mode 100644 index 0000000..bde38ec --- /dev/null +++ b/src/PackageCustum/PackageCustum.Controllers/Items2Controller.cs @@ -0,0 +1,44 @@ +using System; +using Microsoft.AspNetCore.Mvc; +using Package.Infrastracture.Services; +using PackageCustum.Models; + +namespace Package.Controllers +{ + [Route("api/package2/[controller]")] + public class Items2Controller : Controller + { + private IService _itemService { get; set; } + + public Items2Controller(IService itemService) + { + _itemService = itemService; + } + + [HttpGet] + public virtual IActionResult Get() + { + return Ok(_itemService.All()); + } + [HttpGet("{id}")] + public virtual IActionResult Get(long id) + { + return Ok(_itemService.Find(id)); + } + [HttpPost] + public virtual void Post([FromBody]Item value) + { + _itemService.Add(value); + } + [HttpPut("{id}")] + public virtual void Put(long id, [FromBody]Item value) + { + _itemService.Update(id, value); + } + [HttpDelete("{id}")] + public virtual void Delete(long id) + { + _itemService.Delete(id); + } + } +} \ No newline at end of file diff --git a/src/PackageCustum/PackageCustum.Controllers/PackageCustum.Controllers.csproj b/src/PackageCustum/PackageCustum.Controllers/PackageCustum.Controllers.csproj new file mode 100644 index 0000000..6d06f07 --- /dev/null +++ b/src/PackageCustum/PackageCustum.Controllers/PackageCustum.Controllers.csproj @@ -0,0 +1,22 @@ + + + + netstandard1.6 + PackageCustum.Controllers + PackageCustum.Controllers + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + PackageCustum.Controllers + + + + + + + + + + \ No newline at end of file diff --git a/src/PackageCustum/PackageCustum.Models/Item.cs b/src/PackageCustum/PackageCustum.Models/Item.cs new file mode 100644 index 0000000..7476995 --- /dev/null +++ b/src/PackageCustum/PackageCustum.Models/Item.cs @@ -0,0 +1,10 @@ +using System; +using Package.Models; + +namespace PackageCustum.Models +{ + public class Item : Package.Models.Item + { + public string custum { get; set; } + } +} diff --git a/src/PackageCustum/PackageCustum.Models/Item2DbContext.cs b/src/PackageCustum/PackageCustum.Models/Item2DbContext.cs new file mode 100644 index 0000000..a6bf903 --- /dev/null +++ b/src/PackageCustum/PackageCustum.Models/Item2DbContext.cs @@ -0,0 +1,16 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.EntityFrameworkCore; +using Package.Models; +using PackageCustum.Models; + +namespace PackageCustum.Models +{ + public class Item2DbContext : DbContext + { + public Item2DbContext(DbContextOptions options) :base(options) + { } + public DbSet Items { get; set; } + } +} \ No newline at end of file diff --git a/src/PackageCustum/PackageCustum.Models/PackageCustum.Models.csproj b/src/PackageCustum/PackageCustum.Models/PackageCustum.Models.csproj new file mode 100644 index 0000000..5ecee0d --- /dev/null +++ b/src/PackageCustum/PackageCustum.Models/PackageCustum.Models.csproj @@ -0,0 +1,19 @@ + + + + netstandard1.6 + PackageCustum.Models + PackageCustum.Models + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + PackageCustum.Models + + + + + + + \ No newline at end of file diff --git a/src/PackageCustum/PackageCustum.Repositorys/ItemCustumRepository.cs b/src/PackageCustum/PackageCustum.Repositorys/ItemCustumRepository.cs new file mode 100644 index 0000000..ac52c2e --- /dev/null +++ b/src/PackageCustum/PackageCustum.Repositorys/ItemCustumRepository.cs @@ -0,0 +1,44 @@ +namespace PackageCustum.Repositorys +{ + using System; + using System.Collections.Generic; + using System.Linq; + using PackageCustum.Models; + using Package.Infrastracture.Repositorys; + + public class ItemCustumRepository : IRepository + { + private Item2DbContext _itemDbContext { get; set; } + public ItemCustumRepository(Item2DbContext itemDbContext) + { + _itemDbContext = itemDbContext; + } + public IEnumerable All() + { + return _itemDbContext.Items.OrderBy(i => i.Name); + } + public Item Find(long id) + { + return _itemDbContext.Items.Where(i => i.Id == id).First(); + } + public void Add(Item value) + { + _itemDbContext.Items.Add(value); + _itemDbContext.SaveChanges(); + return; + } + public void Update(long id, Item value) + { + _itemDbContext.Items.Update(value); + _itemDbContext.SaveChanges(); + return; + } + public void Delete(long id) + { + var value = _itemDbContext.Items.Where(i => i.Id == id).First(); + _itemDbContext.Items.Remove(value); + _itemDbContext.SaveChanges(); + return; + } + } +} \ No newline at end of file diff --git a/src/PackageCustum/PackageCustum.Repositorys/PackageCustum.Repositorys.csproj b/src/PackageCustum/PackageCustum.Repositorys/PackageCustum.Repositorys.csproj new file mode 100644 index 0000000..4527777 --- /dev/null +++ b/src/PackageCustum/PackageCustum.Repositorys/PackageCustum.Repositorys.csproj @@ -0,0 +1,21 @@ + + + + netstandard1.6 + PackageCustum.Repositorys + PackageCustum.Repositorys + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + PackageCustum.Repositorys + + + + + + + + + \ No newline at end of file diff --git a/src/PackageCustum/PackageCustum.Services/ItemCustumService.cs b/src/PackageCustum/PackageCustum.Services/ItemCustumService.cs new file mode 100644 index 0000000..2678c91 --- /dev/null +++ b/src/PackageCustum/PackageCustum.Services/ItemCustumService.cs @@ -0,0 +1,43 @@ +using System; +using PackageCustum.Models; +using Package.Infrastracture.Services; +using Package.Infrastracture.Repositorys; +using System.Collections.Generic; + +namespace PackageCustum.Services +{ + public class ItemCustumService : IService + { + private IRepository _itemRepository { get; set; } + + public ItemCustumService(IRepository itemRepository) + { + _itemRepository = itemRepository; + } + + public IEnumerable All() + { + return _itemRepository.All(); + } + + public Item Find(long id) + { + return _itemRepository.Find(id); + } + + public void Add(Item value) + { + _itemRepository.Add(value); + } + + public void Update(long id, Item value) + { + _itemRepository.Update(id, value); + } + + public void Delete(long id) + { + _itemRepository.Delete(id); + } + } +} \ No newline at end of file diff --git a/src/PackageCustum/PackageCustum.Services/PackageCustum.Services.csproj b/src/PackageCustum/PackageCustum.Services/PackageCustum.Services.csproj new file mode 100644 index 0000000..de72bb6 --- /dev/null +++ b/src/PackageCustum/PackageCustum.Services/PackageCustum.Services.csproj @@ -0,0 +1,21 @@ + + + + netstandard1.6 + PackageCustum.Services + PackageCustum.Services + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + PackageCustum.Services + + + + + + + + + \ No newline at end of file diff --git a/src/PackageCustum/PackageCusum.Extentions/Extention.cs b/src/PackageCustum/PackageCusum.Extentions/Extention.cs new file mode 100644 index 0000000..61cb107 --- /dev/null +++ b/src/PackageCustum/PackageCusum.Extentions/Extention.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ExtCore.Infrastructure; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.EntityFrameworkCore; +using Package.Infrastracture.Repositorys; +using Package.Infrastracture.Services; +using PackageCustum.Repositorys; +using PackageCustum.Services; +using PackageCustum.Models; + + +namespace PackageCusutm.Extentions +{ + /// + /// 実装しない。 カスタマイズ版で提供 + /// + public class Extention : IExtension + { + private IConfigurationRoot configurationRoot; + + public string Name + { + get + { + return "Extension PackageCusutm"; + } + } + + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); + + routeRegistrarsByPriorities.Add( + 2000, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension PackageCusutm", template: "{controller=Home}/{action=Index}/{id?}"); + } + ); + + return routeRegistrarsByPriorities; + } + } + + public int ConfigureServicesPriorities + { + get + { + return 2001; + } + } + public int ConfigurePriorities + { + get + { + return 2001; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + public void ConfigureServices(IServiceCollection services) + { + services.AddEntityFrameworkSqlite(); + services.AddDbContext(options => + { + options.UseSqlite(this.configurationRoot["Data:DefaultConnection:ConnectionString"]); + }); + services.AddScoped, ItemCustumService>(); + services.AddScoped, ItemCustumRepository>(); + } + + public void Configure(IApplicationBuilder applicationBuilder) + { + } + } +} \ No newline at end of file diff --git a/src/PackageCustum/PackageCusum.Extentions/PackageCusum.Extentions.csproj b/src/PackageCustum/PackageCusum.Extentions/PackageCusum.Extentions.csproj new file mode 100644 index 0000000..5e0bae8 --- /dev/null +++ b/src/PackageCustum/PackageCusum.Extentions/PackageCusum.Extentions.csproj @@ -0,0 +1,21 @@ + + + + netstandard1.6 + PackageCustum.Extentions + PackageCustum.Extentions + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + PackageCustum.Extentions + + + + + + + + + \ No newline at end of file diff --git a/src/WebApplication/Program.cs b/src/WebApplication/Program.cs index cdd8f35..e63cc46 100644 --- a/src/WebApplication/Program.cs +++ b/src/WebApplication/Program.cs @@ -3,21 +3,24 @@ using System.IO; using Microsoft.AspNetCore.Hosting; +using System.Reflection; +using System.Runtime.Loader; +using Microsoft.Extensions.DependencyModel; namespace WebApplication { - public class Program - { - public static void Main(string[] args) + public class Program { - var host = new WebHostBuilder() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseKestrel() - .UseIISIntegration() - .UseStartup() - .Build(); + public static void Main(string[] args) + { + var host = new WebHostBuilder() + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseKestrel() + .UseIISIntegration() + .UseStartup() + .Build(); - host.Run(); + host.Run(); + } } - } } \ No newline at end of file diff --git a/src/WebApplication/db.sqlite b/src/WebApplication/db.sqlite index c7bcbda7f1cabdd8abf6bb0151a8099d960bf58a..d7fd8eb1e66739bb53861ab4355a5018078c3607 100644 GIT binary patch literal 4096 zcmeH}&rZTH9LL-J7IaHEFWwqX5a6K1yVERYaSWUz$Y}$tM#CVmEyUxz_%OVHCm+CP z@BzG<$lY$hl#A@37i^QYzyA3({eFJ!+KY4JHlXBsH1WCtsUZX7=u~ z&Wa?(ZJUyas_##EctnCQLvSd}@be}Y-k+5~bQj%-J4(BaAF4sOH=zD_z=GMEjHW)F zI1@VTderHU2B9}}hIHy=A0(VunrdsrR*wyhxS1w)Nl}(u{mPYe)7DNkizZj-n1{($=}NYC$p$YS;^uzn2cfscz`zW|Fu*ub#~3K6`;3bhD8$5U%D~*tY`R&H831>n9_au8 diff --git a/src/WebApplication/gulpfile.js b/src/WebApplication/gulpfile.js index 2324bfa..436b9de 100644 --- a/src/WebApplication/gulpfile.js +++ b/src/WebApplication/gulpfile.js @@ -32,6 +32,8 @@ gulp.task( "copy-extensions-domainmodel", function (cb) { gulp.src(["../WebApplication.ExtensionA/bin/Release/netstandard1.6/WebApplication.ExtensionA.dll"]).pipe(gulp.dest("Extensions")); gulp.src(["../DomainModel/Extentions/bin/Debug/netstandard1.6/*"]).pipe(gulp.dest("Extensions")); + gulp.src(["../Package/Package.Extentions/bin/Debug/netstandard1.6/*"]).pipe(gulp.dest("Extensions")); + gulp.src(["../PackageCustum/PackageCusum.Extentions/bin/Debug/netstandard1.6/*"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.Swagger/bin/Debug/netstandard1.6/WebApplication.Swagger.dll"]).pipe(gulp.dest("Extensions")); cb(); } From a18368e5413f96bb8252644e0a848062764eaab7 Mon Sep 17 00:00:00 2001 From: USER001 F Date: Thu, 4 May 2017 00:39:20 +0900 Subject: [PATCH 18/18] Add Custom Packages --- WebApplication.sln | 48 ++++++++++ .../Package.Controllers/ItemsController.cs | 15 ++-- .../Package.Controllers.csproj | 1 + src/Package/Package.Extentions/Extention.cs | 4 +- .../IControllers.cs | 10 +++ .../Package.Infrastracture.Controllers.csproj | 7 ++ .../Package.Repositorys/ItemRepository.cs | 11 +-- .../ItemsController.cs | 48 ++++++++++ .../PackageDefaultCustom.Controllers.csproj | 22 +++++ .../Extention.cs | 87 +++++++++++++++++++ .../PackageDefaultCustom.Extentions.csproj | 22 +++++ .../PackageDefaultCustom.Models/Item.cs | 10 +++ .../Item2DbContext.cs | 14 +++ .../PackageDefaultCustom.Models.csproj | 19 ++++ .../ItemDefaultCustomRepository.cs | 41 +++++++++ .../PackageDefaultCustom.Repositorys.csproj | 21 +++++ .../ItemDefaultCustomService.cs | 43 +++++++++ .../PackageDefaultCustom.Services.csproj | 22 +++++ src/WebApplication/gulpfile.js | 7 +- 19 files changed, 435 insertions(+), 17 deletions(-) create mode 100644 src/Package/Package.Infrastracture.Controllers/IControllers.cs create mode 100644 src/Package/Package.Infrastracture.Controllers/Package.Infrastracture.Controllers.csproj create mode 100644 src/PackageDefaultCustom/PackageDefaultCustom.Controllers/ItemsController.cs create mode 100644 src/PackageDefaultCustom/PackageDefaultCustom.Controllers/PackageDefaultCustom.Controllers.csproj create mode 100644 src/PackageDefaultCustom/PackageDefaultCustom.Extentions/Extention.cs create mode 100644 src/PackageDefaultCustom/PackageDefaultCustom.Extentions/PackageDefaultCustom.Extentions.csproj create mode 100644 src/PackageDefaultCustom/PackageDefaultCustom.Models/Item.cs create mode 100644 src/PackageDefaultCustom/PackageDefaultCustom.Models/Item2DbContext.cs create mode 100644 src/PackageDefaultCustom/PackageDefaultCustom.Models/PackageDefaultCustom.Models.csproj create mode 100644 src/PackageDefaultCustom/PackageDefaultCustom.Repositorys/ItemDefaultCustomRepository.cs create mode 100644 src/PackageDefaultCustom/PackageDefaultCustom.Repositorys/PackageDefaultCustom.Repositorys.csproj create mode 100644 src/PackageDefaultCustom/PackageDefaultCustom.Services/ItemDefaultCustomService.cs create mode 100644 src/PackageDefaultCustom/PackageDefaultCustom.Services/PackageDefaultCustom.Services.csproj diff --git a/WebApplication.sln b/WebApplication.sln index d0bdead..bdb70c8 100644 --- a/WebApplication.sln +++ b/WebApplication.sln @@ -135,6 +135,23 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageCusum.Extentions", " {19F406F8-4E9A-4B56-84C6-3E26E22427C5} = {19F406F8-4E9A-4B56-84C6-3E26E22427C5} EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PackageDefaultCustom", "PackageDefaultCustom", "{A50DAFE1-CE3E-476A-A240-8252FCEC2D8F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageDefaultCustom.Controllers", "src\PackageDefaultCustom\PackageDefaultCustom.Controllers\PackageDefaultCustom.Controllers.csproj", "{E8B8A9F3-84F1-4031-9958-0462ACCFA8E7}" + ProjectSection(ProjectDependencies) = postProject + {633AB8A0-F6CB-4ECF-9AB0-E087B7DCBC2F} = {633AB8A0-F6CB-4ECF-9AB0-E087B7DCBC2F} + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageDefaultCustom.Extentions", "src\PackageDefaultCustom\PackageDefaultCustom.Extentions\PackageDefaultCustom.Extentions.csproj", "{3878E755-0389-4004-9E2B-DD01CC3660CB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageDefaultCustom.Models", "src\PackageDefaultCustom\PackageDefaultCustom.Models\PackageDefaultCustom.Models.csproj", "{78B4C680-84C8-4DE7-870B-213C8A29EC88}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageDefaultCustom.Repositorys", "src\PackageDefaultCustom\PackageDefaultCustom.Repositorys\PackageDefaultCustom.Repositorys.csproj", "{680BEEDD-716A-42D4-9743-6E17346F09FE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageDefaultCustom.Services", "src\PackageDefaultCustom\PackageDefaultCustom.Services\PackageDefaultCustom.Services.csproj", "{E9DE4910-4796-4906-AB72-63607448CFDA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Package.Infrastracture.Controllers", "src\Package\Package.Infrastracture.Controllers\Package.Infrastracture.Controllers.csproj", "{EE2900A8-DD6F-4FFB-9748-6FC0B2EA0F44}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -261,6 +278,30 @@ Global {2D12879E-225A-42D6-B8F9-EA02A596AE28}.Debug|Any CPU.Build.0 = Debug|Any CPU {2D12879E-225A-42D6-B8F9-EA02A596AE28}.Release|Any CPU.ActiveCfg = Release|Any CPU {2D12879E-225A-42D6-B8F9-EA02A596AE28}.Release|Any CPU.Build.0 = Release|Any CPU + {E8B8A9F3-84F1-4031-9958-0462ACCFA8E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E8B8A9F3-84F1-4031-9958-0462ACCFA8E7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E8B8A9F3-84F1-4031-9958-0462ACCFA8E7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E8B8A9F3-84F1-4031-9958-0462ACCFA8E7}.Release|Any CPU.Build.0 = Release|Any CPU + {3878E755-0389-4004-9E2B-DD01CC3660CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3878E755-0389-4004-9E2B-DD01CC3660CB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3878E755-0389-4004-9E2B-DD01CC3660CB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3878E755-0389-4004-9E2B-DD01CC3660CB}.Release|Any CPU.Build.0 = Release|Any CPU + {78B4C680-84C8-4DE7-870B-213C8A29EC88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78B4C680-84C8-4DE7-870B-213C8A29EC88}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78B4C680-84C8-4DE7-870B-213C8A29EC88}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78B4C680-84C8-4DE7-870B-213C8A29EC88}.Release|Any CPU.Build.0 = Release|Any CPU + {680BEEDD-716A-42D4-9743-6E17346F09FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {680BEEDD-716A-42D4-9743-6E17346F09FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {680BEEDD-716A-42D4-9743-6E17346F09FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {680BEEDD-716A-42D4-9743-6E17346F09FE}.Release|Any CPU.Build.0 = Release|Any CPU + {E9DE4910-4796-4906-AB72-63607448CFDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E9DE4910-4796-4906-AB72-63607448CFDA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E9DE4910-4796-4906-AB72-63607448CFDA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E9DE4910-4796-4906-AB72-63607448CFDA}.Release|Any CPU.Build.0 = Release|Any CPU + {EE2900A8-DD6F-4FFB-9748-6FC0B2EA0F44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE2900A8-DD6F-4FFB-9748-6FC0B2EA0F44}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE2900A8-DD6F-4FFB-9748-6FC0B2EA0F44}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE2900A8-DD6F-4FFB-9748-6FC0B2EA0F44}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -307,5 +348,12 @@ Global {8FD1C854-9C2D-49A9-9BD4-07DBF59F95A9} = {4F4FE0B9-BADD-456C-A970-799F85FB7AC9} {49616BDF-FD9B-4B58-AAC3-162B56F2EB66} = {4F4FE0B9-BADD-456C-A970-799F85FB7AC9} {2D12879E-225A-42D6-B8F9-EA02A596AE28} = {4F4FE0B9-BADD-456C-A970-799F85FB7AC9} + {A50DAFE1-CE3E-476A-A240-8252FCEC2D8F} = {0D7AEFA3-ABB0-4AF1-A4C1-F8E05C241753} + {E8B8A9F3-84F1-4031-9958-0462ACCFA8E7} = {A50DAFE1-CE3E-476A-A240-8252FCEC2D8F} + {3878E755-0389-4004-9E2B-DD01CC3660CB} = {A50DAFE1-CE3E-476A-A240-8252FCEC2D8F} + {78B4C680-84C8-4DE7-870B-213C8A29EC88} = {A50DAFE1-CE3E-476A-A240-8252FCEC2D8F} + {680BEEDD-716A-42D4-9743-6E17346F09FE} = {A50DAFE1-CE3E-476A-A240-8252FCEC2D8F} + {E9DE4910-4796-4906-AB72-63607448CFDA} = {A50DAFE1-CE3E-476A-A240-8252FCEC2D8F} + {EE2900A8-DD6F-4FFB-9748-6FC0B2EA0F44} = {51171CE2-9F5D-4DF3-B3A8-0CAB3AB537F6} EndGlobalSection EndGlobal diff --git a/src/Package/Package.Controllers/ItemsController.cs b/src/Package/Package.Controllers/ItemsController.cs index 947d31e..43963c8 100644 --- a/src/Package/Package.Controllers/ItemsController.cs +++ b/src/Package/Package.Controllers/ItemsController.cs @@ -1,41 +1,40 @@ using System; using Microsoft.AspNetCore.Mvc; +using Package.Infrastracture.Controllers; using Package.Infrastracture.Services; using Package.Models; namespace Package.Controllers { - [Route("api/package/[controller]")] - public class ItemsController : Controller + public class ItemsController : ControllerBase { - private IService _itemService { get; set; } + protected IService _itemService { get; set; } public ItemsController(IService itemService) { _itemService = itemService; } - [HttpGet] public virtual IActionResult Get() { return Ok(_itemService.All()); } - [HttpGet("{id}")] + public virtual IActionResult Get(long id) { return Ok(_itemService.Find(id)); } - [HttpPost] + public virtual void Post([FromBody]Item value) { _itemService.Add(value); } - [HttpPut("{id}")] + public virtual void Put(long id, [FromBody]Item value) { _itemService.Update(id, value); } - [HttpDelete("{id}")] + public virtual void Delete(long id) { _itemService.Delete(id); diff --git a/src/Package/Package.Controllers/Package.Controllers.csproj b/src/Package/Package.Controllers/Package.Controllers.csproj index 18ba33c..ad61810 100644 --- a/src/Package/Package.Controllers/Package.Controllers.csproj +++ b/src/Package/Package.Controllers/Package.Controllers.csproj @@ -13,6 +13,7 @@ + diff --git a/src/Package/Package.Extentions/Extention.cs b/src/Package/Package.Extentions/Extention.cs index 6465a24..9404bd6 100644 --- a/src/Package/Package.Extentions/Extention.cs +++ b/src/Package/Package.Extentions/Extention.cs @@ -1,7 +1,9 @@ namespace Package.Extentions { /// - /// 実装しない。 カスタマイズ版で提供 + /// 本体 + /// プラグインの接続ポイントはここでは実装しない。 + /// カスタマイズ版で提供 /// public class Extention { diff --git a/src/Package/Package.Infrastracture.Controllers/IControllers.cs b/src/Package/Package.Infrastracture.Controllers/IControllers.cs new file mode 100644 index 0000000..d57df9c --- /dev/null +++ b/src/Package/Package.Infrastracture.Controllers/IControllers.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Package.Infrastracture.Controllers +{ + public interface IControllers + { + } +} diff --git a/src/Package/Package.Infrastracture.Controllers/Package.Infrastracture.Controllers.csproj b/src/Package/Package.Infrastracture.Controllers/Package.Infrastracture.Controllers.csproj new file mode 100644 index 0000000..954020d --- /dev/null +++ b/src/Package/Package.Infrastracture.Controllers/Package.Infrastracture.Controllers.csproj @@ -0,0 +1,7 @@ + + + + netstandard1.4 + + + \ No newline at end of file diff --git a/src/Package/Package.Repositorys/ItemRepository.cs b/src/Package/Package.Repositorys/ItemRepository.cs index 5547216..abe11ed 100644 --- a/src/Package/Package.Repositorys/ItemRepository.cs +++ b/src/Package/Package.Repositorys/ItemRepository.cs @@ -10,31 +10,32 @@ namespace Package.Repositorys public class ItemRepository : IRepository { private ItemDbContext _itemDbContext { get; set; } + public ItemRepository(ItemDbContext itemDbContext) { _itemDbContext = itemDbContext; } - public virtual IEnumerable All() + public IEnumerable All() { return _itemDbContext.Items.OrderBy(i => i.Name); } - public virtual Item Find(long id) + public Item Find(long id) { return _itemDbContext.Items.Where(i => i.Id == id).First(); } - public virtual void Add(Item value) + public void Add(Item value) { _itemDbContext.Items.Add(value); _itemDbContext.SaveChanges(); return; } - public virtual void Update(long id, Item value) + public void Update(long id, Item value) { _itemDbContext.Items.Update(value); _itemDbContext.SaveChanges(); return; } - public virtual void Delete(long id) + public void Delete(long id) { var value = _itemDbContext.Items.Where(i => i.Id == id).First(); _itemDbContext.Items.Remove(value); diff --git a/src/PackageDefaultCustom/PackageDefaultCustom.Controllers/ItemsController.cs b/src/PackageDefaultCustom/PackageDefaultCustom.Controllers/ItemsController.cs new file mode 100644 index 0000000..d1efcb4 --- /dev/null +++ b/src/PackageDefaultCustom/PackageDefaultCustom.Controllers/ItemsController.cs @@ -0,0 +1,48 @@ + +namespace PackageDefaultCustom.Controllers +{ + using System; + using Microsoft.AspNetCore.Mvc; + using Package.Controllers; + using Package.Infrastracture.Services; + + using Item = Package.Models.Item; + + [Route("api/package/[controller]")] + public class ItemsController : Package.Controllers.ItemsController + { + public ItemsController(IService itemService) : base(itemService) + { + } + + [HttpGet] + public override IActionResult Get() + { + return base.Get(); + } + + [HttpGet("{id}")] + public override IActionResult Get(long id) + { + return base.Get(id); + } + + [HttpPost] + public override void Post([FromBody]Item value) + { + base.Post(value); + } + + [HttpPut("{id}")] + public override void Put(long id, [FromBody]Item value) + { + base.Put(id, value); + } + + [HttpDelete("{id}")] + public override void Delete(long id) + { + base.Delete(id); + } + } +} \ No newline at end of file diff --git a/src/PackageDefaultCustom/PackageDefaultCustom.Controllers/PackageDefaultCustom.Controllers.csproj b/src/PackageDefaultCustom/PackageDefaultCustom.Controllers/PackageDefaultCustom.Controllers.csproj new file mode 100644 index 0000000..51e1ce8 --- /dev/null +++ b/src/PackageDefaultCustom/PackageDefaultCustom.Controllers/PackageDefaultCustom.Controllers.csproj @@ -0,0 +1,22 @@ + + + + netstandard1.6 + PackageDefaultCustom.Controllers + PackageDefaultCustom.Controllers + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + PackageDefaultCustom.Controllers + + + + + + + + + + \ No newline at end of file diff --git a/src/PackageDefaultCustom/PackageDefaultCustom.Extentions/Extention.cs b/src/PackageDefaultCustom/PackageDefaultCustom.Extentions/Extention.cs new file mode 100644 index 0000000..971012e --- /dev/null +++ b/src/PackageDefaultCustom/PackageDefaultCustom.Extentions/Extention.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ExtCore.Infrastructure; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.EntityFrameworkCore; +using Package.Infrastracture.Repositorys; +using Package.Infrastracture.Services; +using PackageDefaultCustom.Repositorys; +using PackageDefaultCustom.Services; +using Package.Models; + + +namespace PackageDefaultCustom.Extentions +{ + /// + /// デフォルトカスタマイズ版(ここの実装が標準) + /// + public class Extention : IExtension + { + private IConfigurationRoot configurationRoot; + + public string Name + { + get + { + return "Extension PackageDefaultCustom"; + } + } + + public IDictionary> RouteRegistrarsByPriorities + { + get + { + Dictionary> routeRegistrarsByPriorities = new Dictionary>(); + + routeRegistrarsByPriorities.Add( + 2000, + routeBuilder => + { + routeBuilder.MapRoute(name: "Extension PackageDefaultCustom", template: "{controller=Home}/{action=Index}/{id?}"); + } + ); + + return routeRegistrarsByPriorities; + } + } + + public int ConfigureServicesPriorities + { + get + { + return 2001; + } + } + public int ConfigurePriorities + { + get + { + return 2001; + } + } + public void SetConfigurationRoot(IConfigurationRoot configurationRoot) + { + this.configurationRoot = configurationRoot; + } + + public void ConfigureServices(IServiceCollection services) + { + services.AddEntityFrameworkSqlite(); + services.AddDbContext(options => + { + options.UseSqlite(this.configurationRoot["Data:DefaultConnection:ConnectionString"]); + }); + services.AddScoped, ItemDefaultCustomService>(); + services.AddScoped, ItemDefaultCustomRepository>(); + } + + public void Configure(IApplicationBuilder applicationBuilder) + { + } + } +} \ No newline at end of file diff --git a/src/PackageDefaultCustom/PackageDefaultCustom.Extentions/PackageDefaultCustom.Extentions.csproj b/src/PackageDefaultCustom/PackageDefaultCustom.Extentions/PackageDefaultCustom.Extentions.csproj new file mode 100644 index 0000000..b122758 --- /dev/null +++ b/src/PackageDefaultCustom/PackageDefaultCustom.Extentions/PackageDefaultCustom.Extentions.csproj @@ -0,0 +1,22 @@ + + + + netstandard1.6 + PackageDefaultCustom.Extentions + PackageDefaultCustom.Extentions + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + PackageDefaultCustom.Extentions + + + + + + + + + + \ No newline at end of file diff --git a/src/PackageDefaultCustom/PackageDefaultCustom.Models/Item.cs b/src/PackageDefaultCustom/PackageDefaultCustom.Models/Item.cs new file mode 100644 index 0000000..f4ec77f --- /dev/null +++ b/src/PackageDefaultCustom/PackageDefaultCustom.Models/Item.cs @@ -0,0 +1,10 @@ +using System; +using Package.Models; + +namespace PackageDefaultCustom.Models +{ + public class Item : Package.Models.Item + { + public string custum { get; set; } + } +} diff --git a/src/PackageDefaultCustom/PackageDefaultCustom.Models/Item2DbContext.cs b/src/PackageDefaultCustom/PackageDefaultCustom.Models/Item2DbContext.cs new file mode 100644 index 0000000..43441db --- /dev/null +++ b/src/PackageDefaultCustom/PackageDefaultCustom.Models/Item2DbContext.cs @@ -0,0 +1,14 @@ +// Copyright © 2015 Dmitry Sikorsky. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.EntityFrameworkCore; + +namespace PackageDefaultCustom.Models +{ + public class Item2DbContext : DbContext + { + public Item2DbContext(DbContextOptions options) :base(options) + { } + public DbSet Items { get; set; } + } +} \ No newline at end of file diff --git a/src/PackageDefaultCustom/PackageDefaultCustom.Models/PackageDefaultCustom.Models.csproj b/src/PackageDefaultCustom/PackageDefaultCustom.Models/PackageDefaultCustom.Models.csproj new file mode 100644 index 0000000..8b556e9 --- /dev/null +++ b/src/PackageDefaultCustom/PackageDefaultCustom.Models/PackageDefaultCustom.Models.csproj @@ -0,0 +1,19 @@ + + + + netstandard1.6 + PackageDefaultCustom.Models + PackageDefaultCustom.Models + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + PackageDefaultCustom.Models + + + + + + + \ No newline at end of file diff --git a/src/PackageDefaultCustom/PackageDefaultCustom.Repositorys/ItemDefaultCustomRepository.cs b/src/PackageDefaultCustom/PackageDefaultCustom.Repositorys/ItemDefaultCustomRepository.cs new file mode 100644 index 0000000..640e2de --- /dev/null +++ b/src/PackageDefaultCustom/PackageDefaultCustom.Repositorys/ItemDefaultCustomRepository.cs @@ -0,0 +1,41 @@ +namespace PackageDefaultCustom.Repositorys +{ + using System; + using System.Collections.Generic; + using System.Linq; + using Package.Models; + using Package.Repositorys; + using Package.Infrastracture.Repositorys; + + public class ItemDefaultCustomRepository : IRepository + { + private IRepository _itemRepository { get; set; } + public ItemDefaultCustomRepository(ItemRepository itemRepository) + { + _itemRepository = itemRepository; + } + public IEnumerable All() + { + return _itemRepository.All(); + } + public Item Find(long id) + { + return _itemRepository.Find(id); + } + public void Add(Item value) + { + _itemRepository.Add(value); + return; + } + public void Update(long id, Item value) + { + _itemRepository.Update(id, value); + return; + } + public void Delete(long id) + { + _itemRepository.Delete(id); + return; + } + } +} \ No newline at end of file diff --git a/src/PackageDefaultCustom/PackageDefaultCustom.Repositorys/PackageDefaultCustom.Repositorys.csproj b/src/PackageDefaultCustom/PackageDefaultCustom.Repositorys/PackageDefaultCustom.Repositorys.csproj new file mode 100644 index 0000000..a87df85 --- /dev/null +++ b/src/PackageDefaultCustom/PackageDefaultCustom.Repositorys/PackageDefaultCustom.Repositorys.csproj @@ -0,0 +1,21 @@ + + + + netstandard1.6 + PackageDefaultCustom.Repositorys + PackageDefaultCustom.Repositorys + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + PackageDefaultCustom.Repositorys + + + + + + + + + \ No newline at end of file diff --git a/src/PackageDefaultCustom/PackageDefaultCustom.Services/ItemDefaultCustomService.cs b/src/PackageDefaultCustom/PackageDefaultCustom.Services/ItemDefaultCustomService.cs new file mode 100644 index 0000000..713a4f9 --- /dev/null +++ b/src/PackageDefaultCustom/PackageDefaultCustom.Services/ItemDefaultCustomService.cs @@ -0,0 +1,43 @@ +using System; +using Package.Models; +using Package.Infrastracture.Services; +using Package.Infrastracture.Repositorys; +using System.Collections.Generic; + +namespace PackageDefaultCustom.Services +{ + public class ItemDefaultCustomService : IService + { + private IService _itemService { get; set; } + + public ItemDefaultCustomService(IService itemService) + { + _itemService = itemService; + } + + public IEnumerable All() + { + return _itemService.All(); + } + + public Item Find(long id) + { + return _itemService.Find(id); + } + + public void Add(Item value) + { + _itemService.Add(value); + } + + public void Update(long id, Item value) + { + _itemService.Update(id, value); + } + + public void Delete(long id) + { + _itemService.Delete(id); + } + } +} \ No newline at end of file diff --git a/src/PackageDefaultCustom/PackageDefaultCustom.Services/PackageDefaultCustom.Services.csproj b/src/PackageDefaultCustom/PackageDefaultCustom.Services/PackageDefaultCustom.Services.csproj new file mode 100644 index 0000000..79f54c8 --- /dev/null +++ b/src/PackageDefaultCustom/PackageDefaultCustom.Services/PackageDefaultCustom.Services.csproj @@ -0,0 +1,22 @@ + + + + netstandard1.6 + PackageDefaultCustom.Services + PackageDefaultCustom.Services + 1.6.0 + $(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8 + false + false + false + PackageDefaultCustom.Services + + + + + + + + + + \ No newline at end of file diff --git a/src/WebApplication/gulpfile.js b/src/WebApplication/gulpfile.js index 436b9de..714d448 100644 --- a/src/WebApplication/gulpfile.js +++ b/src/WebApplication/gulpfile.js @@ -31,9 +31,10 @@ gulp.task( gulp.task( "copy-extensions-domainmodel", function (cb) { gulp.src(["../WebApplication.ExtensionA/bin/Release/netstandard1.6/WebApplication.ExtensionA.dll"]).pipe(gulp.dest("Extensions")); - gulp.src(["../DomainModel/Extentions/bin/Debug/netstandard1.6/*"]).pipe(gulp.dest("Extensions")); - gulp.src(["../Package/Package.Extentions/bin/Debug/netstandard1.6/*"]).pipe(gulp.dest("Extensions")); - gulp.src(["../PackageCustum/PackageCusum.Extentions/bin/Debug/netstandard1.6/*"]).pipe(gulp.dest("Extensions")); +// gulp.src(["../DomainModel/Extentions/bin/Debug/netstandard1.6/*"]).pipe(gulp.dest("Extensions")); +// gulp.src(["../Package/Package.Extentions/bin/Debug/netstandard1.6/*"]).pipe(gulp.dest("Extensions")); +// gulp.src(["../PackageCustum/PackageCusum.Extentions/bin/Debug/netstandard1.6/*"]).pipe(gulp.dest("Extensions")); + gulp.src(["../PackageDefaultCustom/PackageDefaultCustom.Extentions/bin/Debug/netstandard1.6/*"]).pipe(gulp.dest("Extensions")); gulp.src(["../WebApplication.Swagger/bin/Debug/netstandard1.6/WebApplication.Swagger.dll"]).pipe(gulp.dest("Extensions")); cb(); }