c# – Organização dos métodos no Swagger (.NET)

Gostaria de saber se tem como organizar os métodos e os grupos no swagger.

Por exemplo, passar esse ultimo metodo GET para cima, somente para os métodos GET ficarem juntos e os PATCH também.
inserir a descrição da imagem aqui

O outro exemplo é com os grupos, passar esse grupo do customer para o topo:
inserir a descrição da imagem aqui

Espero que tenha ficado claro minha duvida, sei que é uma duvida bem boba, mas gostaria de deixar organizado do jeito que eu quero.

Obrigado desde ja!

c# – .Net Core MVC Controller inherits an interface: It this Fine or a Best Practice?

I had this base class that inherits from interface where all methods created where the same resource name, same method parameters in MVC controllers to be used. So I design that every time I add or changed the parent interface, it will then notify others in the code editor that something need to be implemented or has changed. I am asking if these are a good practice. So I decided to design my architecture like these:

The goal here is that MVC Controller Company1 and Company2 or any future controller addition as long they inherit BaseApiController can make a request to logic GetEmployeeContractual

MVC Controller for Company1

(Authorize)
(Route("api/(controller)"))
(ApiController)
public class Company1Controller : BaseApiController<CompanyController>
{
    private readonly IBusLogic _busLogic;
    public CompanyController (
        ILogger<CompanyController> logger,
        IBaseActionClass baseActionClass,
        BusLogic busLogic
        ) : base(logger, baseActionClass)
    {
        _busLogic = busLogic;
    }

    (HttpGet("GetEmployee"))
    public async Task<IEnumerable<SomeData>> GetEmployee((FromQuery) SomeDataParamData paramData,
        CancellationToken cancellationToken)
    {
        LogInfo(paramData, ControllerContext.ActionDescriptor.ActionName,
            ControllerContext.ActionDescriptor.ControllerName);

        return await _busLogic.GetEmployee(paramData, cancellationToken);
    }
}

MVC Controller for Company2

(Authorize)
(Route("api/(controller)"))
(ApiController)
public class Company2Controller : BaseApiController<CompanyController>
{
    private readonly IBusLogic _busLogic;
    public CompanyController (
        ILogger<CompanyController> logger,
        IBaseActionClass baseActionClass,
        BusLogic busLogic
        ) : base(logger, baseActionClass)
    {
        _busLogic = busLogic;
    }       
}

Base Api Controller

public abstract class BaseApiController<T> : LogBaseController<T>, IBaseActionClass where T : class
{
    private readonly IBaseActionClass _baseActionClass;
    private readonly string _controllerName = typeof(T).Name;

    protected BaseApiController(ILogger<T> logger, IBaseActionClass baseActionClass = null) :
        base(logger)
    {
        _baseActionClass = baseActionClass;
    }

    (HttpGet("GetEmployeeContractual"))
    public virtual async Task<IEnumerable<SomeData>> GetEmployeeContractual(
        (FromQuery) SomeParamData paramData,
        CancellationToken cancellationToken)
    {
        LogInfo(paramData, ControllerContext.ActionDescriptor.ActionName, _controllerName);
        return await _baseActionClass.GetEmployeeContractual(paramData, cancellationToken);
    }
}

Base Class

public class BaseActionClass : IBaseActionClass 
{
    private readonly IRepositoryDataService<SomeData> _repositoryDataService;

    public IBaseActionClass(IRepositoryDataService<SomeData> repositoryDataService)
    {
        _repositoryDataService = repositoryDataService;
    }

    public async Task<IEnumerable<SomeData>> GetPaymentVendorDt(SomeParamData someData, CancellationToken cancellationToken)
    {
        return await _repositoryDataService.ExecuteList(someData, cancellationToken);
    }
}

**Base Interface IBaseActionClass **

public interface IBaseActionClass : IBaseAction {}

**Interface IBaseAction **

public interface IBaseAction 
{
    Task<IEnumerable<SomeData>> GetPaymentVendorDt(SomeParamData someData, CancellationToken cancellationToken);
}

Now, notice that each time I want to add signature method here in interface named IBaseAction, the base class named **BaseActionClass ** and base Api Controller named BaseApiController will also gets notified to implement or should changed their implementations.

So again, my question is: Is this fine or a Best practice? Or is it fine for MVC Controllers to inherit interface like this?

Write & Publish Guest Post on DA92+ Behance. net for $4

Write & Publish Guest Post on DA92+ Behance. net

I will write 400+ unique SEO articles and publish guest posts on Behance – DA93 & PA83 Design blogs with high-quality backlinks and TOP-ranked websites.

Here I am offering guest posts on top-quality design-related websites.

Benefits of Getting these services:

★Hight Authority Design Website

★Boost Your Website Ranking

★Increase Google Ranking

★Real traffic website

★400+ unique article

★Permanent Posts Backlink

Category accepted:

★Art and Entertainment related niche

★Branding and Marketing related niche

★Health and Business related niche

★Style and Technology related nich

★And many more

Note: If you have any doubt and questions feel free to contact me

.

Which authentication mode to connect to SSRS from .NET 5?

I wonder which authentication mode to use when accessing to an SSRS report server via .NET 5 app. I would like to use an HttpClient class, with the SendAsync method. I saw things like Basic authentication but the clients are relying on Blazor Web Assembly and I can’t see what domain to enter in the credentials. No, the ideal thing would be a simple pair username/password, without a domain.

Is it possible? and by using which authentication mode?

I would like to add that the app will be deployed on azure.

thank you.

c# – .Net 5.0 Get User Email From Claims

From searching online I have identified two ways to get the user email, but I don’t know if either has pro’s/con’s beyond Option.1 being a larger number of lines of code?

Option.1
I have a dedicated 

ClaimsPrincipalExtension.cs

 class, which I can call from anywhere in my app using var email = ClaimsPrincipalExtensions.GetLoggedInUserEmail(User);. Within which I have a method to get the email as shown:

using System;
using System.Security.Claims; 
    
namespace FunctionalLogicLibrary { 
    
public static class ClaimsPrincipalExtensions { 
public static string GetLoggedInUserEmail(this ClaimsPrincipal principal) {
if (principal == null)
throw new ArgumentNullException(nameof(principal));
return principal.FindFirstValue(ClaimTypes.Email); }
 } 
}

Option.2
I just add using System.Security.Claims; to any class where I need it and use 

var email = User.FindFirstValue(ClaimTypes.Email);

I’m just trying to learn here. Which method is more appropriate and why?

.net – Why running migration turns into timeout in a production environment?

I know this is a theorical question since i don’t have code to or any logs to show, but i hope that someone can give me some idea on this question.

The problem in question was the following:

On my work, on a deploy to a production system a migration took so much time running that it failed due to a timeout and this happened on 2 tries. What’s worse is that the system started to be really slow and throwing 500 error to users on the application while the running of the migration was being executed.

This happened on a production environment with load while on a testing environment the same migration runned without problems.

To give more details we are talking about a Sql server Database that can have dozens of requests on a small amount of time. And on the .NET framework API application, i created a new migration using entity framework 6 for a new table, which had foreign key constraints to other tables. Some of this related tables have hundreds of thousands of records.

For the deploy of both environments (test and production) i’m using the azure pipelines and on a specific task the migrations will run (if there is anything new for the database)

I already searched about this, but couldnt find much information, is this timeout happening because a database is with heavy load? somehow some tables can be blocked by other queries taking long? is this taking so long that it reaches the limit time allowed by migrations system? How to overcome this kind of problem? Do it off-hours only?

I appreciate the answers.

obfuscation – .Net dll encryption

obfuscation – .Net dll encryption – Information Security Stack Exchange

¿Es posible bloquear un archivo para que no se pueda eliminar mientras una aplicación Windows Forms c# con .NET 5 lo está usando?

Tengo un archivo de una base de datos la cual manejo con Entity Framework Core, utilizando una aplicación de Windows Forms con .NET 5 (C#). Pero me gustaría que, mientras la aplicación está abierta, el archivo no pueda utilizarse, ni borrarse si se accede a este a través del Explorador de Archivos. Tipo el mensaje de error que a veces aparece diciendo que el archivo se está utilizando por otro programa y no se puede eliminar. ¿Sabrían como puede hacerse eso a través de código? No encuentro nada al respecto.

c# – 5.7.1 Sender address rejected: not owned by auth user. .net core yandex mail

            SmtpClient client = new SmtpClient("smtp.yandex.com", 587);
            client.Credentials = new NetworkCredential("site@example.com", "password");
            client.EnableSsl = true;

can you help me please ?

An unhandled exception occurred while processing the request.
SmtpException: Mailbox name not allowed. The server response was: 5.7.1 Sender address rejected: not owned by auth user.

asp.net core – Convertir un parrafo bs64 a string y leerlo linea por linea en C# .Net

Estoy tratando de convertir un texto en BASE64 a String , cuando se realice la conversión se debe leer este párrafo y separarlo linea por linea.

La conversion del parrafo a String ya la tengo y lo hago de la siguiente manera:

private string Base64ToString(string base64String)
{
    byte() data = Convert.FromBase64String(base64String);
    string decodedString = Encoding.UTF8.GetString(data);
    return decodedString;
}

Este me devuelve el siguiente String y este es el que tengo que leer linea por linea:

120210218007000009001562642PRUEBA A.P.S. S.A.                                                                            
500000003182120773010100                                                                                                
6900838458       EUREKA GUAVIARE 000010078611837396     20210202000001860000000000036400001130000001                    
637239274        ARACELY QUINTERO000010078611849457     20210102000001860000000000113600001130000002                    
621672001        MARIA ROSMIRA GO000010078611437021     20210202000001860000000000113600001130000003                    
637800499        RAQUEL MEJIA DE 000010078611291574     20210102000001860000000000113600001130000004                    
670722724        JOSE HERNAN RAMI000010078611312622     20210202000001860000000000113600001130000005                    
652871276        NINI YOHANA VARO000010078611852353     20210102000001860000000000161300001130000006                    
6474084          PEDRO ANTONIO MO000010078611550549     20210102000001860000000000113600001130000007                    
621953789        MARIA YOLANDA CA000010078611375911     20210202000001860000000000113600001130000008                    
624322185        MARIA ARSENIA VA000010078611557697     20210102000001860000000000113600001130000009                    
61037322825      JUAN GUILLERMO H000010078611839077     20210202000001860000000000113600001130000010                    
693290752        ARTEMO JIMENEZ J000010078611375693     20210202000001860000000000113600001531000011                    
61042774280      CARLOS ARLEY OSO000010078611851292     20210102000001860000000000113600001531000012                    
6900101681       FUNDACION SOCIAL000010078611837963     20210202000001860000000000113600001531000013                    
612616960        LUIS EDUARDO FAN000010078611847568     20210102000001860000000000113600001531000014                    
613702117        HERNAN ALONSO GO000010078611498574     20210202000001860000000000113600001531000015                    
623779639        MARIA SONIA HERN000010078611838853     20210202000001860000000000128800001531000016                    
691510572        JOSE DAVID NIGRI000010078611840872     20210102000001860000000000113600001631000017                    
8000017000017000000000191690000 

He intentado lo siguiente, para leer el texto linea por linea, pero no se el por que no realiza la separación:

En la variable lstBs64 llega el texto en BS64:

 string() lineas = Base64ToString(lstBs64).Split(Environment.NewLine);

Como pueden ver tengo un método Base64ToString el cual convierte el string Bs64 a string y a la vez trato de separarlo linea por linea con Split(Environment.NewLine) pero no funciona.

Quisiera saber si hay otra forma y que estoy haciendo mal.

Gracias.

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123