c# - MVC 4 Web API + EntityFramework: Handling external resource dependencies -


so have situation lets i'm making 2 apis; car api , autoservice api. car api manages resources related car entities. autoservice api manages resources related auto service retail entities provide repair service cars.

lets application uses both api. creates auto service entity particular car entity. uses car api create/edit car resource , passes autoservice api create service log particular car entity. means service log entity in autoservice api referencing entity external resource api.

the question becomes, best practice handle dependency? original idea create 2 properties in service entity; externalowner , externalownerhost. externalowner entity map id of car entity. externalownerhost describe origin of external owner, lets /auto/car. association in place, create convention application client figure out on own how access external owner entity given externalownerhost. example, application should smart enough know use get /auto/car?fields= given knows host of resource. best practice? guys have better ideas?

if need dependency called without understanding of dependency, save child url calling entity in single field (e.g. /auto/car/12?fields=...).

but wonder how easy consumer of api needs understand how consume data returned api. in example,this means autoservice api has understand how deal auto api data.

so, ultimate recommendation depends upon designing for. if display, have care auto service know id , know how include auto specific control. if processing, pretty have carid , have autoservice api understand how data , how consume in code; not in database.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -