From 4a69b3da179330897a37d7f4177825ee19f5acb2 Mon Sep 17 00:00:00 2001 From: Petrutiu Mihai Date: Tue, 28 Jun 2016 11:35:15 +0300 Subject: [PATCH] Update to .net core --- BehavioralPatterns.sln | 16 ++++++++-------- src/BehavioralPatterns/BehavioralPatterns.xproj | 2 +- src/BehavioralPatterns/Program.cs | 9 ++++----- .../Properties/AssemblyInfo.cs | 2 +- src/BehavioralPatterns/project.json | 9 +++------ .../RunChainOfResponsibillityExamples.cs | 4 ++-- .../Validators/UserEntities/UserProcessor.cs | 10 +++++----- src/ChainOfResponssibility/project.json | 4 ++-- src/CommandPattern/project.json | 7 ++----- src/IteratorPattern/project.json | 4 ++-- src/MediatorPattern/project.json | 4 ++-- src/MememntoPattern/project.json | 4 ++-- src/ObserverPattern/project.json | 4 ++-- 13 files changed, 36 insertions(+), 43 deletions(-) diff --git a/BehavioralPatterns.sln b/BehavioralPatterns.sln index fb6253c..ddeddba 100644 --- a/BehavioralPatterns.sln +++ b/BehavioralPatterns.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3820200F-354C-41E6-8F34-B301F5D621C2}" EndProject @@ -10,8 +10,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution global.json = global.json EndProjectSection EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "BehavioralPatterns", "src\BehavioralPatterns\BehavioralPatterns.xproj", "{E3092EE0-1282-4AB4-9FA2-0338348D8FD1}" -EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ChainOfResponssibility", "src\ChainOfResponssibility\ChainOfResponssibility.xproj", "{89536824-683F-4351-8789-406D7BDD922D}" EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "CommandPattern", "src\CommandPattern\CommandPattern.xproj", "{454B2A43-8251-4667-8DE3-67E489908DB9}" @@ -24,16 +22,14 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "MememntoPattern", "src\Meme EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ObserverPattern", "src\ObserverPattern\ObserverPattern.xproj", "{D48DB558-0228-4ACE-88A8-A202E5C57849}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "BehavioralPatterns", "src\BehavioralPatterns\BehavioralPatterns.xproj", "{7843B0F8-7530-4859-8BEE-43D370E0F0AA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E3092EE0-1282-4AB4-9FA2-0338348D8FD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E3092EE0-1282-4AB4-9FA2-0338348D8FD1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E3092EE0-1282-4AB4-9FA2-0338348D8FD1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E3092EE0-1282-4AB4-9FA2-0338348D8FD1}.Release|Any CPU.Build.0 = Release|Any CPU {89536824-683F-4351-8789-406D7BDD922D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {89536824-683F-4351-8789-406D7BDD922D}.Debug|Any CPU.Build.0 = Debug|Any CPU {89536824-683F-4351-8789-406D7BDD922D}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -58,17 +54,21 @@ Global {D48DB558-0228-4ACE-88A8-A202E5C57849}.Debug|Any CPU.Build.0 = Debug|Any CPU {D48DB558-0228-4ACE-88A8-A202E5C57849}.Release|Any CPU.ActiveCfg = Release|Any CPU {D48DB558-0228-4ACE-88A8-A202E5C57849}.Release|Any CPU.Build.0 = Release|Any CPU + {7843B0F8-7530-4859-8BEE-43D370E0F0AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7843B0F8-7530-4859-8BEE-43D370E0F0AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7843B0F8-7530-4859-8BEE-43D370E0F0AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7843B0F8-7530-4859-8BEE-43D370E0F0AA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {E3092EE0-1282-4AB4-9FA2-0338348D8FD1} = {3820200F-354C-41E6-8F34-B301F5D621C2} {89536824-683F-4351-8789-406D7BDD922D} = {3820200F-354C-41E6-8F34-B301F5D621C2} {454B2A43-8251-4667-8DE3-67E489908DB9} = {3820200F-354C-41E6-8F34-B301F5D621C2} {6F3B7F9A-4D9C-4506-A5F7-3FF5CF4376BD} = {3820200F-354C-41E6-8F34-B301F5D621C2} {2A63BD0A-9D07-4755-9B16-5DDBEB075B80} = {3820200F-354C-41E6-8F34-B301F5D621C2} {1DE3FDD3-D025-49D8-BEF4-D5F0688F89E8} = {3820200F-354C-41E6-8F34-B301F5D621C2} {D48DB558-0228-4ACE-88A8-A202E5C57849} = {3820200F-354C-41E6-8F34-B301F5D621C2} + {7843B0F8-7530-4859-8BEE-43D370E0F0AA} = {3820200F-354C-41E6-8F34-B301F5D621C2} EndGlobalSection EndGlobal diff --git a/src/BehavioralPatterns/BehavioralPatterns.xproj b/src/BehavioralPatterns/BehavioralPatterns.xproj index 7cf4f9e..cbaf38a 100644 --- a/src/BehavioralPatterns/BehavioralPatterns.xproj +++ b/src/BehavioralPatterns/BehavioralPatterns.xproj @@ -7,7 +7,7 @@ - e3092ee0-1282-4ab4-9fa2-0338348d8fd1 + 7843b0f8-7530-4859-8bee-43d370e0f0aa BehavioralPatterns .\obj .\bin\ diff --git a/src/BehavioralPatterns/Program.cs b/src/BehavioralPatterns/Program.cs index dae27ea..292b292 100644 --- a/src/BehavioralPatterns/Program.cs +++ b/src/BehavioralPatterns/Program.cs @@ -1,5 +1,4 @@ using ChainOfResponssibility; -using ChainOfResponssibility.PurchaseExample; using CommandPattern; using IteratorPattern; using MediatorPattern; @@ -7,7 +6,6 @@ using MememntoPattern; using ObserverPattern; using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Threading.Tasks; @@ -17,9 +15,6 @@ namespace BehavioralPatterns { public static void Main(string[] args) { - - ObserverPatternExamples.Run(); - Console.ReadKey(); //Chain of responsibillity //This is usefull when you have a request and you don't know who should process it ChainOfResponsibillityExamples.Run(); @@ -42,6 +37,10 @@ namespace BehavioralPatterns Console.ReadKey(); MementoPatternExamples.Run(); + + + ObserverPatternExamples.Run(); + Console.ReadKey(); } } } diff --git a/src/BehavioralPatterns/Properties/AssemblyInfo.cs b/src/BehavioralPatterns/Properties/AssemblyInfo.cs index 42755e8..163a2da 100644 --- a/src/BehavioralPatterns/Properties/AssemblyInfo.cs +++ b/src/BehavioralPatterns/Properties/AssemblyInfo.cs @@ -16,4 +16,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("e3092ee0-1282-4ab4-9fa2-0338348d8fd1")] +[assembly: Guid("7843b0f8-7530-4859-8bee-43d370e0f0aa")] diff --git a/src/BehavioralPatterns/project.json b/src/BehavioralPatterns/project.json index 3165efd..8444dae 100644 --- a/src/BehavioralPatterns/project.json +++ b/src/BehavioralPatterns/project.json @@ -1,10 +1,7 @@ -{ +{ "version": "1.0.0-*", "buildOptions": { - "emitEntryPoint": true, - "copyToOutput": { - "include": "../IteratorPattern/FileExample/SampleFiles/**" - } + "emitEntryPoint": true }, "dependencies": { @@ -15,7 +12,7 @@ "MememntoPattern": "1.0.0-*", "Microsoft.NETCore.App": { "type": "platform", - "version": "1.0.0-rc2-3002702" + "version": "1.0.0" }, "ObserverPattern": "1.0.0-*" }, diff --git a/src/ChainOfResponssibility/RunChainOfResponsibillityExamples.cs b/src/ChainOfResponssibility/RunChainOfResponsibillityExamples.cs index b8a728e..97283f4 100644 --- a/src/ChainOfResponssibility/RunChainOfResponsibillityExamples.cs +++ b/src/ChainOfResponssibility/RunChainOfResponsibillityExamples.cs @@ -55,9 +55,9 @@ Decouples sender and receiver (as a sender you don't know who will handle the re Hierarchical in nature When using the Chain of Responsibility is more effective: More than one object can handle a command -The handler is not known in advance +The handler is not known in advances The handler should be determined automatically -It’s wished that the request is addressed to a group of objects without explicitly specifying its receiver +It's wished that the request is addressed to a group of objects without explicitly specifying its receiver The group of objects that may handle the command must be specified in a dynamic way. Examples in real life: -java.util.logging.Logger.#log() diff --git a/src/ChainOfResponssibility/Validators/UserEntities/UserProcessor.cs b/src/ChainOfResponssibility/Validators/UserEntities/UserProcessor.cs index 70129a6..10269f1 100644 --- a/src/ChainOfResponssibility/Validators/UserEntities/UserProcessor.cs +++ b/src/ChainOfResponssibility/Validators/UserEntities/UserProcessor.cs @@ -9,15 +9,15 @@ namespace ChainOfResponssibility.Validators.UserEntities { UserRepository userRepository; PrincipalHelper principalHelper; - Operation operation; + Operation inputOperation; ChainValidation userCreationValidation; ChainValidation authenticateUserValidation; public UserProcessor() { userRepository = new UserRepository(); principalHelper = new PrincipalHelper(); - operation = new AuthenticateOperation(AuthenticateUser); - operation.SetSuccessor(new CreateNewUserOperation(CreateNewUser)); + inputOperation = new AuthenticateOperation(AuthenticateUser); + inputOperation.SetSuccessor(new CreateNewUserOperation(CreateNewUser)); userCreationValidation = new IsAuthorisedToDoOperationsOnUser(principalHelper, Rights.Create); userCreationValidation.SetSuccessor(new ValidateNoDuplicateEmail(userRepository)); @@ -55,12 +55,12 @@ namespace ChainOfResponssibility.Validators.UserEntities string userInput; do { - operation.PrintMenu(); + inputOperation.PrintMenu(); Console.Write(">"); userInput = Console.ReadLine(); if (!IsExitCode(userInput)) - operation.Execute(userInput); + inputOperation.Execute(userInput); } while (!IsExitCode(userInput)); } diff --git a/src/ChainOfResponssibility/project.json b/src/ChainOfResponssibility/project.json index ed8608d..b5b5a5c 100644 --- a/src/ChainOfResponssibility/project.json +++ b/src/ChainOfResponssibility/project.json @@ -1,8 +1,8 @@ -{ +{ "version": "1.0.0-*", "dependencies": { - "NETStandard.Library": "1.5.0-rc2-24027" + "NETStandard.Library": "1.6.0" }, "frameworks": { diff --git a/src/CommandPattern/project.json b/src/CommandPattern/project.json index c4ee639..9954282 100644 --- a/src/CommandPattern/project.json +++ b/src/CommandPattern/project.json @@ -1,11 +1,8 @@ -{ +{ "version": "1.0.0-*", "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0-rc2-3002702" - } + "Microsoft.NETCore.App": "1.0.0" }, "frameworks": { diff --git a/src/IteratorPattern/project.json b/src/IteratorPattern/project.json index 8f8aaaf..afdcb09 100644 --- a/src/IteratorPattern/project.json +++ b/src/IteratorPattern/project.json @@ -1,8 +1,8 @@ -{ +{ "version": "1.0.0-*", "dependencies": { - "NETStandard.Library": "1.5.0-rc2-24027" + "NETStandard.Library": "1.6.0" }, "frameworks": { diff --git a/src/MediatorPattern/project.json b/src/MediatorPattern/project.json index ed8608d..b5b5a5c 100644 --- a/src/MediatorPattern/project.json +++ b/src/MediatorPattern/project.json @@ -1,8 +1,8 @@ -{ +{ "version": "1.0.0-*", "dependencies": { - "NETStandard.Library": "1.5.0-rc2-24027" + "NETStandard.Library": "1.6.0" }, "frameworks": { diff --git a/src/MememntoPattern/project.json b/src/MememntoPattern/project.json index 6a306c8..c0062b2 100644 --- a/src/MememntoPattern/project.json +++ b/src/MememntoPattern/project.json @@ -3,8 +3,8 @@ "dependencies": { "NETStandard.Library": "1.5.0-rc2-24027", - "Newtonsoft.Json": "8.0.3", - "System.Runtime.Serialization.Primitives": "4.0.10-*" + "Newtonsoft.Json": "9.0.1", + "System.Runtime.Serialization.Primitives": "4.1.1" }, "frameworks": { diff --git a/src/ObserverPattern/project.json b/src/ObserverPattern/project.json index ed8608d..b5b5a5c 100644 --- a/src/ObserverPattern/project.json +++ b/src/ObserverPattern/project.json @@ -1,8 +1,8 @@ -{ +{ "version": "1.0.0-*", "dependencies": { - "NETStandard.Library": "1.5.0-rc2-24027" + "NETStandard.Library": "1.6.0" }, "frameworks": {