I have a third party repository (this is called an external resistor) which asks for a particular object The dictionary gives a key value of 30 - 100 keys / value can be added in this dictionary depending on the object.
My application needs access to this external repository and instead of depending on its basis, I have started another layer (it is called a meripagrity) which is called and typed in the external repository Translate dictionaries into domain objects (each key / value couple making an asset in my domain pco), which my app can understand and use.
With this design I am wondering if any good approach about how to implement this translation. Is writing a domain object in the form of properties for all key / value combinations and translating my only option into a single domain object? Here's a sample where my design is just fine.
Class ExternalRepository {Language & lt; String, Object & gt; GetObjectA (); } Class MyRepository {A GetObjectA () {var dict = _externalRepository.GetObjectA (); Return MapToA (dict); } Use a mapshow (dictionary & lt; string, object & gt; dict) {// use something like an automaker for the map}} class A {public string Prop1; Public goods prop2; }
In my real case, there are at least 30 different objects in it such that A has many different properties. Writing a domain poco for each and translating it sounds a bit tiresome for me, I've read a bit about using dynamic objects (or expendo objects), but using them as my domain object To be a little careful, can you think of any other way to reach it?
thanks
No comments:
Post a Comment