Skip to content

Commit 5f8e9e1

Browse files
committed
Initial implementation.
0 parents  commit 5f8e9e1

23 files changed

Lines changed: 888 additions & 0 deletions

.gitignore

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
.vs
2+
3+
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
4+
[Bb]in/
5+
[Oo]bj/
6+
[Dd]eployment
7+
.vs
8+
9+
# mstest test results
10+
TestResults
11+
12+
## Ignore Visual Studio temporary files, build results, and
13+
## files generated by popular Visual Studio add-ons.
14+
15+
# User-specific files
16+
*.suo
17+
*.user
18+
*.sln.docstates
19+
20+
# Build results
21+
[Dd]ebug/
22+
[Rr]elease/
23+
x64/
24+
*_i.c
25+
*_p.c
26+
*.ilk
27+
*.meta
28+
*.obj
29+
*.pch
30+
*.pdb
31+
*.pgc
32+
*.pgd
33+
*.rsp
34+
*.sbr
35+
*.tlb
36+
*.tli
37+
*.tlh
38+
*.tmp
39+
*.log
40+
*.vspscc
41+
*.vssscc
42+
.builds
43+
44+
# Visual C++ cache files
45+
ipch/
46+
*.aps
47+
*.ncb
48+
*.opensdf
49+
*.sdf
50+
51+
# Visual Studio profiler
52+
*.psess
53+
*.vsp
54+
*.vspx
55+
56+
# Guidance Automation Toolkit
57+
*.gpState
58+
59+
# ReSharper is a .NET coding add-in
60+
_ReSharper*/
61+
*.[Rr]e[Ss]harper
62+
*.DotSettings.user
63+
*.DotSettings
64+
65+
# NCrunch
66+
*.ncrunch*
67+
.*crunch*.local.xml
68+
69+
# Installshield output folder
70+
[Ee]xpress
71+
72+
# DocProject is a documentation generator add-in
73+
DocProject/buildhelp/
74+
DocProject/Help/*.HxT
75+
DocProject/Help/*.HxC
76+
DocProject/Help/*.hhc
77+
DocProject/Help/*.hhk
78+
DocProject/Help/*.hhp
79+
DocProject/Help/Html2
80+
DocProject/Help/html
81+
82+
# Click-Once directory
83+
publish
84+
85+
# Publish Web Output
86+
*.Publish.xml
87+
88+
# NuGet Packages Directory
89+
packages
90+
91+
# Windows Azure Build Output
92+
csx
93+
*.build.csdef
94+
95+
# Windows Store app package directory
96+
AppPackages/
97+
98+
# Others
99+
[Bb]in
100+
[Oo]bj
101+
sql
102+
TestResults
103+
[Tt]est[Rr]esult*
104+
*.Cache
105+
ClientBin
106+
[Ss]tyle[Cc]op.*
107+
~$*
108+
*.dbmdl
109+
Generated_Code #added for RIA/Silverlight projects
110+
111+
# Backup & report files from converting an old project file to a newer
112+
# Visual Studio version. Backup files are not needed, because we have git ;-)
113+
_UpgradeReport_Files/
114+
Backup*/
115+
UpgradeLog*.XML

.media/logo.png

2.3 KB
Loading

LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2024, Eben Roux
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
Redistributions in binary form must reproduce the above copyright notice, this
11+
list of conditions and the following disclaimer in the documentation and/or
12+
other materials provided with the distribution.
13+
14+
Neither the name of the Shuttle organization nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Shuttle.Core.TransactionScope
2+
3+
```
4+
PM> Install-Package Shuttle.Core.TransactionScope
5+
```
6+
7+
This package makes use of the .Net `TransactionScope` class to provide ambient transaction handling.
8+
9+
## Configuration
10+
11+
The relevant components may be configured using `IServiceColletion`:
12+
13+
```c#
14+
services.AddTransactionScope(builder =>
15+
{
16+
builder.Options.Enabled = true;
17+
builder.Options.IsolationLevel = isolationLevel;
18+
builder.Options.Timeout = TimeSpan.FromSeconds(30);
19+
});
20+
```
21+
22+
The default JSON settings structure is as follows::
23+
24+
```json
25+
{
26+
"Shuttle": {
27+
"TransactionScope": {
28+
"Enabled": true,
29+
"IsolationLevel": "isolation-level",
30+
"Timeout": "00:00:30"
31+
}
32+
}
33+
}
34+
```
35+
36+
# ITransactionScope
37+
38+
An implementation of the `ITransactionScope` interface is used to wrap a `TransactionScope`.
39+
40+
The `DefaultTransactionScope` makes use of the standard .NET `TransactionScope` functionality. There is also a `NullTransactionScope`, which is used when the transaction scope handling is disabled, that implements the null pattern so it implements the interface but does not do anything.
41+
42+
## Properties
43+
44+
``` c#
45+
Guid Id { get; }
46+
```
47+
48+
Returns the Id of the transaction scope.
49+
50+
## Methods
51+
52+
``` c#
53+
void Complete();
54+
```
55+
56+
Marks the transaction scope as complete.
57+
58+
# ITransactionScopeFactory
59+
60+
An implementation of the `ITransactionScopeFactory` interface provides instances of an `ITransactionScope` implementation.
61+
62+
The `TransactionScopeFactory` provides a `DefaultTransactionScope` instance if transaction scopes are `Enabled`; else a `NullTransactionScope` that implements the null pattern.
63+
64+
## Create
65+
66+
``` c#
67+
ITransactionScope Create(IsolationLevel isolationLevel, TimeSpan timeout);
68+
```
69+
70+
Creates the relevant instance using the given parameters.

Shuttle.Core.TransactionScope.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.10.34928.147
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shuttle.Core.TransactionScope", "Shuttle.Core.TransactionScope\Shuttle.Core.TransactionScope.csproj", "{077167DC-3E8C-4D55-A147-B35739B4674A}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A355D9B5-8EF0-4440-9A63-1B4EAEE0F835}"
9+
ProjectSection(SolutionItems) = preProject
10+
LICENSE = LICENSE
11+
README.md = README.md
12+
EndProjectSection
13+
EndProject
14+
Global
15+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
16+
Debug|Any CPU = Debug|Any CPU
17+
Release|Any CPU = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
20+
{077167DC-3E8C-4D55-A147-B35739B4674A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{077167DC-3E8C-4D55-A147-B35739B4674A}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{077167DC-3E8C-4D55-A147-B35739B4674A}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{077167DC-3E8C-4D55-A147-B35739B4674A}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {92434EBF-1E79-43EC-979B-948E4B6E48F8}
30+
EndGlobalSection
31+
EndGlobal
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
4+
#if NETSTANDARD
5+
[assembly: AssemblyTitle(".NET Standard")]
6+
#endif
7+
8+
#if NET6_0_OR_GREATER
9+
[assembly: AssemblyTitle(".NET 6.0 (or greater)")]
10+
#endif
11+
12+
[assembly: AssemblyVersion("#{SemanticVersionCore}#.0")]
13+
[assembly: AssemblyCopyright("Copyright (c) #{Year}#, Eben Roux")]
14+
[assembly: AssemblyProduct("Shuttle.Core.TransactionScope")]
15+
[assembly: AssemblyCompany("Eben Roux")]
16+
[assembly: AssemblyConfiguration("Release")]
17+
[assembly: AssemblyInformationalVersion("#{SemanticVersion}#")]
18+
[assembly: ComVisible(false)]
Binary file not shown.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<PackageTasksPath Condition="'$(PackageTasksPath)' == ''">Shuttle.NuGetPackager.MSBuild.dll</PackageTasksPath>
5+
</PropertyGroup>
6+
7+
<UsingTask AssemblyFile="$(PackageTasksPath)" TaskName="Shuttle.NuGetPackager.MSBuild.Prompt" />
8+
<UsingTask AssemblyFile="$(PackageTasksPath)" TaskName="Shuttle.NuGetPackager.MSBuild.RegexFindAndReplace" />
9+
<UsingTask AssemblyFile="$(PackageTasksPath)" TaskName="Shuttle.NuGetPackager.MSBuild.NuGet.SetNuGetPackageVersions" />
10+
<UsingTask AssemblyFile="$(PackageTasksPath)" TaskName="Shuttle.NuGetPackager.MSBuild.Zip" />
11+
<UsingTask AssemblyFile="$(PackageTasksPath)" TaskName="Shuttle.NuGetPackager.MSBuild.NuGet.SemanticVersion" />
12+
</Project>
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Version" ToolsVersion="15">
2+
<PropertyGroup>
3+
<PackageName>Shuttle.Core.TransactionScope</PackageName>
4+
<PackageSource Condition="$(PackageSource) == ''">https://www.nuget.org</PackageSource>
5+
<Configuration Condition="$(Configuration) == ''">Release</Configuration>
6+
</PropertyGroup>
7+
8+
<Import Project="Shuttle.NuGetPackager.targets" />
9+
10+
<ItemGroup>
11+
<ProjectReference Include="..\$(PackageName).csproj" />
12+
</ItemGroup>
13+
14+
<Target Name="Build">
15+
<MSBuild Projects="@(ProjectReference)" Targets="Rebuild" Properties="Configuration=Debug;Platform=AnyCPU" />
16+
<MSBuild Projects="@(ProjectReference)" Targets="Rebuild" Properties="Configuration=Release;Platform=AnyCPU" />
17+
</Target>
18+
19+
<Target Name="Version">
20+
<Prompt Text="Enter semantic version:" Condition="$(SemanticVersion) == ''">
21+
<Output TaskParameter="UserInput" PropertyName="SemanticVersion" />
22+
</Prompt>
23+
24+
<Error Text="Please enter a version number." Condition="$(SemanticVersion) == ''" />
25+
26+
<SemanticVersion Value="$(SemanticVersion)">
27+
<Output TaskParameter="VersionCore" PropertyName="SemanticVersionCore" />
28+
<Output TaskParameter="Prerelease" PropertyName="SemanticVersionPrerelease" />
29+
<Output TaskParameter="BuildMetadata" PropertyName="SemanticVersionBuildMetadata" />
30+
</SemanticVersion>
31+
32+
<Copy SourceFiles="AssemblyInfo.cs.template" DestinationFiles="..\Properties\AssemblyInfo.cs" SkipUnchangedFiles="false" />
33+
34+
<RegexFindAndReplace Files="..\Properties\AssemblyInfo.cs" FindExpression="#\{SemanticVersionCore\}#"
35+
ReplacementText="$(SemanticVersionCore)" />
36+
<RegexFindAndReplace Files="..\Properties\AssemblyInfo.cs" FindExpression="#\{SemanticVersion\}#"
37+
ReplacementText="$(SemanticVersion)" />
38+
<RegexFindAndReplace Files="..\Properties\AssemblyInfo.cs" FindExpression="#\{Year\}#"
39+
ReplacementText="$([System.DateTime]::Now.ToString(`yyyy`))" />
40+
41+
<Copy SourceFiles="package.nuspec.template" DestinationFiles="package.nuspec" SkipUnchangedFiles="false" />
42+
43+
<RegexFindAndReplace Files="package.nuspec" FindExpression="#\{SemanticVersion\}#"
44+
ReplacementText="$(SemanticVersion)" />
45+
<RegexFindAndReplace Files="package.nuspec" FindExpression="#\{Year\}#"
46+
ReplacementText="$([System.DateTime]::Now.ToString(`yyyy`))" />
47+
48+
<SetNuGetPackageVersions Files="package.nuspec" ProjectFile="..\$(PackageName).csproj" />
49+
</Target>
50+
51+
<Target Name="Pack" DependsOnTargets="Build">
52+
<Error
53+
Text="Before executing the 'Package' target first execute the 'Version' target to set the relevant semantic version in all applicable files."
54+
Condition="!Exists('package.nuspec')" />
55+
56+
<ItemGroup>
57+
<NuGetBinaries Include="..\bin\$(Configuration)\**\$(PackageName).dll" />
58+
</ItemGroup>
59+
60+
<RemoveDir Directories="release" />
61+
62+
<Copy SourceFiles="package.nuspec" DestinationFolder="release\" SkipUnchangedFiles="false" />
63+
<Copy SourceFiles="@(NuGetBinaries)" DestinationFolder="release\lib\%(RecursiveDir)" SkipUnchangedFiles="false" />
64+
65+
<Exec Command="nuget pack release\package.nuspec -OutputDirectory release -NoPackageAnalysis" />
66+
</Target>
67+
68+
<Target Name="Push" DependsOnTargets="Version">
69+
<MSBuild
70+
Projects="$(MSBuildProjectFile)"
71+
Targets="Pack"
72+
Properties="SemanticVersion=$(SemanticVersion)" />
73+
74+
<Exec
75+
Command="nuget push release\$(PackageName).$(SemanticVersion).nupkg -source $(PackageSource)" />
76+
</Target>
77+
78+
<Target Name="Bump" DependsOnTargets="Version">
79+
<MSBuild
80+
Projects="$(MSBuildProjectFile)"
81+
Targets="Pack"
82+
Properties="SemanticVersion=$(SemanticVersion)" />
83+
84+
<ItemGroup>
85+
<PackageFile Include="release\$(PackageName).*.nupkg" />
86+
</ItemGroup>
87+
88+
<MakeDir Directories="$(NuGetPackageSourceFolder)" Condition="$(NuGetPackageSourceFolder) != ''" />
89+
90+
<Copy
91+
SourceFiles="@(PackageFile)"
92+
DestinationFolder="$(NuGetPackageSourceFolder)"
93+
SkipUnchangedFiles="false"
94+
Condition="$(NuGetPackageSourceFolder) != ''" />
95+
</Target>
96+
97+
<Target Name="Flush">
98+
<ItemGroup>
99+
<PackageFolder Include="$(UserProfile)\.nuget\packages\$(PackageName)" />
100+
</ItemGroup>
101+
102+
<RemoveDir Directories="@(PackageFolder)" />
103+
</Target>
104+
</Project>

0 commit comments

Comments
 (0)