i have a property attribute that can be defined once per class, and an empty interface called ISql
which i just use to mark my objects that are allowed to use my custom buillt ORM.
is there a way to force the class that implements ISql
to have that attribute at least once?
No, attributes aren't part of the contract of the interface, in terms of what implementations must provide.
For this sort of thing, I usually just add a unit test which uses reflection to find all implementations and validates it that way. It's not as nice as a compile-time check, but it's the best that's available in this case.
See more on this question at Stackoverflow