Posted By: harumscarum | Apr 21st @ 10:47 AM
page 1 of 1
Comments: 3 | Views: 654
harumscarum
harumscarum
out of memory
Is it possible to do this?

I was generating some code based on some meta-data and certain dbtables. I forgot to add a certain attribute to some of the classes but didnt realize until I was running through some tests. Not a big deal since I can just regenerate. Anywho I was wondering though if it was possible to force a class to have an attribute so I could catch this at compile time.
JohnAskew
JohnAskew
9 girl in pink sweater

Maybe a test that walks through attributes? It'd be a test time not compile time, obviously...

The only other word that comes to mind is Interface, but given your scenario of attributes...  ?

stevo_
stevo_
Human after all
No, and it goes against the point that the class is suposed to be unaware of the metadata attachment, if its a class requirement then it should be handled in more traditional OO patterns.

What about the class makes it require this attribute?  A certain base type?  You may be able to create a code analysis rule for this, but that's about the only thing I can think of.

page 1 of 1
Comments: 3 | Views: 654
Microsoft Communities