Update to .net core

This commit is contained in:
Petrutiu Mihai
2016-06-28 11:35:15 +03:00
parent d47e43aaa5
commit 4a69b3da17
13 changed files with 36 additions and 43 deletions

View File

@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14 # Visual Studio 14
VisualStudioVersion = 14.0.25123.0 VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3820200F-354C-41E6-8F34-B301F5D621C2}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3820200F-354C-41E6-8F34-B301F5D621C2}"
EndProject EndProject
@@ -10,8 +10,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
global.json = global.json global.json = global.json
EndProjectSection EndProjectSection
EndProject 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}" Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ChainOfResponssibility", "src\ChainOfResponssibility\ChainOfResponssibility.xproj", "{89536824-683F-4351-8789-406D7BDD922D}"
EndProject EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "CommandPattern", "src\CommandPattern\CommandPattern.xproj", "{454B2A43-8251-4667-8DE3-67E489908DB9}" 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 EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ObserverPattern", "src\ObserverPattern\ObserverPattern.xproj", "{D48DB558-0228-4ACE-88A8-A202E5C57849}" Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ObserverPattern", "src\ObserverPattern\ObserverPattern.xproj", "{D48DB558-0228-4ACE-88A8-A202E5C57849}"
EndProject EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "BehavioralPatterns", "src\BehavioralPatterns\BehavioralPatterns.xproj", "{7843B0F8-7530-4859-8BEE-43D370E0F0AA}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution 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.ActiveCfg = Debug|Any CPU
{89536824-683F-4351-8789-406D7BDD922D}.Debug|Any CPU.Build.0 = 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 {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}.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.ActiveCfg = Release|Any CPU
{D48DB558-0228-4ACE-88A8-A202E5C57849}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{E3092EE0-1282-4AB4-9FA2-0338348D8FD1} = {3820200F-354C-41E6-8F34-B301F5D621C2}
{89536824-683F-4351-8789-406D7BDD922D} = {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} {454B2A43-8251-4667-8DE3-67E489908DB9} = {3820200F-354C-41E6-8F34-B301F5D621C2}
{6F3B7F9A-4D9C-4506-A5F7-3FF5CF4376BD} = {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} {2A63BD0A-9D07-4755-9B16-5DDBEB075B80} = {3820200F-354C-41E6-8F34-B301F5D621C2}
{1DE3FDD3-D025-49D8-BEF4-D5F0688F89E8} = {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} {D48DB558-0228-4ACE-88A8-A202E5C57849} = {3820200F-354C-41E6-8F34-B301F5D621C2}
{7843B0F8-7530-4859-8BEE-43D370E0F0AA} = {3820200F-354C-41E6-8F34-B301F5D621C2}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@@ -7,7 +7,7 @@
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>e3092ee0-1282-4ab4-9fa2-0338348d8fd1</ProjectGuid> <ProjectGuid>7843b0f8-7530-4859-8bee-43d370e0f0aa</ProjectGuid>
<RootNamespace>BehavioralPatterns</RootNamespace> <RootNamespace>BehavioralPatterns</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath> <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath> <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>

View File

@@ -1,5 +1,4 @@
using ChainOfResponssibility; using ChainOfResponssibility;
using ChainOfResponssibility.PurchaseExample;
using CommandPattern; using CommandPattern;
using IteratorPattern; using IteratorPattern;
using MediatorPattern; using MediatorPattern;
@@ -7,7 +6,6 @@ using MememntoPattern;
using ObserverPattern; using ObserverPattern;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -17,9 +15,6 @@ namespace BehavioralPatterns
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
ObserverPatternExamples.Run();
Console.ReadKey();
//Chain of responsibillity //Chain of responsibillity
//This is usefull when you have a request and you don't know who should process it //This is usefull when you have a request and you don't know who should process it
ChainOfResponsibillityExamples.Run(); ChainOfResponsibillityExamples.Run();
@@ -42,6 +37,10 @@ namespace BehavioralPatterns
Console.ReadKey(); Console.ReadKey();
MementoPatternExamples.Run(); MementoPatternExamples.Run();
ObserverPatternExamples.Run();
Console.ReadKey();
} }
} }
} }

View File

@@ -16,4 +16,4 @@ using System.Runtime.InteropServices;
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // 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")]

View File

@@ -1,10 +1,7 @@
{ {
"version": "1.0.0-*", "version": "1.0.0-*",
"buildOptions": { "buildOptions": {
"emitEntryPoint": true, "emitEntryPoint": true
"copyToOutput": {
"include": "../IteratorPattern/FileExample/SampleFiles/**"
}
}, },
"dependencies": { "dependencies": {
@@ -15,7 +12,7 @@
"MememntoPattern": "1.0.0-*", "MememntoPattern": "1.0.0-*",
"Microsoft.NETCore.App": { "Microsoft.NETCore.App": {
"type": "platform", "type": "platform",
"version": "1.0.0-rc2-3002702" "version": "1.0.0"
}, },
"ObserverPattern": "1.0.0-*" "ObserverPattern": "1.0.0-*"
}, },

View File

@@ -55,9 +55,9 @@ Decouples sender and receiver (as a sender you don't know who will handle the re
Hierarchical in nature Hierarchical in nature
When using the Chain of Responsibility is more effective: When using the Chain of Responsibility is more effective:
More than one object can handle a command 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 The handler should be determined automatically
Its 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. The group of objects that may handle the command must be specified in a dynamic way.
Examples in real life: Examples in real life:
-java.util.logging.Logger.#log() -java.util.logging.Logger.#log()

View File

@@ -9,15 +9,15 @@ namespace ChainOfResponssibility.Validators.UserEntities
{ {
UserRepository userRepository; UserRepository userRepository;
PrincipalHelper principalHelper; PrincipalHelper principalHelper;
Operation operation; Operation inputOperation;
ChainValidation<User> userCreationValidation; ChainValidation<User> userCreationValidation;
ChainValidation<User> authenticateUserValidation; ChainValidation<User> authenticateUserValidation;
public UserProcessor() public UserProcessor()
{ {
userRepository = new UserRepository(); userRepository = new UserRepository();
principalHelper = new PrincipalHelper(); principalHelper = new PrincipalHelper();
operation = new AuthenticateOperation(AuthenticateUser); inputOperation = new AuthenticateOperation(AuthenticateUser);
operation.SetSuccessor(new CreateNewUserOperation(CreateNewUser)); inputOperation.SetSuccessor(new CreateNewUserOperation(CreateNewUser));
userCreationValidation = new IsAuthorisedToDoOperationsOnUser(principalHelper, Rights.Create); userCreationValidation = new IsAuthorisedToDoOperationsOnUser(principalHelper, Rights.Create);
userCreationValidation.SetSuccessor(new ValidateNoDuplicateEmail(userRepository)); userCreationValidation.SetSuccessor(new ValidateNoDuplicateEmail(userRepository));
@@ -55,12 +55,12 @@ namespace ChainOfResponssibility.Validators.UserEntities
string userInput; string userInput;
do do
{ {
operation.PrintMenu(); inputOperation.PrintMenu();
Console.Write(">"); Console.Write(">");
userInput = Console.ReadLine(); userInput = Console.ReadLine();
if (!IsExitCode(userInput)) if (!IsExitCode(userInput))
operation.Execute(userInput); inputOperation.Execute(userInput);
} while (!IsExitCode(userInput)); } while (!IsExitCode(userInput));
} }

View File

@@ -1,8 +1,8 @@
{ {
"version": "1.0.0-*", "version": "1.0.0-*",
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "NETStandard.Library": "1.6.0"
}, },
"frameworks": { "frameworks": {

View File

@@ -1,11 +1,8 @@
{ {
"version": "1.0.0-*", "version": "1.0.0-*",
"dependencies": { "dependencies": {
"Microsoft.NETCore.App": { "Microsoft.NETCore.App": "1.0.0"
"type": "platform",
"version": "1.0.0-rc2-3002702"
}
}, },
"frameworks": { "frameworks": {

View File

@@ -1,8 +1,8 @@
{ {
"version": "1.0.0-*", "version": "1.0.0-*",
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "NETStandard.Library": "1.6.0"
}, },
"frameworks": { "frameworks": {

View File

@@ -1,8 +1,8 @@
{ {
"version": "1.0.0-*", "version": "1.0.0-*",
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "NETStandard.Library": "1.6.0"
}, },
"frameworks": { "frameworks": {

View File

@@ -3,8 +3,8 @@
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027", "NETStandard.Library": "1.5.0-rc2-24027",
"Newtonsoft.Json": "8.0.3", "Newtonsoft.Json": "9.0.1",
"System.Runtime.Serialization.Primitives": "4.0.10-*" "System.Runtime.Serialization.Primitives": "4.1.1"
}, },
"frameworks": { "frameworks": {

View File

@@ -1,8 +1,8 @@
{ {
"version": "1.0.0-*", "version": "1.0.0-*",
"dependencies": { "dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027" "NETStandard.Library": "1.6.0"
}, },
"frameworks": { "frameworks": {