Skip to content

Commit 4af49ed

Browse files
committed
Merge branch 'v2.0'
# Conflicts: # src/Server/Coderr.Server.ReportAnalyzer/AnalysisDbContext.cs # src/Server/Coderr.Server.SqlServer/Analysis/Jobs/InsertCollectionsJob.cs # src/Server/Coderr.Server.Web.Tests/applicationhost.config # src/Server/Coderr.Server.Web/App_Start/CompositionRoot.cs # src/Server/Coderr.Server.Web/App_Start/Services/ServiceRunner.cs # src/Server/Coderr.Server.Web/Areas/Admin/Views/Messaging/Email.cshtml # src/Server/Coderr.Server.Web/Areas/Installation/Views/Messaging/Email.cshtml # src/Server/Coderr.Server.Web/Infrastructure/TransactionalAttribute.cs # src/Server/Coderr.Server.Web/Properties/AssemblyInfo.cs # src/Server/Coderr.Server.Web/Scripts/Models/AllModels.js.map # src/Server/Coderr.Server.Web/Scripts/Models/AllModels.ts # src/Server/Coderr.Server.Web/ViewModels/Incident/Components/IncidentTable.js # src/Server/Coderr.Server.Web/ViewModels/Incident/Components/IncidentTable.js.map # src/Server/Coderr.Server.Web/ViewModels/Incident/Components/IncidentTable.ts
2 parents a5f27aa + f716511 commit 4af49ed

File tree

1,422 files changed

+109994
-88666
lines changed

Some content is hidden

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

1,422 files changed

+109994
-88666
lines changed

.editorconfig

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# EditorConfig: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Don't use tabs for indentation.
7+
[*]
8+
indent_style = space
9+
# (Please don't specify an indent_size here; that has too many unintended consequences.)
10+
11+
# Code files
12+
[*.{cs,csx,vb,vbx}]
13+
indent_size = 4
14+
15+
# Xml project files
16+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
17+
indent_size = 2
18+
19+
# Xml config files
20+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
21+
indent_size = 2
22+
23+
# JSON files
24+
[*.json]
25+
indent_size = 2
26+
27+
# Dotnet code style settings:
28+
[*.cs]
29+
# Sort using and Import directives with System.* appearing first
30+
dotnet_sort_system_directives_first = true
31+
32+
# Don't use this. qualifier
33+
dotnet_style_qualification_for_field = false:suggestion
34+
dotnet_style_qualification_for_property = false:suggestion
35+
36+
# use int x = .. over Int32
37+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
38+
39+
# use int.MaxValue over Int32.MaxValue
40+
dotnet_style_predefined_type_for_member_access = true:suggestion
41+
42+
# Require var all the time.
43+
csharp_style_var_for_built_in_types = true:suggestion
44+
csharp_style_var_when_type_is_apparent = true:suggestion
45+
csharp_style_var_elsewhere = true:suggestion
46+
47+
# Disallow throw expressions.
48+
csharp_style_throw_expression = false:suggestion
49+
50+
# Newline settings
51+
csharp_new_line_before_open_brace = all
52+
csharp_new_line_before_else = true
53+
csharp_new_line_before_catch = true
54+
csharp_new_line_before_finally = true
55+
csharp_new_line_before_members_in_object_initializers = true
56+
csharp_new_line_before_members_in_anonymous_types = true

.gitattributes

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,22 @@
1313
*.png binary
1414
*.gif binary
1515

16-
*.cs text=auto diff=csharp
17-
*.vb text=auto
16+
*.cs text=auto diff=csharp eol=crlf
17+
*.vb text=auto eol=crlf
1818
*.resx text=auto
19-
*.c text=auto
20-
*.cpp text=auto
21-
*.cxx text=auto
22-
*.h text=auto
23-
*.hxx text=auto
24-
*.py text=auto
25-
*.rb text=auto
26-
*.java text=auto
2719
*.html text=auto
2820
*.htm text=auto
2921
*.css text=auto
3022
*.scss text=auto
3123
*.sass text=auto
3224
*.less text=auto
3325
*.js text=auto
34-
*.lisp text=auto
35-
*.clj text=auto
36-
*.sql text=auto
37-
*.php text=auto
38-
*.lua text=auto
39-
*.m text=auto
40-
*.asm text=auto
41-
*.erl text=auto
42-
*.fs text=auto
43-
*.fsx text=auto
44-
*.hs text=auto
26+
*.sql text=auto eol=crlf
4527

46-
*.csproj text=auto
47-
*.vbproj text=auto
48-
*.fsproj text=auto
49-
*.dbproj text=auto
28+
*.csproj text=auto eol=crlf
29+
*.vbproj text=auto eol=crlf
30+
*.fsproj text=auto eol=crlf
31+
*.dbproj text=auto eol=crlf
5032
*.sln text=auto eol=crlf
5133

5234
*.sh eol=lf

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ src/Tools/MarkdownToNamespaceDoc/packages/*/
3434
src/Tools/TsGenerator/.vs/*
3535
src/Help/*
3636
src/Server/Coderr.Server.Web.Tests/applicationhost.config
37+
/src/Server/Coderr.Server.Web/node_modules/*

docs/release_banner.png

4.29 KB
Loading
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Data;
3+
using System.Reflection;
4+
using System.Security.Claims;
5+
using Microsoft.Extensions.DependencyInjection;
6+
7+
namespace Coderr.Server.Abstractions.Boot
8+
{
9+
public abstract class ConfigurationContext
10+
{
11+
12+
public Func<ClaimsPrincipal, IDbConnection> ConnectionFactory { get; set; }
13+
public IServiceCollection Services { get; set; }
14+
public Func<IServiceProvider> ServiceProvider { get; set; }
15+
public IConfiguration Configuration { get; set; }
16+
17+
public abstract void RegisterMessageTypes(Assembly assembly);
18+
}
19+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
3+
namespace Coderr.Server.Abstractions.Boot
4+
{
5+
public class ContainerServiceAttribute: Attribute
6+
{
7+
public bool IsSingleInstance { get; set; }
8+
public bool IsTransient { get; set; }
9+
public bool RegisterAsSelf { get; set; }
10+
}
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace Coderr.Server.Abstractions.Boot
2+
{
3+
public interface IAppModule
4+
{
5+
void Configure(ConfigurationContext context);
6+
void Start(StartContext context);
7+
8+
void Stop();
9+
}
10+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Collections.Generic;
2+
3+
namespace Coderr.Server.Abstractions.Boot
4+
{
5+
public interface IConfiguration
6+
{
7+
IConfigurationSection GetSection(string name);
8+
string GetConnectionString(string name);
9+
IEnumerable<IConfigurationSection> GetChildren();
10+
}
11+
12+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
4+
namespace Coderr.Server.Abstractions.Boot
5+
{
6+
public interface IConfigurationSection
7+
{
8+
string this[string name] { get; }
9+
IEnumerable<IConfigurationSection> GetChildren();
10+
11+
string Value { get; }
12+
}
13+
14+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System;
2+
using System.Linq;
3+
using System.Reflection;
4+
using Microsoft.Extensions.DependencyInjection;
5+
6+
namespace Coderr.Server.Abstractions.Boot
7+
{
8+
public static class RegisterExtensions
9+
{
10+
public static void RegisterContainerServices(this IServiceCollection serviceCollection, Assembly assembly)
11+
{
12+
var containerServices = assembly.GetTypes()
13+
.Where(x => x.GetCustomAttribute<ContainerServiceAttribute>(true) != null)
14+
.ToList();
15+
foreach (var containerService in containerServices)
16+
{
17+
var attr = containerService.GetCustomAttribute<ContainerServiceAttribute>();
18+
var interfaces = containerService.GetInterfaces();
19+
20+
// Hack so that the same instance is resolved for each interface
21+
if (interfaces.Length > 1 || attr.RegisterAsSelf)
22+
serviceCollection.RegisterService(attr, containerService, containerService);
23+
24+
foreach (var @interface in interfaces)
25+
{
26+
serviceCollection.RegisterService(attr, @interface, containerService);
27+
}
28+
}
29+
}
30+
31+
public static void RegisterMessageHandlers(this IServiceCollection serviceCollection, Assembly assembly)
32+
{
33+
var types = assembly.GetTypes()
34+
.Where(y => y.GetInterfaces()
35+
.Any(x => x.Name.Contains("IMessageHandler") || x.Name.Contains("IQueryHandler")))
36+
.ToList();
37+
foreach (var type in types)
38+
{
39+
serviceCollection.AddScoped(type, type);
40+
serviceCollection.AddScoped(type.GetInterfaces()[0], type);
41+
}
42+
}
43+
44+
private static void RegisterService(this IServiceCollection serviceCollection, ContainerServiceAttribute attr,
45+
Type service, Type implementation)
46+
{
47+
if (attr.IsSingleInstance)
48+
serviceCollection.AddSingleton(service, implementation);
49+
else if (attr.IsTransient)
50+
serviceCollection.AddTransient(service, implementation);
51+
else
52+
serviceCollection.AddScoped(service, implementation);
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)