-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from marcwittke/develop
Develop
- Loading branch information
Showing
29 changed files
with
416 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
namespace Backend.Fx.Hacking | ||
{ | ||
public static class PrivateUtil | ||
{ | ||
public static T CreateInstanceFromPrivateDefaultConstructor<T>() | ||
{ | ||
var constructor = typeof(T).GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance).SingleOrDefault(ci => ci.GetParameters().Length == 0); | ||
if (constructor == null) | ||
{ | ||
throw new InvalidOperationException($"No private default constructor found in {typeof(T).Name}"); | ||
} | ||
T instance = (T)constructor.Invoke(null); | ||
return instance; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 0 additions & 55 deletions
55
src/abstractions/Backend.Fx/Patterns/UnitOfWork/IReadonlyUnitOfWork.cs
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
src/abstractions/Backend.Fx/Patterns/UnitOfWork/ReadonlyDecorator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Security.Principal; | ||
using Backend.Fx.Patterns.DependencyInjection; | ||
|
||
namespace Backend.Fx.Patterns.UnitOfWork | ||
{ | ||
public class ReadonlyDecorator : IUnitOfWork | ||
{ | ||
private readonly IUnitOfWork _unitOfWorkImplementation; | ||
|
||
public ReadonlyDecorator(IUnitOfWork unitOfWorkImplementation) | ||
{ | ||
_unitOfWorkImplementation = unitOfWorkImplementation; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_unitOfWorkImplementation.Dispose(); | ||
} | ||
|
||
public void Begin() | ||
{ | ||
_unitOfWorkImplementation.Begin(); | ||
} | ||
|
||
public void Complete() | ||
{ | ||
//skip | ||
} | ||
|
||
public ICurrentTHolder<IIdentity> IdentityHolder => _unitOfWorkImplementation.IdentityHolder; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Backend.Fx.AspNetCore | ||
{ | ||
public static class HttpRequestEx | ||
{ | ||
public static bool IsSafe(this HttpRequest request) | ||
{ | ||
string method = request.Method.ToUpperInvariant(); | ||
return method == "OPTIONS" || method == "GET" || method == "HEAD"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.