Set internal modifier on extension methods on object CloudinaryDotNet.Core.SystemExtension
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 48/100
Línea de trabajo
Localice CloudinaryDotNet.Core.SystemExtension e inspeccione sus usos para confirmar que Clone y CopyPropertiesTo solo se necesitan internamente. Cambie la API expuesta según lo solicitado, luego compile el SDK y ejecute sus pruebas disponibles para verificar que los llamadores internos sigan funcionando y que los métodos de extensión ya no se puedan usar públicamente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Removing of a "feature" request for Cloudinary .NET SDK
CloudinaryDotNet.Core add extensions methods to object base type, which might be used by the library itselve, but shouldn't be public and usable on a project using this library.
The two following extension methods must be internal only:
namespace CloudinaryDotNet.Core;
public static class SystemExtension
{
/// <summary>Clones the object.</summary>
/// <param name="source">The source to clone.</param>
/// <typeparam name="T">Object type.</typeparam>
/// <returns>New instance of the cloned object.</returns>
public static T Clone<T>(this T source)
{
return JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject((object) source));
}
/// <summary>
/// Copies the writable properties from the source object to the destination object.
/// </summary>
/// <param name="source">The source object whose properties will be copied.</param>
/// <param name="destination">The destination object where the properties will be copied.</param>
public static void CopyPropertiesTo(this object source, object destination)
{
foreach (PropertyInfo runtimeProperty in typeof (FileDescription).GetRuntimeProperties())
{
if (runtimeProperty.CanWrite)
{
object obj = runtimeProperty.GetValue(source);
runtimeProperty.SetValue(destination, obj);
}
}
}
}
Explain your use case
I shouldn't be able to use these methods on any object of my domain, system object, etc.
For example, this code is "syntaxically" ok, but absolutely not in execution:
System.Net.Http.SocketsHttpHandler handler = new System.Net.Http.SocketsHttpHandler();
handler.Clone();
Describe the problem you’re trying to solve
From my point of view, this is the responsibility of each projects to add the extension methods they need on base system type.
When I use a library to simplify access to cloudinary API, i don't expect to get some system type helper methods, which:
- will not works as i expect regarding they naming. Each people will have a different perception of what a "Clone" method do, maybe from your use case, Json IN/OUT is enough, but for another person, it will not be the case.
- will create a dependence on the library outside of the desired scope. (CloudinaryDotNet.Core would be used only on a "CdnConnectorService", but might be used everywhere because of that. )
Do you have a proposed solution?
Set these methods / extension class as internal instead of public.
(thanks for your work on the library btw! :) )
- Lenguaje dominante
- C#
- Estrellas
- 105
- Forks
- 72
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de cloudinary/CloudinaryDotNet
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
cloudinary/CloudinaryDotNet#385 · 5 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
cloudinary/CloudinaryDotNet#383 · 1 comentario ·
-
Create New Sample Project with Generative AI and Special Use CasesQuizá libre de nuevo @Nupoor10 la tomó hace 768 días y no hay ningún pull request abierto. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
cloudinary/CloudinaryDotNet#369 · 4 comentarios ·
-
Update the Sample ProjectQuizá libre de nuevo @arya2004 la tomó hace 772 días y no hay ningún pull request abierto. Abierto
cloudinary/CloudinaryDotNet#368 · 4 comentarios · 1 asignado ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
cloudinary/CloudinaryDotNet#362 · 1 comentario ·
Todos los issues de cloudinary/CloudinaryDotNet
Issues similares
-
ready-for-agent tech-debt
Dificultad 1/5 1-3 horas Aptitud para principiantes 85/100
DigiBanks99/menlo#640 ·
Los mantenedores suelen responder en 1 día
-
ci
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
OpenTabletDriver/OpenTabletDriver#5283 ·
Los mantenedores suelen responder en 3 días
-
area / templates
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
bitfoundation/bitplatform#15109 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
aikido critical security
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
dequelabs/axe-core-nuget#305 ·