Set internal modifier on extension methods on object CloudinaryDotNet.Core.SystemExtension
还没有人认领这个 Issue。
评估
调研方向
定位 CloudinaryDotNet.Core.SystemExtension 并检查其使用情况,以确认 Clone 和 CopyPropertiesTo 仅在内部需要。按要求更改公开的 API,然后构建 SDK 并运行其可用的测试,以验证内部调用方仍能正常工作,并且扩展方法不再可公开使用。
由索引模型根据 Issue 内容生成。
描述
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! :) )
- 主要语言
- C#
- 星标
- 105
- 派生
- 72
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cloudinary/CloudinaryDotNet 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 30/100
cloudinary/CloudinaryDotNet#385 · 5 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 45/100
cloudinary/CloudinaryDotNet#383 · 1 条评论 ·
-
Create New Sample Project with Generative AI and Special Use Cases可能重新可做 @Nupoor10 于 767 天前认领,目前没有进行中的 PR。 未关闭
难度 5/5 一周以上 新手友好度 20/100
cloudinary/CloudinaryDotNet#369 · 4 条评论 ·
-
Update the Sample Project可能重新可做 @arya2004 于 772 天前认领,目前没有进行中的 PR。 未关闭
cloudinary/CloudinaryDotNet#368 · 4 条评论 · 已指派 1 人 ·
-
难度 3/5 1-2 天 新手友好度 35/100
cloudinary/CloudinaryDotNet#362 · 1 条评论 ·
查看 cloudinary/CloudinaryDotNet 的全部 Issue
相似的 Issue
-
:watch: Not Triaged dotnet-fundamentals/svc install/subsvc
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
SpriteFromDisk: 2x2 DXT5 placeholder texture fails on newer Unity (sizes must be a multiple of 4)未关闭
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 1/5 1 小时以内 新手友好度 88/100
MaterialDesignInXAML/MaterialDesignInXamlToolkit#4124 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100