ajour
This commit is contained in:
parent
1f8d75a096
commit
f5dbaa237b
14 changed files with 299 additions and 267 deletions
|
@ -4,7 +4,7 @@
|
|||
// Created : 27-08-2016
|
||||
//
|
||||
// Last Modified By : Frede H.
|
||||
// Last Modified On : 2020-08-30
|
||||
// Last Modified On : 2021-02-24
|
||||
// ***********************************************************************
|
||||
// <copyright file="ExtensionsEx.cs" company="FCS">
|
||||
// Copyright © FCS 2015-2020
|
||||
|
@ -18,12 +18,12 @@ using System.Collections.Generic;
|
|||
namespace FCS.Lib
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ExtensionsEx.
|
||||
/// Class ExtensionsEx.
|
||||
/// </summary>
|
||||
public static class ExtensionsEx
|
||||
{
|
||||
/// <summary>
|
||||
/// ForEach loop
|
||||
/// ForEach loop
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="items">The items.</param>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
|
@ -33,6 +33,12 @@
|
|||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>FCS.Lib.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
@ -47,7 +53,7 @@
|
|||
<Compile Include="ExtensionsEx.cs" />
|
||||
<Compile Include="Generators.cs" />
|
||||
<Compile Include="IRepository.cs" />
|
||||
<Compile Include="IRepositoryAsync.cs" />
|
||||
<Compile Include="IAsyncReadonlyRepo.cs" />
|
||||
<Compile Include="IRepositoryEx.cs" />
|
||||
<Compile Include="Mogrifiers.cs" />
|
||||
<Compile Include="StringOptions.cs" />
|
||||
|
@ -58,7 +64,9 @@
|
|||
</Compile>
|
||||
<Compile Include="Squid.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<None Include="FCS.Lib.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include=".gitignore" />
|
||||
<Content Include="Properties\AssemblyInfo.tt">
|
||||
|
|
2
FCS.Lib.csproj.DotSettings
Normal file
2
FCS.Lib.csproj.DotSettings
Normal file
|
@ -0,0 +1,2 @@
|
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp90</s:String></wpf:ResourceDictionary>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
BIN
FCS.Lib.pfx
Normal file
BIN
FCS.Lib.pfx
Normal file
Binary file not shown.
|
@ -4,7 +4,7 @@
|
|||
// Created : 2020-07-01
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 2020-09-11
|
||||
// Last Modified On : 2021-02-24
|
||||
// ***********************************************************************
|
||||
// <copyright file="Generators.cs" company="Frede Hundewadt">
|
||||
// Copyright © FCS 2015-2020
|
||||
|
@ -20,13 +20,13 @@ using System.Security.Cryptography;
|
|||
namespace FCS.Lib
|
||||
{
|
||||
/// <summary>
|
||||
/// Class Generators
|
||||
/// <remarks>generates varioous kinds of random strings. </remarks>
|
||||
/// Class Generators
|
||||
/// <remarks>generates varioous kinds of random strings. </remarks>
|
||||
/// </summary>
|
||||
public static class Generators
|
||||
{
|
||||
/// <summary>
|
||||
/// Shorts the URL generator.
|
||||
/// Shorts the URL generator.
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string ShortUrlGenerator()
|
||||
|
@ -35,11 +35,11 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Randoms the string.
|
||||
/// Randoms the string.
|
||||
/// </summary>
|
||||
/// <remarks>derived from https://sourceforge.net/projects/shorturl-dotnet/ </remarks>
|
||||
/// <param name="length">The lengt h.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
/// <remarks>derived from https://sourceforge.net/projects/shorturl-dotnet/</remarks>
|
||||
public static string ShortUrlGenerator(int length)
|
||||
{
|
||||
const string charsLower = "cdfghjkmnpqrstvwxyz";
|
||||
|
@ -161,6 +161,11 @@ namespace FCS.Lib
|
|||
return new string(shortUrl);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the username.
|
||||
/// </summary>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string GenerateUsername(StringOptions options = null)
|
||||
{
|
||||
options ??= new StringOptions
|
||||
|
@ -176,6 +181,11 @@ namespace FCS.Lib
|
|||
return GenerateRandomString(options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the password.
|
||||
/// </summary>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string GeneratePassword(StringOptions options = null)
|
||||
{
|
||||
options ??= new StringOptions
|
||||
|
@ -191,6 +201,11 @@ namespace FCS.Lib
|
|||
return GenerateRandomString(options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the random text.
|
||||
/// </summary>
|
||||
/// <param name="length">The length.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string GenerateRandomText(int length)
|
||||
{
|
||||
const string consonants = "bdfghjklmnprstvyBDFGHJKLMNPRSTVY";
|
||||
|
@ -210,7 +225,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the random password.
|
||||
/// Generates the random password.
|
||||
/// </summary>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
|
@ -268,10 +283,10 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Randoms the seed.
|
||||
/// Randoms the seed.
|
||||
/// </summary>
|
||||
/// <remarks>derived from https://sourceforge.net/projects/shorturl-dotnet/ </remarks>
|
||||
/// <returns>Random.</returns>
|
||||
/// <remarks>derived from https://sourceforge.net/projects/shorturl-dotnet/</remarks>
|
||||
public static Random RandomSeed()
|
||||
{
|
||||
// As the default randomizer is based on the current time
|
||||
|
|
84
IAsyncReadonlyRepo.cs
Normal file
84
IAsyncReadonlyRepo.cs
Normal file
|
@ -0,0 +1,84 @@
|
|||
// ***********************************************************************
|
||||
// Assembly : FCS.Lib
|
||||
// Author : FH
|
||||
// Created : 03-10-2015
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 2021-03-27
|
||||
// ***********************************************************************
|
||||
// <copyright file="IRepositoryAsync.cs" company="FCS">
|
||||
// Copyright © FCS 2015-2020
|
||||
// </copyright>
|
||||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FCS.Lib
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IRepositoryAsync
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity">The type of the t entity.</typeparam>
|
||||
public interface IAsyncReadonlyRepo<TEntity> where TEntity : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Alls this instance.
|
||||
/// </summary>
|
||||
/// <returns>IQueryable<TEntity>.</returns>
|
||||
IQueryable<TEntity> All();
|
||||
|
||||
/// <summary>
|
||||
/// Alls the asynchronous.
|
||||
/// </summary>
|
||||
/// <param name="predicate">The predicate.</param>
|
||||
/// <returns>Task<IList<TEntity>>.</returns>
|
||||
Task<IList<TEntity>> AllAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Anies the asynchronous.
|
||||
/// </summary>
|
||||
/// <param name="predicate">The predicate.</param>
|
||||
/// <returns>Task<System.Boolean>.</returns>
|
||||
Task<bool> AnyAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Finds the asynchronous.
|
||||
/// </summary>
|
||||
/// <param name="predicate">The predicate.</param>
|
||||
/// <returns>Task<TEntity>.</returns>
|
||||
Task<TEntity> FindAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Firsts the asynchronous.
|
||||
/// </summary>
|
||||
/// <param name="predicate">The predicate.</param>
|
||||
/// <returns>Task<TEntity>.</returns>
|
||||
Task<TEntity> FirstAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Firsts the or default asynchronous.
|
||||
/// </summary>
|
||||
/// <param name="predicate">The predicate.</param>
|
||||
/// <returns>Task<TEntity>.</returns>
|
||||
Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Anies the specified predicate.
|
||||
/// </summary>
|
||||
/// <param name="predicate">The predicate.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
bool Any(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the by identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier.</param>
|
||||
/// <returns>TEntity.</returns>
|
||||
TEntity GetById(string id);
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
// Created : 05-13-2020
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 2020-08-30
|
||||
// Last Modified On : 2021-02-24
|
||||
// ***********************************************************************
|
||||
// <copyright file="IRepository.cs" company="FCS">
|
||||
// Copyright © FCS 2015-2020
|
||||
|
@ -15,33 +15,33 @@
|
|||
namespace FCS.Lib
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IRepository
|
||||
/// Interface IRepository
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="TKey">The type of the TKey.</typeparam>
|
||||
public interface IRepository<T, in TKey> where T : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the specified identifier.
|
||||
/// Gets the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier.</param>
|
||||
/// <returns>T.</returns>
|
||||
T GetById(TKey id);
|
||||
|
||||
/// <summary>
|
||||
/// Creates the specified entity.
|
||||
/// Creates the specified entity.
|
||||
/// </summary>
|
||||
/// <param name="entity">The entity.</param>
|
||||
void Create(T entity);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the specified entity.
|
||||
/// Updates the specified entity.
|
||||
/// </summary>
|
||||
/// <param name="entity">The entity.</param>
|
||||
void Update(T entity);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified identifier.
|
||||
/// Deletes the specified identifier.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier.</param>
|
||||
void Delete(TKey id);
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
// ***********************************************************************
|
||||
// Assembly : FCS.Lib
|
||||
// Author : FH
|
||||
// Created : 03-10-2015
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 2020-08-30
|
||||
// ***********************************************************************
|
||||
// <copyright file="IRepositoryAsync.cs" company="FCS">
|
||||
// Copyright © FCS 2015-2020
|
||||
// </copyright>
|
||||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FCS.Lib
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IRepositoryAsyncEx
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity">The type of the t entity</typeparam>
|
||||
public interface IRepositoryAsync<TEntity> where TEntity : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all entities asynchronous
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>Task<System.Boolean></returns>
|
||||
Task<bool> AllAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Get all entities synchronous
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>Task<System.Boolean></returns>
|
||||
Task<bool> AnyAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Find matching entity asynchronous
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>Task<TEntity></returns>
|
||||
Task<TEntity> FindAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Find first matching entity asynchronous
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>Task<TEntity></returns>
|
||||
Task<TEntity> FirstAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Get first entity matching query or default entity asynchronous
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>Task<TEntity></returns>
|
||||
Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Add an entity
|
||||
/// </summary>
|
||||
/// <param name="entity">The entity.</param>
|
||||
void Add(TEntity entity);
|
||||
|
||||
/// <summary>
|
||||
/// Attach the entity
|
||||
/// </summary>
|
||||
/// <param name="entity">The entity.</param>
|
||||
void Attach(TEntity entity);
|
||||
|
||||
/// <summary>
|
||||
/// Delete the entity
|
||||
/// </summary>
|
||||
/// <param name="entity">The entity.</param>
|
||||
void Delete(TEntity entity);
|
||||
|
||||
/// <summary>
|
||||
/// Anies the specified predicate.
|
||||
/// </summary>
|
||||
/// <param name="predicate">The predicate.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
bool Any(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Get all entities
|
||||
/// </summary>
|
||||
/// <returns>IQueryable<TEntity></returns>
|
||||
IQueryable<TEntity> All();
|
||||
|
||||
/// <summary>
|
||||
/// Find all matching entities matching query
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>IQueryable<TEntity></returns>
|
||||
IQueryable<TEntity> Find(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Find first entity matching query
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>TEntity</returns>
|
||||
TEntity First(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Find first matching entity or default entity
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>TEntity</returns>
|
||||
TEntity FirstOrDefault(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Get entity by id
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier.</param>
|
||||
/// <returns>TEntity</returns>
|
||||
TEntity GetById(string id);
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
// Created : 03-10-2015
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 2020-08-30
|
||||
// Last Modified On : 2021-02-24
|
||||
// ***********************************************************************
|
||||
// <copyright file="IRepositoryEx.cs" company="FCS">
|
||||
// Copyright © FCS 2015-2020
|
||||
|
@ -20,100 +20,100 @@ using System.Threading.Tasks;
|
|||
namespace FCS.Lib
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IRepositoryEx
|
||||
/// Interface IRepositoryEx
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity">The type of the t entity</typeparam>
|
||||
public interface IRepositoryEx<TEntity> where TEntity : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Get all entities asynchronous
|
||||
/// Get all entities asynchronous
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>Task<System.Boolean></returns>
|
||||
Task<bool> AllAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Get all entities synchronous
|
||||
/// Get all entities synchronous
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>Task<System.Boolean></returns>
|
||||
Task<bool> AnyAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Find matching entity asynchronous
|
||||
/// Find matching entity asynchronous
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>Task<TEntity></returns>
|
||||
Task<TEntity> FindAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Find first matching entity asynchronous
|
||||
/// Find first matching entity asynchronous
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>Task<TEntity></returns>
|
||||
Task<TEntity> FirstAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Get first entity matching query or default entity asynchronous
|
||||
/// Get first entity matching query or default entity asynchronous
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>Task<TEntity></returns>
|
||||
Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Add an entity
|
||||
/// Add an entity
|
||||
/// </summary>
|
||||
/// <param name="entity">The entity.</param>
|
||||
void Add(TEntity entity);
|
||||
|
||||
/// <summary>
|
||||
/// Attach the entity
|
||||
/// Attach the entity
|
||||
/// </summary>
|
||||
/// <param name="entity">The entity.</param>
|
||||
void Attach(TEntity entity);
|
||||
|
||||
/// <summary>
|
||||
/// Delete the entity
|
||||
/// Delete the entity
|
||||
/// </summary>
|
||||
/// <param name="entity">The entity.</param>
|
||||
void Delete(TEntity entity);
|
||||
|
||||
/// <summary>
|
||||
/// Anies the specified predicate.
|
||||
/// Anies the specified predicate.
|
||||
/// </summary>
|
||||
/// <param name="predicate">The predicate.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
bool Any(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Get all entities
|
||||
/// Get all entities
|
||||
/// </summary>
|
||||
/// <returns>IQueryable<TEntity></returns>
|
||||
IQueryable<TEntity> All();
|
||||
|
||||
/// <summary>
|
||||
/// Find all matching entities matching query
|
||||
/// Find all matching entities matching query
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>IQueryable<TEntity></returns>
|
||||
IQueryable<TEntity> Find(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Find first entity matching query
|
||||
/// Find first entity matching query
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>TEntity</returns>
|
||||
TEntity First(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Find first matching entity or default entity
|
||||
/// Find first matching entity or default entity
|
||||
/// </summary>
|
||||
/// <param name="predicate">Predicate</param>
|
||||
/// <returns>TEntity</returns>
|
||||
TEntity FirstOrDefault(Expression<Func<TEntity, bool>> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Get entity by id
|
||||
/// Get entity by id
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier.</param>
|
||||
/// <returns>TEntity</returns>
|
||||
|
|
106
Mogrifiers.cs
106
Mogrifiers.cs
|
@ -4,7 +4,7 @@
|
|||
// Created : 27-08-2016
|
||||
//
|
||||
// Last Modified By : Frede H.
|
||||
// Last Modified On : 2020-08-30
|
||||
// Last Modified On : 2021-02-24
|
||||
// ***********************************************************************
|
||||
// <copyright file="Mogrifiers.cs" company="FCS">
|
||||
// Copyright © FCS 2015-2020
|
||||
|
@ -15,20 +15,21 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace FCS.Lib
|
||||
{
|
||||
/// <summary>
|
||||
/// Class Converters
|
||||
/// Class Converters
|
||||
/// </summary>
|
||||
public static class Mogrifiers
|
||||
{
|
||||
/// <summary>
|
||||
/// Reverse boolean
|
||||
/// Reverse boolean
|
||||
/// </summary>
|
||||
/// <param name="value">if set to <c>true</c> [value].</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
|
@ -38,7 +39,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Boolean to integer
|
||||
/// Boolean to integer
|
||||
/// </summary>
|
||||
/// <param name="value">if set to <c>true</c> [value].</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
|
@ -48,7 +49,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Boolean to string
|
||||
/// Boolean to string
|
||||
/// </summary>
|
||||
/// <param name="value">if set to <c>true</c> [value].</param>
|
||||
/// <returns>System.String.</returns>
|
||||
|
@ -59,7 +60,7 @@ namespace FCS.Lib
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// Enum to integer
|
||||
/// Enum to integer
|
||||
/// </summary>
|
||||
/// <param name="enumeration">The enumeration.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
|
@ -70,7 +71,7 @@ namespace FCS.Lib
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// Enum to string.
|
||||
/// Enum to string.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
|
@ -79,18 +80,23 @@ namespace FCS.Lib
|
|||
return value == null ? string.Empty : value.ToString();
|
||||
}
|
||||
|
||||
public static IEnumerable<T> GetEnumList<T>()
|
||||
{
|
||||
return (T[])Enum.GetValues(typeof(T));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Integer to boolean.
|
||||
/// Integer to boolean.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
public static bool IntToBool(int value)
|
||||
{
|
||||
return value == 1;
|
||||
return value > 0 || value < 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Integer to enum.
|
||||
/// Integer to enum.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="value">The value.</param>
|
||||
|
@ -101,7 +107,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Integer to letter.
|
||||
/// Integer to letter.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
|
@ -128,7 +134,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lists to string using semicolon(;)
|
||||
/// Lists to string using semicolon(;)
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="list">The list.</param>
|
||||
|
@ -139,7 +145,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lists to string userdefined delimiter
|
||||
/// Lists to string userdefined delimiter
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="list">The list.</param>
|
||||
|
@ -157,13 +163,22 @@ namespace FCS.Lib
|
|||
return empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pascals to lower.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string PascalToLower(string value)
|
||||
{
|
||||
var result = string.Join("-", Regex.Split(value, @"(?<!^)(?=[A-Z])").ToArray());
|
||||
return result.ToLower(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// String to bool.
|
||||
/// String to bool.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
||||
[SuppressMessage("Design", "CA1062:Validate arguments of public methods", Justification = "<Pending>")]
|
||||
public static bool StringToBool(string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
|
@ -187,7 +202,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// String to decimal.
|
||||
/// String to decimal.
|
||||
/// </summary>
|
||||
/// <param name="inString">The in string.</param>
|
||||
/// <returns>System.Nullable<System.Decimal>.</returns>
|
||||
|
@ -202,7 +217,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// String to enum.
|
||||
/// String to enum.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="value">The value.</param>
|
||||
|
@ -213,7 +228,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// String to list using semicolon(;).
|
||||
/// String to list using semicolon(;).
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="value">The value.</param>
|
||||
|
@ -224,16 +239,19 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// String to list userdefined delimiter.
|
||||
/// String to list userdefined delimiter.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="delimiter">The delimiter.</param>
|
||||
/// <returns>List<T>.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">value</exception>
|
||||
/// <exception cref="System.ArgumentNullException">delimiter</exception>
|
||||
/// <exception cref="ArgumentNullException">value</exception>
|
||||
/// <exception cref="ArgumentNullException">delimiter</exception>
|
||||
/// <exception cref="ArgumentNullException">value</exception>
|
||||
/// <exception cref="ArgumentNullException">delimiter</exception>
|
||||
/// <exception cref="ArgumentNullException">value</exception>
|
||||
/// <exception cref="ArgumentNullException">delimiter</exception>
|
||||
/// <exception cref="ArgumentNullException">value</exception>
|
||||
public static List<T> StringToList<T>(string value, string delimiter)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value)) throw new ArgumentNullException(nameof(value));
|
||||
|
@ -265,7 +283,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// String to stream using system default encoding.
|
||||
/// String to stream using system default encoding.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns>Stream.</returns>
|
||||
|
@ -276,7 +294,7 @@ namespace FCS.Lib
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// Strings to stream with userdefined encoding.
|
||||
/// Strings to stream with userdefined encoding.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="encoding">The encoding.</param>
|
||||
|
@ -287,7 +305,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns timestamp for current date-time object.
|
||||
/// Returns timestamp for current date-time object.
|
||||
/// </summary>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static long CurrentDateTimeToTimeStamp()
|
||||
|
@ -296,7 +314,25 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a DateTime object to timestamp
|
||||
/// Currents the date time to alpha.
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string CurrentDateTimeToAlpha()
|
||||
{
|
||||
var dt = DateTime.UtcNow.ToString("yy MM dd HH MM ss");
|
||||
var sb = new StringBuilder();
|
||||
var dts = dt.Split(' ');
|
||||
sb.Append((char) int.Parse(dts[0]) + 65);
|
||||
sb.Append((char) int.Parse(dts[1]) + 65);
|
||||
sb.Append((char) int.Parse(dts[2]) + 97);
|
||||
sb.Append((char) int.Parse(dts[3]) + 65);
|
||||
sb.Append((char) int.Parse(dts[4]) + 97);
|
||||
sb.Append((char) int.Parse(dts[5]) + 97);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a DateTime object to timestamp
|
||||
/// </summary>
|
||||
/// <param name="dateTime">The date time.</param>
|
||||
/// <returns>System.Int64.</returns>
|
||||
|
@ -304,16 +340,16 @@ namespace FCS.Lib
|
|||
{
|
||||
var bigDate = new DateTime(2038, 1, 19, 0, 0, 0, 0);
|
||||
var nixDate = new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
||||
|
||||
|
||||
if (dateTime >= bigDate)
|
||||
return Convert.ToUInt32((bigDate - nixDate).TotalSeconds) +
|
||||
Convert.ToUInt32((dateTime - bigDate).TotalSeconds);
|
||||
|
||||
return Convert.ToUInt32((dateTime - nixDate).TotalSeconds);
|
||||
return Convert.ToInt64((bigDate - nixDate).TotalSeconds) +
|
||||
Convert.ToInt64((dateTime - bigDate).TotalSeconds);
|
||||
|
||||
return Convert.ToInt64((dateTime - nixDate).TotalSeconds);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert timestamp to DataTime format
|
||||
/// Convert timestamp to DataTime format
|
||||
/// </summary>
|
||||
/// <param name="timeStamp">The time stamp.</param>
|
||||
/// <returns>DateTime.</returns>
|
||||
|
@ -324,7 +360,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert timespan to seconds
|
||||
/// Convert timespan to seconds
|
||||
/// </summary>
|
||||
/// <param name="timespan">The timespan.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
|
@ -334,7 +370,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts seconds to timespan
|
||||
/// Converts seconds to timespan
|
||||
/// </summary>
|
||||
/// <param name="seconds">The seconds.</param>
|
||||
/// <returns>TimeSpan.</returns>
|
||||
|
@ -344,7 +380,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts timespan to minutes
|
||||
/// Converts timespan to minutes
|
||||
/// </summary>
|
||||
/// <param name="timespan">The timespan.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
|
|
|
@ -16,5 +16,5 @@ using System.Runtime.InteropServices;
|
|||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("aaf08873-14e5-411d-8ec8-629782ac8f03")]
|
||||
|
||||
[assembly: AssemblyVersion("2.1.20289.1156")]
|
||||
[assembly: AssemblyFileVersion("2.1.20289.1156")]
|
||||
[assembly: AssemblyVersion("2.1.21308.1057")]
|
||||
[assembly: AssemblyFileVersion("2.1.21308.1057")]
|
124
Squid.cs
124
Squid.cs
|
@ -4,7 +4,7 @@
|
|||
// Created : 2020-07-01
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 2020-08-30
|
||||
// Last Modified On : 2021-02-24
|
||||
// ***********************************************************************
|
||||
// <copyright file="Squid.cs" company="Frede Hundewadt">
|
||||
// Copyright © FCS 2015-2020
|
||||
|
@ -18,42 +18,44 @@ using System.Diagnostics;
|
|||
namespace FCS.Lib
|
||||
{
|
||||
/// <summary>
|
||||
/// A wrapper for handling URL-safe Base64 encoded globally unique identifiers (GUID).
|
||||
/// A wrapper for handling URL-safe Base64 encoded globally unique identifiers (GUID).
|
||||
/// </summary>
|
||||
/// <remarks>Special characters are replaced (/, +) or removed (==).
|
||||
/// Derived from https:github.com/csharpvitamins/CSharpVitamins.ShortGuid</remarks>
|
||||
/// <remarks>
|
||||
/// Special characters are replaced (/, +) or removed (==).
|
||||
/// Derived from https:github.com/csharpvitamins/CSharpVitamins.ShortGuid
|
||||
/// </remarks>
|
||||
[DebuggerDisplay("{" + nameof(Value) + "}")]
|
||||
public readonly struct Squid : IEquatable<Squid>
|
||||
{
|
||||
/// <summary>
|
||||
/// A read-only object of the Squid struct.
|
||||
/// Value is guaranteed to be all zeroes.
|
||||
/// Equivalent to <see cref="Guid.Empty" />.
|
||||
/// A read-only object of the Squid struct.
|
||||
/// Value is guaranteed to be all zeroes.
|
||||
/// Equivalent to <see cref="Guid.Empty" />.
|
||||
/// </summary>
|
||||
public static readonly Squid Empty = new Squid(Guid.Empty);
|
||||
public static readonly Squid Empty = new(Guid.Empty);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Squid from a Squid encoded string.
|
||||
/// Creates a new Squid from a Squid encoded string.
|
||||
/// </summary>
|
||||
/// <param name="value">A valid Squid encodd string.</param>
|
||||
public Squid(string value)
|
||||
{
|
||||
Value = value;
|
||||
Guid = Decode(value);
|
||||
Guid = DecodeSquid(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Squid with the given <see cref="System.Guid" />.
|
||||
/// Creates a new Squid with the given <see cref="System.Guid" />.
|
||||
/// </summary>
|
||||
/// <param name="obj">A valid System.Guid object.</param>
|
||||
public Squid(Guid obj)
|
||||
{
|
||||
Value = Encode(obj);
|
||||
Value = EncodeGuid(obj);
|
||||
Guid = obj;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the underlying <see cref="System.Guid" /> for the encoded Squid.
|
||||
/// Gets the underlying <see cref="System.Guid" /> for the encoded Squid.
|
||||
/// </summary>
|
||||
/// <value>The unique identifier.</value>
|
||||
#pragma warning disable CA1720 // Identifier contains type name
|
||||
|
@ -61,14 +63,14 @@ namespace FCS.Lib
|
|||
#pragma warning restore CA1720 // Identifier contains type name
|
||||
|
||||
/// <summary>
|
||||
/// The encoded string value of the <see cref="Guid" />
|
||||
/// as an URL-safe Base64 string.
|
||||
/// The encoded string value of the <see cref="Guid" />
|
||||
/// as an URL-safe Base64 string.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public string Value { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the encoded URL-safe Base64 string.
|
||||
/// Returns the encoded URL-safe Base64 string.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="string" /> that represents this instance.</returns>
|
||||
public override string ToString()
|
||||
|
@ -77,8 +79,8 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value indicating whether this object and a specified object represent the same type and value.
|
||||
/// Compares for equality against other string, Guid and Squid types.
|
||||
/// Returns a value indicating whether this object and a specified object represent the same type and value.
|
||||
/// Compares for equality against other string, Guid and Squid types.
|
||||
/// </summary>
|
||||
/// <param name="obj">A Systerm.String, System.Guid or Squid object</param>
|
||||
/// <returns><c>true</c> if the specified <see cref="object" /> is equal to this instance; otherwise, <c>false</c>.</returns>
|
||||
|
@ -88,7 +90,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Equality comparison
|
||||
/// Equality comparison
|
||||
/// </summary>
|
||||
/// <param name="obj">A valid Squid object</param>
|
||||
/// <returns>A boolean indicating equality.</returns>
|
||||
|
@ -98,7 +100,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the hash code for the underlying <see cref="System.Guid" />.
|
||||
/// Returns the hash code for the underlying <see cref="System.Guid" />.
|
||||
/// </summary>
|
||||
/// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns>
|
||||
public override int GetHashCode()
|
||||
|
@ -110,35 +112,35 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialises a new object of the Squid using <see cref="Guid.NewGuid()" />.
|
||||
/// Initialises a new object of the Squid using <see cref="Guid.NewGuid()" />.
|
||||
/// </summary>
|
||||
/// <returns>New Squid object</returns>
|
||||
public static Squid NewGuid()
|
||||
{
|
||||
return new Squid(Guid.NewGuid());
|
||||
return new(Guid.NewGuid());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode string as a new Squid encoded string.
|
||||
/// The encoding is similar to Base64 with
|
||||
/// non-URL safe characters replaced, and padding removed.
|
||||
/// Encode string as a new Squid encoded string.
|
||||
/// The encoding is similar to Base64 with
|
||||
/// non-URL safe characters replaced, and padding removed.
|
||||
/// </summary>
|
||||
/// <param name="value">A valid <see cref="System.Guid" />.Tostring().</param>
|
||||
/// <returns>A 22 character URL-safe Base64 string.</returns>
|
||||
public static string Encode(string value)
|
||||
public static string EncodeString(string value)
|
||||
{
|
||||
var guid = new Guid(value);
|
||||
return Encode(guid);
|
||||
return EncodeGuid(guid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a <see cref="System.Guid" /> object to Squid.
|
||||
/// The encoding is similar to Base64 with
|
||||
/// non-URL safe characters replaced, and padding removed.
|
||||
/// Encode a <see cref="System.Guid" /> object to Squid.
|
||||
/// The encoding is similar to Base64 with
|
||||
/// non-URL safe characters replaced, and padding removed.
|
||||
/// </summary>
|
||||
/// <param name="obj">A valid <see cref="System.Guid" /> object.</param>
|
||||
/// <returns>A 22 character URL-safe Base64 string.</returns>
|
||||
public static string Encode(Guid obj)
|
||||
public static string EncodeGuid(Guid obj)
|
||||
{
|
||||
var encoded = Convert.ToBase64String(obj.ToByteArray());
|
||||
encoded = encoded
|
||||
|
@ -148,13 +150,13 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode Squid string to a <see cref="System.Guid" />.
|
||||
/// See also <seealso cref="TryDecode(string, out System.Guid)" /> or
|
||||
/// <seealso cref="TryParse(string, out System.Guid)" />.
|
||||
/// Decode Squid string to a <see cref="System.Guid" />.
|
||||
/// See also <seealso cref="TryDecode(string, out System.Guid)" /> or
|
||||
/// <seealso cref="TryParse(string, out System.Guid)" />.
|
||||
/// </summary>
|
||||
/// <param name="value">A valid Squid encoded string.</param>
|
||||
/// <returns>A new <see cref="System.Guid" /> object from the parsed string.</returns>
|
||||
public static Guid Decode(string value)
|
||||
public static Guid DecodeSquid(string value)
|
||||
{
|
||||
if (value == null) return Empty;
|
||||
value = value
|
||||
|
@ -166,7 +168,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Squid to Guid.
|
||||
/// Squid to Guid.
|
||||
/// </summary>
|
||||
/// <param name="obj">A valid Squid object.</param>
|
||||
/// <returns>System.Guid object.</returns>
|
||||
|
@ -176,7 +178,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// String to Squid.
|
||||
/// String to Squid.
|
||||
/// </summary>
|
||||
/// <param name="value">String value to convert</param>
|
||||
/// <returns>A Squid object.</returns>
|
||||
|
@ -188,7 +190,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decodes the given value to a <see cref="System.Guid" />.
|
||||
/// Decodes the given value to a <see cref="System.Guid" />.
|
||||
/// </summary>
|
||||
/// <param name="value">The Squid encoded string to decode.</param>
|
||||
/// <param name="obj">A new <see cref="System.Guid" /> object from the parsed string.</param>
|
||||
|
@ -198,7 +200,7 @@ namespace FCS.Lib
|
|||
try
|
||||
{
|
||||
// Decode as Squid
|
||||
obj = Decode(value);
|
||||
obj = DecodeSquid(value);
|
||||
return true;
|
||||
}
|
||||
#pragma warning disable CA1031 // Do not catch general exception types
|
||||
|
@ -212,8 +214,8 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to parse the given string value and
|
||||
/// outputs the <see cref="Squid" /> object.
|
||||
/// Tries to parse the given string value and
|
||||
/// outputs the <see cref="Squid" /> object.
|
||||
/// </summary>
|
||||
/// <param name="value">The Squid encoded string or string representation of a Guid.</param>
|
||||
/// <param name="obj">A new <see cref="Squid" /> object from the parsed string.</param>
|
||||
|
@ -239,8 +241,8 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to parse the string value and
|
||||
/// outputs the underlying <see cref="System.Guid" /> object.
|
||||
/// Tries to parse the string value and
|
||||
/// outputs the underlying <see cref="System.Guid" /> object.
|
||||
/// </summary>
|
||||
/// <param name="value">The Squid encoded string or string representation of a Guid.</param>
|
||||
/// <param name="obj">A new <see cref="System.Guid" /> object from the parsed string.</param>
|
||||
|
@ -262,8 +264,8 @@ namespace FCS.Lib
|
|||
#region Operators
|
||||
|
||||
/// <summary>
|
||||
/// Determines if both Squid objects have the same
|
||||
/// underlying <see cref="System.Guid" /> value.
|
||||
/// Determines if both Squid objects have the same
|
||||
/// underlying <see cref="System.Guid" /> value.
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
|
@ -274,8 +276,8 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if both objects have the same
|
||||
/// underlying <see cref="System.Guid" /> value.
|
||||
/// Determines if both objects have the same
|
||||
/// underlying <see cref="System.Guid" /> value.
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
|
@ -286,8 +288,8 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if both objects have the same
|
||||
/// underlying <see cref="System.Guid" /> value.
|
||||
/// Determines if both objects have the same
|
||||
/// underlying <see cref="System.Guid" /> value.
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
|
@ -298,8 +300,8 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if both Squid objects do not have the same
|
||||
/// underlying <see cref="System.Guid" /> value.
|
||||
/// Determines if both Squid objects do not have the same
|
||||
/// underlying <see cref="System.Guid" /> value.
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
|
@ -310,8 +312,8 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if both objects do not have the same
|
||||
/// underlying <see cref="System.Guid" /> value.
|
||||
/// Determines if both objects do not have the same
|
||||
/// underlying <see cref="System.Guid" /> value.
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
|
@ -322,8 +324,8 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if both objects do not have the same
|
||||
/// underlying <see cref="System.Guid" /> value.
|
||||
/// Determines if both objects do not have the same
|
||||
/// underlying <see cref="System.Guid" /> value.
|
||||
/// </summary>
|
||||
/// <param name="x">The x.</param>
|
||||
/// <param name="y">The y.</param>
|
||||
|
@ -334,8 +336,8 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implicitly converts the Squid to
|
||||
/// its string equivalent.
|
||||
/// Implicitly converts the Squid to
|
||||
/// its string equivalent.
|
||||
/// </summary>
|
||||
/// <param name="oSquid">The o squid.</param>
|
||||
/// <returns>The result of the conversion.</returns>
|
||||
|
@ -345,8 +347,8 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implicitly converts the Squid to
|
||||
/// its <see cref="System.Guid" /> equivalent.
|
||||
/// Implicitly converts the Squid to
|
||||
/// its <see cref="System.Guid" /> equivalent.
|
||||
/// </summary>
|
||||
/// <param name="oSquid">The o squid.</param>
|
||||
/// <returns>The result of the conversion.</returns>
|
||||
|
@ -356,7 +358,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implicitly converts the string to a Squid.
|
||||
/// Implicitly converts the string to a Squid.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns>The result of the conversion.</returns>
|
||||
|
@ -369,7 +371,7 @@ namespace FCS.Lib
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implicitly converts the <see cref="System.Guid" /> to a Squid.
|
||||
/// Implicitly converts the <see cref="System.Guid" /> to a Squid.
|
||||
/// </summary>
|
||||
/// <param name="oGuid">The o unique identifier.</param>
|
||||
/// <returns>The result of the conversion.</returns>
|
||||
|
|
|
@ -4,52 +4,59 @@
|
|||
// Created : 2020-09-09
|
||||
//
|
||||
// Last Modified By : FH
|
||||
// Last Modified On : 2020-08-30
|
||||
// Last Modified On : 2021-02-24
|
||||
// ***********************************************************************
|
||||
// <copyright file="StringOptions.cs" company="Frede Hundewadt">
|
||||
// Copyright © FCS 2015-2020
|
||||
// </copyright>
|
||||
// <summary></summary>
|
||||
// ***********************************************************************
|
||||
|
||||
namespace FCS.Lib
|
||||
{
|
||||
/// <summary>
|
||||
/// Class StringOptions.
|
||||
/// Class StringOptions.
|
||||
/// </summary>
|
||||
public class StringOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the length of the required.
|
||||
/// Gets or sets the length of the required.
|
||||
/// </summary>
|
||||
/// <value>The length of the required.</value>
|
||||
public int RequiredLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [require non letter or digit].
|
||||
/// Gets or sets a value indicating whether [require non letter or digit].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [require non letter or digit]; otherwise, <c>false</c>.</value>
|
||||
public bool RequireNonLetterOrDigit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [require digit].
|
||||
/// Gets or sets a value indicating whether [require digit].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [require digit]; otherwise, <c>false</c>.</value>
|
||||
public bool RequireDigit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [require lowercase].
|
||||
/// Gets or sets a value indicating whether [require lowercase].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [require lowercase]; otherwise, <c>false</c>.</value>
|
||||
public bool RequireLowercase { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [require uppercase].
|
||||
/// Gets or sets a value indicating whether [require uppercase].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [require uppercase]; otherwise, <c>false</c>.</value>
|
||||
public bool RequireUppercase { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the required unique chars.
|
||||
/// Gets or sets the required unique chars.
|
||||
/// </summary>
|
||||
/// <value>The required unique chars.</value>
|
||||
public int RequiredUniqueChars { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [require non alphanumeric].
|
||||
/// Gets or sets a value indicating whether [require non alphanumeric].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [require non alphanumeric]; otherwise, <c>false</c>.</value>
|
||||
public bool RequireNonAlphanumeric { get; set; }
|
||||
|
|
Loading…
Reference in a new issue