Skip to content

Commit 25ed51f

Browse files
committed
Updated to .net core 2.0
1 parent 2220bac commit 25ed51f

File tree

10 files changed

+34
-44
lines changed

10 files changed

+34
-44
lines changed

build.cake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Task("Patch-Assembly-Version")
4848

4949
Information("Building version {0} of Cofoundry.", versionInfo.InformationalVersion);
5050

51-
isPrerelease = !string.IsNullOrEmpty(versionInfo.PreReleaseNumber);
51+
isPrerelease = versionInfo.PreReleaseNumber.HasValue;
5252

5353
// Patch the version number so it's picked up when dependent projects are references
5454
// as nuget dependencies. Can't find a better way to do this.

src/Cofoundry.Plugins.ErrorLogging.Admin/Cofoundry.Plugins.ErrorLogging.Admin.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard1.6</TargetFramework>
4+
<TargetFramework>netstandard2.0</TargetFramework>
55

66
<PackageId>Cofoundry.Plugins.ErrorLogging.Admin</PackageId>
77
<Description>Adds simple database error logging to Cofoundry.</Description>
@@ -15,7 +15,7 @@
1515
</PropertyGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="Cofoundry.Web.Admin" Version="0.2.0-beta0022" />
18+
<PackageReference Include="Cofoundry.Web.Admin" Version="0.2.0-beta0056" />
1919
</ItemGroup>
2020

2121
<ItemGroup>

src/Cofoundry.Plugins.ErrorLogging.Admin/Plugins/Admin/Api/Errors/ErrorsApiController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
using System.Linq;
44
using System.Threading.Tasks;
55
using Cofoundry.Domain.CQS;
6-
using Cofoundry.Web.WebApi;
76
using Cofoundry.Web.Admin;
87
using Cofoundry.Plugins.ErrorLogging.Domain;
98
using Microsoft.AspNetCore.Mvc;
9+
using Cofoundry.Web;
1010

1111
namespace Cofoundry.Plugins.ErrorLogging.Admin
1212
{

src/Cofoundry.Plugins.ErrorLogging/Bootstrap/ErrorAutoMapProfile.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/Cofoundry.Plugins.ErrorLogging/Bootstrap/ErrorDependencyRegistration.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,11 @@ public class ErrorDependencyRegistration : IDependencyRegistration
1414
{
1515
public void Register(IContainerRegister container)
1616
{
17-
var overrideOptions = new RegistrationOptions()
18-
{
19-
ReplaceExisting = true,
20-
RegistrationOverridePriority = (int)RegistrationOverridePriority.Low
21-
};
17+
var overrideOptions = RegistrationOptions.Override(RegistrationOverridePriority.Low);
2218

2319
container
2420
.RegisterType<IErrorLoggingService, ErrorLoggingService>(overrideOptions)
25-
.RegisterDatabase<ErrorLoggingDbContext>()
26-
.RegisterFactory<ErrorLoggingSettings, ConfigurationSettingsFactory<ErrorLoggingSettings>>()
21+
.RegisterType<ErrorLoggingDbContext>()
2722
;
2823
}
2924
}

src/Cofoundry.Plugins.ErrorLogging/Cofoundry.Plugins.ErrorLogging.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard1.6</TargetFramework>
4+
<TargetFramework>netstandard2.0</TargetFramework>
55

66
<PackageId>Cofoundry.Plugins.ErrorLogging</PackageId>
77
<Description>Adds simple database error logging to Cofoundry.</Description>
@@ -15,7 +15,7 @@
1515
</PropertyGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="Cofoundry.Web" Version="0.2.0-beta0022" />
18+
<PackageReference Include="Cofoundry.Web" Version="0.2.0-beta0056" />
1919
</ItemGroup>
2020

2121
<ItemGroup>

src/Cofoundry.Plugins.ErrorLogging/Data/ErrorLoggingDbContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
4242
{
4343
modelBuilder
4444
.UseDefaultConfig(DbConstants.CofoundryPluginSchema)
45-
.Map(new ErrorMap());
45+
.ApplyConfiguration(new ErrorMap());
4646
}
4747

4848
#endregion

src/Cofoundry.Plugins.ErrorLogging/Data/ErrorMap.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
using Microsoft.EntityFrameworkCore.Metadata.Builders;
33
using Microsoft.EntityFrameworkCore;
44
using Cofoundry.Core;
5-
using Cofoundry.Domain.Data;
65

76
namespace Cofoundry.Plugins.ErrorLogging.Data
87
{
98
public class ErrorMap : IEntityTypeConfiguration<Error>
109
{
11-
public void Create(EntityTypeBuilder<Error> builder)
10+
public void Configure(EntityTypeBuilder<Error> builder)
1211
{
1312
builder.ToTable("Error", DbConstants.CofoundrySchema);
1413

src/Cofoundry.Plugins.ErrorLogging/Domain/Queries/GetErrorDetailsByIdQueryHandler.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Linq;
44
using System.Threading.Tasks;
55
using Cofoundry.Domain.CQS;
6-
using AutoMapper.QueryableExtensions;
76
using Cofoundry.Domain;
87
using Cofoundry.Plugins.ErrorLogging.Data;
98
using Microsoft.EntityFrameworkCore;
@@ -29,7 +28,22 @@ public async Task<ErrorDetails> ExecuteAsync(GetByIdQuery<ErrorDetails> query, I
2928
.Errors
3029
.AsNoTracking()
3130
.Where(u => u.ErrorId == query.Id)
32-
.ProjectTo<ErrorDetails>()
31+
.Select(e => new ErrorDetails()
32+
{
33+
CreateDate = e.CreateDate,
34+
Data = e.Data,
35+
EmailSent = e.EmailSent,
36+
ErrorId = e.ErrorId,
37+
ExceptionType = e.ExceptionType,
38+
Form = e.Form,
39+
QueryString = e.QueryString,
40+
Session = e.QueryString,
41+
Source = e.Source,
42+
StackTrace = e.QueryString,
43+
Target = e.Target,
44+
Url = e.Url,
45+
UserAgent = e.UserAgent
46+
})
3347
.SingleOrDefaultAsync();
3448

3549
return error;

src/Cofoundry.Plugins.ErrorLogging/Domain/Queries/SearchErrorSummariesQueryHandler.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
5-
using AutoMapper.QueryableExtensions;
65
using Cofoundry.Domain.CQS;
76
using Cofoundry.Domain.Data;
87
using Cofoundry.Domain;
@@ -41,10 +40,6 @@ public async Task<PagedQueryResult<ErrorSummary>> ExecuteAsync(SearchErrorSummar
4140
return result;
4241
}
4342

44-
#endregion
45-
46-
#region helpers
47-
4843
private IQueryable<ErrorSummary> CreateQuery(SearchErrorSummariesQuery query)
4944
{
5045
var dbQuery = _dbContext
@@ -63,7 +58,14 @@ private IQueryable<ErrorSummary> CreateQuery(SearchErrorSummariesQuery query)
6358

6459
return dbQuery
6560
.OrderByDescending(u => u.CreateDate)
66-
.ProjectTo<ErrorSummary>();
61+
.Select(e => new ErrorSummary()
62+
{
63+
CreateDate = e.CreateDate,
64+
ErrorId = e.ErrorId,
65+
ExceptionType = e.ExceptionType,
66+
Url = e.Url,
67+
UserAgent = e.UserAgent
68+
});
6769
}
6870

6971

0 commit comments

Comments
 (0)