c# - Best way to associate metadata with a class type -


i want build little entity framework, need information entity class type e.g dbtype(sql, mongodb), dbname, tablename, idproperty. thought about:

  • static methods (needs reflection hard coded strings invoke type)
  • instance methods (need instantiate type)
  • app.config (not directly in class)
  • class attribute (needs reflection)
  • store in database (to entity db need data db first, seems not nice)

what best , fastest method metadata entity type?

attributes want this. broad topic i'll link msdn documentation:

http://msdn.microsoft.com/en-us/library/z0w1kczw.aspx

attributes provide powerful method of associating metadata, or declarative information, code (assemblies, types, methods, properties, , forth).

essentially can create attribute class (or use existing one) , apply classes , when want can query metadata whatever information you've stored in them.


Comments

Popular posts from this blog

php - Magento - Deleted Base url key -

javascript - Tooltipster plugin not firing jquery function when button or any click even occur -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -