Skip to content

Commit 83dbd46

Browse files
committed
.
0 parents  commit 83dbd46

File tree

115 files changed

+3539
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+3539
-0
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_size = 4
6+
indent_style = space
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* text=auto
2+
*.cs diff=csharp

.github/workflows/publish.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: publish
2+
on:
3+
push:
4+
branches: [main]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v5
11+
12+
- name: DotNet Setup
13+
uses: actions/setup-dotnet@v5
14+
with:
15+
dotnet-version: "9.x.x"
16+
env:
17+
NUGET_PACKAGES: ${{ runner.temp }}/nuget/packages
18+
19+
- name: DotNet Pack
20+
run: find ./source -name '*.csproj' -exec dotnet pack {} --configuration Release --output packages \;
21+
22+
- name: DotNet NuGet Delete
23+
run: curl -s https://azuresearch-usnc.nuget.org/query?q=owner:rafaelfgx | jq -r '.data[] | "dotnet nuget delete \(.id) \(.version) --non-interactive --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}"' | xargs -I {} bash -c "{}"
24+
25+
- name: DotNet NuGet Push
26+
run: dotnet nuget push "packages/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate --no-symbols

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
*.bat
2+
*.dll
3+
*.exe
4+
*.lib
5+
*.log
6+
*.pdb
7+
*.ps1
8+
*.suo
9+
*.tmp
10+
*.user
11+
*.userprefs
12+
*.vspx
13+
.vs
14+
[Bb]in
15+
[Dd]ebug
16+
[Ll]og
17+
[Oo]bj
18+
[Rr]elease
19+
[Rr]eleases
20+
[Tt]est[Rr]esults

license.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2+
3+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
4+
5+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

readme.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# DotNetCore
2+
3+
![](https://github.com/rafaelfgx/DotNetCore/actions/workflows/publish.yaml/badge.svg)
4+
5+
.NET Nuget Packages.
6+
7+
https://www.nuget.org/profiles/rafaelfgx
8+
9+
## Documentation
10+
11+
[AspNetCore](https://github.com/rafaelfgx/DotNetCore/tree/main/source/AspNetCore)
12+
13+
[Domain](https://github.com/rafaelfgx/DotNetCore/tree/main/source/Domain)
14+
15+
[EntityFrameworkCore](https://github.com/rafaelfgx/DotNetCore/tree/main/source/EntityFrameworkCore)
16+
17+
[Extensions](https://github.com/rafaelfgx/DotNetCore/tree/main/source/Extensions)
18+
19+
[IoC](https://github.com/rafaelfgx/DotNetCore/tree/main/source/IoC)
20+
21+
[Logging](https://github.com/rafaelfgx/DotNetCore/tree/main/source/Logging)
22+
23+
[Mapping](https://github.com/rafaelfgx/DotNetCore/tree/main/source/Mapping)
24+
25+
[Mediator](https://github.com/rafaelfgx/DotNetCore/tree/main/source/Mediator)
26+
27+
[MongoDB](https://github.com/rafaelfgx/DotNetCore/tree/main/source/MongoDB)
28+
29+
[Objects](https://github.com/rafaelfgx/DotNetCore/tree/main/source/Objects)
30+
31+
[RabbitMQ](https://github.com/rafaelfgx/DotNetCore/tree/main/source/RabbitMQ)
32+
33+
[Repositories](https://github.com/rafaelfgx/DotNetCore/tree/main/source/Repositories)
34+
35+
[Results](https://github.com/rafaelfgx/DotNetCore/tree/main/source/Results)
36+
37+
[Security](https://github.com/rafaelfgx/DotNetCore/tree/main/source/Security)
38+
39+
[Services](https://github.com/rafaelfgx/DotNetCore/tree/main/source/Services)
40+
41+
[Validation](https://github.com/rafaelfgx/DotNetCore/tree/main/source/Validation)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Microsoft.AspNetCore.Authorization;
2+
3+
namespace DotNetCore.AspNetCore;
4+
5+
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
6+
public sealed class EnumAuthorizeAttribute : AuthorizeAttribute
7+
{
8+
public EnumAuthorizeAttribute(params object[] roles) => Roles = string.Join(",", roles.Select(role => Enum.GetName(role.GetType(), role)));
9+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<AssemblyName>DotNetCore.AspNetCore</AssemblyName>
4+
<Description>DotNetCore.AspNetCore</Description>
5+
<PackageId>DotNetCore.AspNetCore</PackageId>
6+
<PackageProjectUrl>https://github.com/rafaelfgx/DotNetCore/tree/main/source/AspNetCore</PackageProjectUrl>
7+
<PackageTags>AspNetCore, Attribute, Attributes, IApplicationBuilder, ApplicationBuilder, IHostBuilder, HostBuilder, HttpRequest, IServiceCollection, ServiceCollection, Result, Results, IActionResult, ActionResult</PackageTags>
8+
<Title>DotNetCore.AspNetCore</Title>
9+
</PropertyGroup>
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
12+
<PackageReference Include="Swashbuckle.AspNetCore" />
13+
</ItemGroup>
14+
<ItemGroup>
15+
<ProjectReference Include="..\Objects\DotNetCore.Objects.csproj" />
16+
<ProjectReference Include="..\Results\DotNetCore.Results.csproj" />
17+
</ItemGroup>
18+
</Project>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Microsoft.AspNetCore.Builder;
2+
using Microsoft.AspNetCore.Hosting;
3+
using Microsoft.Extensions.DependencyInjection;
4+
using Microsoft.Extensions.Hosting;
5+
6+
namespace DotNetCore.AspNetCore;
7+
8+
public static class ApplicationBuilderExtensions
9+
{
10+
extension(IApplicationBuilder application)
11+
{
12+
public void UseCorsAllowAny() => application.UseCors("AllowAny");
13+
14+
public void UseException()
15+
{
16+
var environment = application.ApplicationServices.GetRequiredService<IWebHostEnvironment>();
17+
18+
if (environment.IsDevelopment()) application.UseDeveloperExceptionPage();
19+
}
20+
21+
public void UseLocalization(params string[] cultures) => application.UseRequestLocalization(options => options.AddSupportedCultures(cultures).AddSupportedUICultures(cultures).SetDefaultCulture(cultures.First()));
22+
}
23+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using DotNetCore.Objects;
2+
using Microsoft.AspNetCore.Mvc;
3+
using Microsoft.AspNetCore.StaticFiles;
4+
5+
namespace DotNetCore.AspNetCore;
6+
7+
public static class BinaryFileExtensions
8+
{
9+
public static IActionResult FileResult(this Task<BinaryFile> binaryFile)
10+
{
11+
if (binaryFile is null) return new NotFoundResult();
12+
13+
var file = binaryFile.Result;
14+
15+
if (file is null) return new NotFoundResult();
16+
17+
new FileExtensionContentTypeProvider().TryGetContentType(file.ContentType, out var contentType);
18+
19+
return contentType is null ? new NotFoundResult() : new FileContentResult(file.Bytes, contentType) { FileDownloadName = file.Name };
20+
}
21+
}

0 commit comments

Comments
 (0)