Set internal modifier on extension methods on object CloudinaryDotNet.Core.SystemExtension
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Tìm CloudinaryDotNet.Core.SystemExtension và kiểm tra các nơi sử dụng nó để xác nhận rằng Clone và CopyPropertiesTo chỉ cần thiết cho mục đích nội bộ. Thay đổi API được cung cấp ra bên ngoài theo yêu cầu, sau đó build SDK và chạy các bài kiểm thử hiện có để xác minh rằng các trình gọi nội bộ vẫn hoạt động và các phương thức mở rộng không còn có thể được sử dụng công khai.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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! :) )
- Ngôn ngữ chính
- C#
- Star
- 105
- Fork
- 72
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của cloudinary/CloudinaryDotNet
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
cloudinary/CloudinaryDotNet#385 · 5 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
cloudinary/CloudinaryDotNet#383 · 1 bình luận ·
-
Create New Sample Project with Generative AI and Special Use CasesCó thể làm lại được @Nupoor10 đã nhận 767 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
cloudinary/CloudinaryDotNet#369 · 4 bình luận ·
-
Update the Sample ProjectCó thể làm lại được @arya2004 đã nhận 772 ngày trước và không có pull request nào đang mở. Đang mở
cloudinary/CloudinaryDotNet#368 · 4 bình luận · 1 người được giao ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
cloudinary/CloudinaryDotNet#362 · 1 bình luận ·
Tất cả issue của cloudinary/CloudinaryDotNet
Issue tương tự
-
:watch: Not Triaged dotnet-fundamentals/svc install/subsvc
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
SpriteFromDisk: 2x2 DXT5 placeholder texture fails on newer Unity (sizes must be a multiple of 4)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
MaterialDesignInXAML/MaterialDesignInXamlToolkit#4124 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add .NET 11 build targetĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100