Skip to content

Commit 9af6e51

Browse files
Thierry Habarthabarthierry-hue
authored andcommitted
Ticket #19 : split the solution
1 parent 069282a commit 9af6e51

File tree

172 files changed

+39969
-647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+39969
-647
lines changed

CaseManagement.sln

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseManagement.CMMN.CMIS",
2727
EndProject
2828
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseManagement.CMMN.CMIS.Tests", "tests\CaseManagement.CMMN.CMIS.Tests\CaseManagement.CMMN.CMIS.Tests.csproj", "{162D547F-D8E8-4B2F-A86C-3F74BF7F4F45}"
2929
EndProject
30-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseManagement.CMMN.AspNetCore", "src\CaseManagement.CMMN.AspNetCore\CaseManagement.CMMN.AspNetCore.csproj", "{A3B96AD1-0B79-4327-8AB3-2683B486EA24}"
31-
EndProject
3230
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "04. Startup", "04. Startup", "{4A5D2E88-20E8-4A3F-8527-A4934BC0E11F}"
3331
EndProject
3432
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaseManagement.ConsoleApp", "src\CaseManagement.ConsoleApp\CaseManagement.ConsoleApp.csproj", "{2AF59449-01BC-447B-8156-B285278E7956}"
3533
EndProject
34+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaseManagement.AspNetWebApi", "src\CaseManagement.AspNetWebApi\CaseManagement.AspNetWebApi.csproj", "{1375F8CE-B082-44BA-8EF1-E737F9009FC4}"
35+
EndProject
36+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseManagement.CMMN.AspNet", "src\CaseManagement.CMMN.AspNet\CaseManagement.CMMN.AspNet.csproj", "{11F22F1F-2F25-4F13-9F2F-195AFC99B584}"
37+
EndProject
38+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CaseManagement.CMMN.AspNetCore", "src\CaseManagement.CMMN.AspNetCore\CaseManagement.CMMN.AspNetCore.csproj", "{A33A6BDF-FD00-4EFE-BA3F-A73BC63CB321}"
39+
EndProject
3640
Global
3741
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3842
Debug|Any CPU = Debug|Any CPU
@@ -71,14 +75,22 @@ Global
7175
{162D547F-D8E8-4B2F-A86C-3F74BF7F4F45}.Debug|Any CPU.Build.0 = Debug|Any CPU
7276
{162D547F-D8E8-4B2F-A86C-3F74BF7F4F45}.Release|Any CPU.ActiveCfg = Release|Any CPU
7377
{162D547F-D8E8-4B2F-A86C-3F74BF7F4F45}.Release|Any CPU.Build.0 = Release|Any CPU
74-
{A3B96AD1-0B79-4327-8AB3-2683B486EA24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
75-
{A3B96AD1-0B79-4327-8AB3-2683B486EA24}.Debug|Any CPU.Build.0 = Debug|Any CPU
76-
{A3B96AD1-0B79-4327-8AB3-2683B486EA24}.Release|Any CPU.ActiveCfg = Release|Any CPU
77-
{A3B96AD1-0B79-4327-8AB3-2683B486EA24}.Release|Any CPU.Build.0 = Release|Any CPU
7878
{2AF59449-01BC-447B-8156-B285278E7956}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
7979
{2AF59449-01BC-447B-8156-B285278E7956}.Debug|Any CPU.Build.0 = Debug|Any CPU
8080
{2AF59449-01BC-447B-8156-B285278E7956}.Release|Any CPU.ActiveCfg = Release|Any CPU
8181
{2AF59449-01BC-447B-8156-B285278E7956}.Release|Any CPU.Build.0 = Release|Any CPU
82+
{1375F8CE-B082-44BA-8EF1-E737F9009FC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
83+
{1375F8CE-B082-44BA-8EF1-E737F9009FC4}.Debug|Any CPU.Build.0 = Debug|Any CPU
84+
{1375F8CE-B082-44BA-8EF1-E737F9009FC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
85+
{1375F8CE-B082-44BA-8EF1-E737F9009FC4}.Release|Any CPU.Build.0 = Release|Any CPU
86+
{11F22F1F-2F25-4F13-9F2F-195AFC99B584}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
87+
{11F22F1F-2F25-4F13-9F2F-195AFC99B584}.Debug|Any CPU.Build.0 = Debug|Any CPU
88+
{11F22F1F-2F25-4F13-9F2F-195AFC99B584}.Release|Any CPU.ActiveCfg = Release|Any CPU
89+
{11F22F1F-2F25-4F13-9F2F-195AFC99B584}.Release|Any CPU.Build.0 = Release|Any CPU
90+
{A33A6BDF-FD00-4EFE-BA3F-A73BC63CB321}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
91+
{A33A6BDF-FD00-4EFE-BA3F-A73BC63CB321}.Debug|Any CPU.Build.0 = Debug|Any CPU
92+
{A33A6BDF-FD00-4EFE-BA3F-A73BC63CB321}.Release|Any CPU.ActiveCfg = Release|Any CPU
93+
{A33A6BDF-FD00-4EFE-BA3F-A73BC63CB321}.Release|Any CPU.Build.0 = Release|Any CPU
8294
EndGlobalSection
8395
GlobalSection(SolutionProperties) = preSolution
8496
HideSolutionNode = FALSE
@@ -92,8 +104,10 @@ Global
92104
{3DFF3970-7721-4087-8E41-F478D39C2095} = {73DCE7A3-F336-4E72-B36C-9D88860BC897}
93105
{2B86EDF0-DA2D-4FFE-9877-4CBA2999B0A5} = {CD2E7CFE-4E9C-4308-A0D3-41CD5AD90FD8}
94106
{162D547F-D8E8-4B2F-A86C-3F74BF7F4F45} = {A632EFC3-730B-46D7-B669-91962DFA8947}
95-
{A3B96AD1-0B79-4327-8AB3-2683B486EA24} = {CD2E7CFE-4E9C-4308-A0D3-41CD5AD90FD8}
96107
{2AF59449-01BC-447B-8156-B285278E7956} = {4A5D2E88-20E8-4A3F-8527-A4934BC0E11F}
108+
{1375F8CE-B082-44BA-8EF1-E737F9009FC4} = {4A5D2E88-20E8-4A3F-8527-A4934BC0E11F}
109+
{11F22F1F-2F25-4F13-9F2F-195AFC99B584} = {CD2E7CFE-4E9C-4308-A0D3-41CD5AD90FD8}
110+
{A33A6BDF-FD00-4EFE-BA3F-A73BC63CB321} = {CD2E7CFE-4E9C-4308-A0D3-41CD5AD90FD8}
97111
EndGlobalSection
98112
GlobalSection(ExtensibilityGlobals) = postSolution
99113
SolutionGuid = {D2CFBF2E-D493-42F7-B339-01A3070C2B5E}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Web;
2+
using System.Web.Optimization;
3+
4+
namespace CaseManagement.AspNetWebApi
5+
{
6+
public class BundleConfig
7+
{
8+
// For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
9+
public static void RegisterBundles(BundleCollection bundles)
10+
{
11+
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
12+
"~/Scripts/jquery-{version}.js"));
13+
14+
// Use the development version of Modernizr to develop with and learn from. Then, when you're
15+
// ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
16+
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
17+
"~/Scripts/modernizr-*"));
18+
19+
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
20+
"~/Scripts/bootstrap.js"));
21+
22+
bundles.Add(new StyleBundle("~/Content/css").Include(
23+
"~/Content/bootstrap.css",
24+
"~/Content/site.css"));
25+
}
26+
}
27+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System.Web;
2+
using System.Web.Mvc;
3+
4+
namespace CaseManagement.AspNetWebApi
5+
{
6+
public class FilterConfig
7+
{
8+
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
9+
{
10+
filters.Add(new HandleErrorAttribute());
11+
}
12+
}
13+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
using System.Web.Mvc;
6+
using System.Web.Routing;
7+
8+
namespace CaseManagement.AspNetWebApi
9+
{
10+
public class RouteConfig
11+
{
12+
public static void RegisterRoutes(RouteCollection routes)
13+
{
14+
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
15+
16+
routes.MapRoute(
17+
name: "Default",
18+
url: "{controller}/{action}/{id}",
19+
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
20+
);
21+
}
22+
}
23+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using Microsoft.Extensions.DependencyInjection;
2+
using System;
3+
using Unity;
4+
5+
namespace CaseManagement.AspNetWebApi
6+
{
7+
public class UnityServiceProvider : IServiceProvider, ISupportRequiredService, IServiceScopeFactory, IServiceScope, IDisposable
8+
{
9+
private IUnityContainer _container;
10+
11+
internal UnityServiceProvider(IUnityContainer container)
12+
{
13+
_container = container;
14+
}
15+
16+
public object GetService(Type serviceType)
17+
{
18+
try
19+
{
20+
return _container.Resolve(serviceType, null);
21+
}
22+
catch { /* Ignore */ }
23+
return null;
24+
}
25+
26+
public object GetRequiredService(Type serviceType)
27+
{
28+
return _container.Resolve(serviceType, null);
29+
}
30+
31+
32+
public IServiceScope CreateScope()
33+
{
34+
return new UnityServiceProvider(_container.CreateChildContainer());
35+
}
36+
37+
IServiceProvider IServiceScope.ServiceProvider => this;
38+
39+
public static explicit operator UnityContainer(UnityServiceProvider c)
40+
{
41+
return (UnityContainer)c._container;
42+
}
43+
44+
protected virtual void Dispose(bool disposing)
45+
{
46+
IDisposable disposable = _container;
47+
_container = null;
48+
disposable?.Dispose();
49+
}
50+
51+
public void Dispose()
52+
{
53+
Dispose(true);
54+
GC.SuppressFinalize(this);
55+
}
56+
}
57+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
using CaseManagement.AspNetWebApi.Infrastructures;
2+
using Microsoft.Extensions.DependencyInjection;
3+
using System;
4+
using System.Diagnostics;
5+
using System.Web.Http;
6+
using Unity;
7+
using Unity.Lifetime;
8+
9+
namespace CaseManagement.AspNetWebApi
10+
{
11+
public static class WebApiConfig
12+
{
13+
public static void Register(HttpConfiguration config, ServiceCollection serviceCollection)
14+
{
15+
var container = new UnityContainer();
16+
foreach (var d in serviceCollection)
17+
{
18+
Register(container, d);
19+
}
20+
21+
config.DependencyResolver = new UnityResolver(container);
22+
// Web API routes
23+
config.MapHttpAttributeRoutes();
24+
25+
config.Routes.MapHttpRoute(
26+
name: "DefaultApi",
27+
routeTemplate: "api/{controller}/{id}",
28+
defaults: new { id = RouteParameter.Optional }
29+
);
30+
}
31+
32+
internal static void Register(IUnityContainer container, ServiceDescriptor serviceDescriptor)
33+
{
34+
if (serviceDescriptor.ImplementationType != null)
35+
{
36+
var name = serviceDescriptor.ServiceType.IsGenericTypeDefinition ? UnityContainer.All : null;
37+
container.RegisterType(serviceDescriptor.ServiceType, serviceDescriptor.ImplementationType, name, (ITypeLifetimeManager)serviceDescriptor.GetLifetime());
38+
}
39+
else if (serviceDescriptor.ImplementationInstance != null)
40+
{
41+
container.RegisterInstance(serviceDescriptor.ServiceType, null, serviceDescriptor.ImplementationInstance, (IInstanceLifetimeManager)serviceDescriptor.GetLifetime());
42+
}
43+
else
44+
{
45+
throw new InvalidOperationException("Unsupported registration type");
46+
}
47+
}
48+
49+
internal static LifetimeManager GetLifetime(this ServiceDescriptor serviceDescriptor)
50+
{
51+
switch (serviceDescriptor.Lifetime)
52+
{
53+
case ServiceLifetime.Scoped:
54+
return new HierarchicalLifetimeManager();
55+
case ServiceLifetime.Singleton:
56+
return new ContainerControlledLifetimeManager();
57+
case ServiceLifetime.Transient:
58+
return new TransientLifetimeManager();
59+
default:
60+
throw new NotImplementedException(
61+
$"Unsupported lifetime manager type '{serviceDescriptor.Lifetime}'");
62+
}
63+
}
64+
}
65+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System;
2+
using System.Text;
3+
using System.Web;
4+
using System.Web.Http.Description;
5+
6+
namespace CaseManagement.AspNetWebApi.Areas.HelpPage
7+
{
8+
public static class ApiDescriptionExtensions
9+
{
10+
/// <summary>
11+
/// Generates an URI-friendly ID for the <see cref="ApiDescription"/>. E.g. "Get-Values-id_name" instead of "GetValues/{id}?name={name}"
12+
/// </summary>
13+
/// <param name="description">The <see cref="ApiDescription"/>.</param>
14+
/// <returns>The ID as a string.</returns>
15+
public static string GetFriendlyId(this ApiDescription description)
16+
{
17+
string path = description.RelativePath;
18+
string[] urlParts = path.Split('?');
19+
string localPath = urlParts[0];
20+
string queryKeyString = null;
21+
if (urlParts.Length > 1)
22+
{
23+
string query = urlParts[1];
24+
string[] queryKeys = HttpUtility.ParseQueryString(query).AllKeys;
25+
queryKeyString = String.Join("_", queryKeys);
26+
}
27+
28+
StringBuilder friendlyPath = new StringBuilder();
29+
friendlyPath.AppendFormat("{0}-{1}",
30+
description.HttpMethod.Method,
31+
localPath.Replace("/", "-").Replace("{", String.Empty).Replace("}", String.Empty));
32+
if (queryKeyString != null)
33+
{
34+
friendlyPath.AppendFormat("_{0}", queryKeyString.Replace('.', '-'));
35+
}
36+
return friendlyPath.ToString();
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)