Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 111579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:24:29+00:00 2026-05-11T02:24:29+00:00

When employing custom attributes to store meta-data, is it best to decorate the interface,

  • 0

When employing custom attributes to store meta-data, is it best to decorate the interface, or the class that implements the interface, assuming that any class that implements the interface would have the same data in the attribute?

Update: Basically i’m writing a custom data storage mechanism for a project, and the objects represent the various tables being stored. The custom attribute is used to designate which table in the dataset is used to store the objects of that class, and also to identify which tables are involved in a n:m relationship.

So if i put the attributes on the interface, is this a clearer approach, or does it clutter the interface and make accessing the data itself more cumbersome?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T02:24:30+00:00Added an answer on May 11, 2026 at 2:24 am

    It depends on the scenario. WCF, for example, decorates interfaces for the operation contracts.

    However, if you are going to be talking about objects (rather than the interface itself), note that it can be painful for calling code to get hold of interface metadata, especially if the class uses explicit interface implementation.

    It would be more common to decorate the class, but that isn’t quite the same question ;-p

    If the attribute really is specific to the interface (not the instances), then fine – decorate the interface and talk about typeof(IFoo) etc. But if you expect code to be able to set per-type values for the attributes, it will have to be at the class level.

    What is the scenario?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to store a custom data object as persistent data without
I'm employing a custom webpart that is made by an unaffiliated third party. I've
How to write a unit testing case for custom spring validator implementation class .
I'm using a custom-built inhouse application that generates a standard set of reports on
I am working on a project that collects and analyzes moderately complex engineering data.
I am building a page that is employing several different javascript elements and I
Is there any use cases for employing the Visitor Pattern in Scala? Should I
I’m exploring Core Data custom migration, for which I need to run a test
I'm trying to clean up my Javascript by employing the same TDD methods that
I am employing ThreadPool.QueueUserWorkItem to play some sound files and not hanging up the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.