Skip to content

Commit

Permalink
Restore Dgmjr.Tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
dgmjr committed Nov 23, 2023
1 parent 767381a commit f4ff5cf
Show file tree
Hide file tree
Showing 13 changed files with 238 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Abstractions
2 changes: 1 addition & 1 deletion Enumerations
2 changes: 1 addition & 1 deletion Extensions
2 changes: 1 addition & 1 deletion Microsoft.Net.Global.Json
2 changes: 1 addition & 1 deletion Primitives
Submodule Primitives updated 60 files
+26 −0 .vscode/launch.json
+41 −0 .vscode/tasks.json
+9 −0 All/Dgmjr.Primitives.All.csproj
+70 −0 All/Dgmjr.Primitives.All.sln
+27 −0 All/README.md
+4 −4 Dgmjr.Primitives.Sln.csproj
+31 −72 Dgmjr.Primitives.Sln.sln
+16 −0 EntityFrameworkCore/Constants.cs
+22 −0 EntityFrameworkCore/Dgmjr.Primitives.EntityFrameworkCore.csproj
+11 −0 EntityFrameworkCore/Dgmjr.Primitives.EntityFrameworkCore.props
+56 −0 EntityFrameworkCore/Dgmjr.Primitives.EntityFrameworkCore.sln
+126 −0 EntityFrameworkCore/EmailAddressEfCoreExtensions.cs
+63 −0 EntityFrameworkCore/Int24EfCoreExtensions.cs
+36 −0 EntityFrameworkCore/IriEfCoreExtensions.cs
+35 −0 EntityFrameworkCore/LICENSE.md
+97 −0 EntityFrameworkCore/ObjectIdEfCoreExtensions.cs
+101 −0 EntityFrameworkCore/PhoneNumberEfCoreExtensions.cs
+27 −0 EntityFrameworkCore/README.md
+4 −0 EntityFrameworkCore/RegexValueObjectEfCoreConverter.cs
+4 −0 EntityFrameworkCore/Resources/ufn_IsUri.sql
+8 −0 EntityFrameworkCore/Resources/ufn_IsUrl.sql
+1 −0 EntityFrameworkCore/Resources/ufn_IsUrn.sql
+16 −0 EntityFrameworkCore/Resources/ufn_IsValidEmailAddress.sql
+5 −0 EntityFrameworkCore/Resources/ufn_IsValidObjectId.sql
+12 −0 EntityFrameworkCore/Resources/ufn_IsValidPhoneNumber.sql
+89 −0 EntityFrameworkCore/UriEfCoreExtensions.cs
+80 −0 EntityFrameworkCore/UrlEfCoreExtensions.cs
+94 −0 EntityFrameworkCore/UrnEfCoreExtensions.cs
+36 −0 EntityFrameworkCore/XriEfCoreExtensions.cs
+2 −3 README.md
+1 −1 Tests/Dgmjr.Primitives.Tests.csproj
+13 −13 Tests/Dgmjr.Primitives.Tests.sln
+68 −71 Tests/DurationTests.cs
+3 −4 Tests/PrimitivesTests.cs
+1 −1 src/Abstractions/IHaveAuri.cs
+84 −0 src/Abstractions/IRegexValueObject.cs
+3 −37 src/Abstractions/IResourceIdentifier.cs
+20 −0 src/Abstractions/IResourceIdentifierWithAuthorityHostPortQueryAndFragment.cs
+19 −0 src/Abstractions/IResourceIdentifierWithQueryAndFragment.cs
+3 −99 src/Abstractions/IStringWithRegexValueObject.cs
+6 −0 src/Constants.cs
+6 −0 src/DateAndTimeonly.cs
+15 −6 src/Dgmjr.Primitives.csproj
+4 −16 src/Dgmjr.Primitives.props
+24 −55 src/EmailAddress.cs
+24 −60 src/Int24.cs
+109 −37 src/ObjectId.cs
+11 −24 src/OpenApiRegistrations.cs
+28 −39 src/PhoneNumber.cs
+1 −29 src/UInt24.cs
+0 −49 src/Validation.cs
+5 −6 src/YearMonthDuration.cs
+0 −17 src/YesNoIdc.cs
+0 −47 src/YesNoIdcEnums.cs
+31 −38 src/iri.cs
+28 −47 src/uri.cs
+24 −38 src/url.cs
+30 −46 src/urn.cs
+26 −39 src/xri.cs
+23 −27 src/xsduration.cs
10 changes: 10 additions & 0 deletions Tuples/Dgmjr.Tuples.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.1;net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dgmjr.Primitives" />
<PackageReference Include="Dgmjr.System.Extensions" Condition="'$(TargetFramework)' != 'netstandard2.0'"/>
<PackageReference Remove="Dgmjr.System.Extensions" Condition="'$(TargetFramework)' == 'netstandard2.0'"/>
</ItemGroup>
</Project>
42 changes: 42 additions & 0 deletions Tuples/Dgmjr.Tuples.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Microsoft Visual Studio Solution File, Format Version 12.00
#
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}"
ProjectSection(SolutionItems) = preProject
..\..\..\Directory.Build.props = ..\..\..\Directory.Build.props
..\..\..\Directory.Build.targets = ..\..\..\Directory.Build.targets
..\..\..\global.json = ..\..\..\global.json
..\..\..\Packages\Versions.Local.props = ..\..\..\Packages\Versions.Local.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Tuples", "Dgmjr.Tuples.csproj", "{444A4715-9085-4B94-9CEA-60F2125738D6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Local|Any CPU = Local|Any CPU
Debug|Any CPU = Debug|Any CPU
Testing|Any CPU = Testing|Any CPU
Staging|Any CPU = Staging|Any CPU
Production|Any CPU = Production|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{444A4715-9085-4B94-9CEA-60F2125738D6}.Local|Any CPU.ActiveCfg = Local|Any CPU
{444A4715-9085-4B94-9CEA-60F2125738D6}.Local|Any CPU.Build.0 = Local|Any CPU
{444A4715-9085-4B94-9CEA-60F2125738D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{444A4715-9085-4B94-9CEA-60F2125738D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{444A4715-9085-4B94-9CEA-60F2125738D6}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{444A4715-9085-4B94-9CEA-60F2125738D6}.Testing|Any CPU.Build.0 = Testing|Any CPU
{444A4715-9085-4B94-9CEA-60F2125738D6}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{444A4715-9085-4B94-9CEA-60F2125738D6}.Staging|Any CPU.Build.0 = Staging|Any CPU
{444A4715-9085-4B94-9CEA-60F2125738D6}.Production|Any CPU.ActiveCfg = Local|Any CPU
{444A4715-9085-4B94-9CEA-60F2125738D6}.Production|Any CPU.Build.0 = Local|Any CPU
{444A4715-9085-4B94-9CEA-60F2125738D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{444A4715-9085-4B94-9CEA-60F2125738D6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E15BF735-2E1E-4DFF-8028-7732CC4D2DB9}
EndGlobalSection
EndGlobal
27 changes: 27 additions & 0 deletions Tuples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title:
lastmod: 2023-40-04T12:40:28.5966-04:00Z
date: 2023-40-04T12:40:28.5968-04:00Z
license: MIT
slug: Dgmjr.Tuples-readme
version:
authors:
- dgmjr;
description: Dgmjr.Tuples Readme #TODO: write description for Dgmjr.Tuples Readme
keywords:
- Dgmjr.Tuples
- dgmjr
- dgmjr-io
type: readme
---
# Dgmjr.Tuples Readme
<!-- TODO: Write the contents of the Dgmjr.Tuples Readme file -->
## Package Description
## Getting Started
## Prerequisites
## Installation
## Usage
## Contributing
## Versioning
Built from [commit on branch at ]
(/tree/)
74 changes: 74 additions & 0 deletions Tuples/UriDescriptionTuple.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using System.Security.AccessControl;
using System;
using System.Collections.Generic;

namespace Dgmjr.Tuples;

/// <summary>
/// The uri description tuple.
/// </summary>
public abstract class UriDescriptionTuple : UriStringTuple
{
/// <summary>
/// Gets the description.
/// </summary>
public virtual string? Description => Item2;

/// <summary>
/// Initializes a new instance of the <see cref="T:Dgmjr.Tuples.UriDescriptionTuple" />
/// class.
/// </summary>
/// <param name="uri">The uri.</param>
/// <param name="description">The description.</param>
protected UriDescriptionTuple(uri uri, string? description = null)
: base(uri, description) { }

/// <summary>
/// Initializes a new instance of the <see cref="T:Dgmjr.Tuples.UriDescriptionTuple" />
/// class.
/// </summary>
/// <param name="uri">The uri.</param>
/// <param name="description">The description.</param>
protected UriDescriptionTuple(Uri? uri, string? description = null)
: base(System.uri.From(uri), description) { }

// /// <summary>
// /// Initializes a new instance of the <see cref="T:Dgmjr.Tuples.UriDescriptionTuple" />
// /// class.
// /// </summary>
// /// <param name="uri">The uri.</param>
// /// <param name="description">The description.</param>
// protected UriDescriptionTuple(string uri, string? description = null)
// : this(TryCreateUriExtensions.ToUri(uri), description) { }

protected UriDescriptionTuple((uri, string?)? tuple = null)
: base((uri)(tuple?.Item1), tuple?.Item2) { }

protected UriDescriptionTuple((string?, string?)? tuple = null)
: base(tuple?.Item1, tuple?.Item2) { }

public static implicit operator string?(UriDescriptionTuple tuple)
{
return tuple.Uri;
}

public static implicit operator uri(UriDescriptionTuple tuple)
{
return tuple.Uri;
}

public override bool Equals(object? obj)
{
return obj is UriDescriptionTuple uriDescriptionTuple
&& base.Equals(obj)
&& EqualityComparer<uri>.Default.Equals(base.Item1, uriDescriptionTuple.Item1)
&& base.Item2 == uriDescriptionTuple.Item2
&& EqualityComparer<uri>.Default.Equals(base.Uri, uriDescriptionTuple.Uri)
&& Description == uriDescriptionTuple.Description;
}

public override int GetHashCode()
{
return System.HashCode.Combine(base.Uri, Description);
}
}
78 changes: 78 additions & 0 deletions Tuples/UriStringTuple.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using System.Security.AccessControl;
using System;

namespace Dgmjr.Tuples;

/// <summary>
/// The uri string tuple.
/// </summary>
public abstract class UriStringTuple : Tuple<uri, string?>
{
/// <summary>
/// Gets the uri.
/// </summary>
public uri Uri => base.Item1;

/// <summary>
/// Initializes a new instance of the <see cref="T:Dgmjr.Tuples.UriStringTuple" /> class.
/// </summary>
/// <param name="uri">The uri.</param>
/// <param name="value">The value.</param>
protected UriStringTuple(uri uri, string? value)
: base(uri, value) { }

// /// <summary>
// /// Initializes a new instance of the <see cref="T:Dgmjr.Tuples.UriStringTuple" /> class.
// /// </summary>
// /// <param name="uri">The uri.</param>
// /// <param name="value">The value.</param>
// protected UriStringTuple(Uri uri, string? value = null)
// : this((System.uri.From(uri), value))
// {
// uri item;
// if (uri is not null)
// {
// string text = uri.ToString();
// item = ((text != null) ? TryCreateUriExtensions.CreateUri(text, false) : null);
// }
// }

// /// <summary>
// /// Initializes a new instance of the <see cref="T:Dgmjr.Tuples.UriStringTuple" /> class.
// /// </summary>
// /// <param name="uri">The uri.</param>
// /// <param name="value">The value.</param>
// protected UriStringTuple(string? uri, string? value)
// : this((uri is not null) ? TryCreateUriExtensions.ToUri(uri) : null as uri?, value) { }

/// <summary>
/// Initializes a new instance of the <see cref="T:Dgmjr.Tuples.UriStringTuple" /> class.
/// </summary>
/// <param name="tuple">The tuple.</param>
protected UriStringTuple(UriStringTuple? tuple = null)
: this((uri)(tuple?.Item1), tuple?.Item2) { }

protected UriStringTuple((uri, string?)? tuple = null)
: this((uri)(tuple?.Item1), tuple?.Item2) { }

protected UriStringTuple((string?, string?)? tuple = null)
: this(tuple?.Item1, tuple?.Item2) { }

/// <summary>
/// Initializes a new instance of the <see cref="T:Dgmjr.Tuples.UriStringTuple" /> class.
/// </summary>
protected UriStringTuple()
: this((uri)null, (string?)null) { }

public override bool Equals(object? obj)
{
return obj is UriStringTuple uriStringTuple
&& Uri == uriStringTuple.Uri
&& base.Item2 == uriStringTuple.Item2;
}

public override int GetHashCode()
{
return System.HashCode.Combine(Uri, base.Item2);
}
}
1 change: 1 addition & 0 deletions Tuples/uri.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[assembly: TypeForwardedTo(typeof(System.uri))]

0 comments on commit f4ff5cf

Please sign in to comment.