Good way to document discouraging the use of a member, type, or pattern that cannot easily be removed?

There is an attribute ObsoleteAttribute that can be used to indicate that a type or member will be removed in a future update and should not be used. I’m working with a large codebase that utilizes some outdated patterns and conventions and I want to hint that its use should be discouraged for future code, at least until we can get a chance to clean things up for the entire codebase (which is unlikely).

e.g.,

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>public class SomeWidelyUsedClass
{
// examples of the old approach
public int? SomeInt { get; set; }
public int? SomeIntId { get; set; }
public string SomeIntDisplayName { get; set; }
public int? AnotherInt { get; set; }
public int? AnotherIntId { get; set; }
public string AnotherIntDisplayName { get; set; }
public DateTime? SomeDate { get; set; }
public int? SomeDateId { get; set; }
public string SomeDate1DisplayName { get; set; }
// the newer approach, utilizing objects to contain related data
public FieldInfo<int?> NewSomeInt { get; set; }
public FieldInfo<DateTime?> NewSomeDate { get; set; }
}
</code>
<code>public class SomeWidelyUsedClass { // examples of the old approach public int? SomeInt { get; set; } public int? SomeIntId { get; set; } public string SomeIntDisplayName { get; set; } public int? AnotherInt { get; set; } public int? AnotherIntId { get; set; } public string AnotherIntDisplayName { get; set; } public DateTime? SomeDate { get; set; } public int? SomeDateId { get; set; } public string SomeDate1DisplayName { get; set; } // the newer approach, utilizing objects to contain related data public FieldInfo<int?> NewSomeInt { get; set; } public FieldInfo<DateTime?> NewSomeDate { get; set; } } </code>
public class SomeWidelyUsedClass
{
    // examples of the old approach
    public int? SomeInt { get; set; }
    public int? SomeIntId { get; set; }
    public string SomeIntDisplayName { get; set; }

    public int? AnotherInt { get; set; }
    public int? AnotherIntId { get; set; }
    public string AnotherIntDisplayName { get; set; }

    public DateTime? SomeDate { get; set; }
    public int? SomeDateId { get; set; }
    public string SomeDate1DisplayName { get; set; }

    // the newer approach, utilizing objects to contain related data
    public FieldInfo<int?> NewSomeInt { get; set; }
    public FieldInfo<DateTime?> NewSomeDate { get; set; }
}

I will try to follow the pattern of the established code, despite my own personal tastes when making changes except for really egregious patterns. Then try to follow that pattern for new code where appropriate. But we want to go with the new approach so I want to let others know that this is the direction we should go.

Does there exist an attribute that indicates that a type or member’s use should be discouraged in favor of another approach? Something like a “DiscouragedAttribute” or a “DoNotUseThisPatternAttribute.” How do we document that entire patterns should be phased out for something else?

Using ObsoleteAttribute in this case doesn’t feel right to me as it targets specific members, and indicates it will be removed in the near future. I want to discourage an entire pattern. I also considered using XXX comments to explain why these should not be used but I don’t think it is effective for spreading the word as it’s not highlighted by the IDE as something that should be considered. Same for XML docs.

For now, I’m applying ObsoleteAttribute to extension methods that have been added to try to simplify accessing/mapping to these members to discourage it but I’d hope there’s a better approach. But there are already at least 5 different variations of these methods already and I don’t want it to get out of hand.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>// I added this previously to replace some really ugly mapping code
[Obsolete("Consider using FieldInfo<T> type for newly mapped fields")]
public static int? GetIntValue(this IDataRepository data, string name, out int? id, out string displayName);
</code>
<code>// I added this previously to replace some really ugly mapping code [Obsolete("Consider using FieldInfo<T> type for newly mapped fields")] public static int? GetIntValue(this IDataRepository data, string name, out int? id, out string displayName); </code>
// I added this previously to replace some really ugly mapping code
[Obsolete("Consider using FieldInfo<T> type for newly mapped fields")]
public static int? GetIntValue(this IDataRepository data, string name, out int? id, out string displayName);

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật