-
Notifications
You must be signed in to change notification settings - Fork 0
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 #7 from sj-distributor/clutter
Enhance infrastructure
- Loading branch information
Showing
22 changed files
with
303 additions
and
131 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,20 @@ | ||
# Wax | ||
|
||
[![.NET](https://github.com/sj-distributor/Wax/actions/workflows/dotnet.yml/badge.svg)](https://github.com/sj-distributor/Wax/actions/workflows/dotnet.yml) | ||
[![Nuget](https://img.shields.io/nuget/v/Wax.Template)](https://www.nuget.org/packages/Wax.Template) | ||
|
||
WilTechs Architecture Solution Template for .NET 6 | ||
|
||
## Getting Started | ||
|
||
Using dotnet cli template, install the template: | ||
|
||
``` | ||
dotnet new -i Wax.Template | ||
``` | ||
|
||
Run this command to create the solution: | ||
|
||
``` | ||
dotnet new wax -o ProjectName | ||
``` |
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
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
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,42 @@ | ||
namespace Wax.Core.Extensions; | ||
|
||
public static class TypeExtensions | ||
{ | ||
public static bool IsAssignableToGenericType(this Type givenType, Type genericType) | ||
{ | ||
var interfaceTypes = givenType.GetInterfaces(); | ||
|
||
if (interfaceTypes.Any(it => it.IsGenericType && it.GetGenericTypeDefinition() == genericType)) | ||
{ | ||
return true; | ||
} | ||
|
||
if (givenType.IsGenericType && givenType.GetGenericTypeDefinition() == genericType) | ||
return true; | ||
|
||
var baseType = givenType.BaseType; | ||
return baseType != null && IsAssignableToGenericType(baseType, genericType); | ||
} | ||
|
||
public static string GetGenericTypeName(this Type type) | ||
{ | ||
string typeName; | ||
|
||
if (type.IsGenericType) | ||
{ | ||
var genericTypes = string.Join(",", type.GetGenericArguments().Select(t => t.Name).ToArray()); | ||
typeName = $"{type.Name.Remove(type.Name.IndexOf('`'))}<{genericTypes}>"; | ||
} | ||
else | ||
{ | ||
typeName = type.Name; | ||
} | ||
|
||
return typeName; | ||
} | ||
|
||
public static string GetGenericTypeName(this object @object) | ||
{ | ||
return @object.GetType().GetGenericTypeName(); | ||
} | ||
} |
Oops, something went wrong.