foreign key relationship - ServiceStack Service structure for predominantly read-only UI -
i'm getting started servicestack , i've got i'm impressed has under bonnet , how easy use!
i developing predominantly read-only application it. there updates database 3 or 4 times year rest of time solution displaying data on electronic information board (large touch screen monitor).
the database structure normalised few foreign keyed tables , in mind think may best separate read api crud api. crud api can used create , modify relational data poco classes matching database tables. ensure read-only api flattens relational data few pocos spanning few db tables making data easier handle on read-only uis.
i'm looking ideas , advice on whether separation of concerns wasted effort or if there better way of achieving need? has had similar thoughts / ideas?
having developed similar read application (a gazetteer, updated quarterly/yearly) using servicestack went optimizing api reads, making use of built in caching:
// cached responses has object public object any(cachedrequestdto request) { string cachekey = request.cachekey; return this.requestcontext.tooptimizedresultusingcache( base.cache, cachekey, () => { using (var service = this.resolveservice<requestservice>()) { return service.any(request.translateto<requestdto>()).translateto<cachedresponsedto>(); } }); }
where cachekey just:
public string cachekey { { return urnid.create<cachedrequestdto>(string.format("{0}_{1}", this.field1, this.field2)); } }
we did start creating crud / poco service, speed went using bulk import tools such sql server dts/ssis or console apps suffices now, , revisit later if required.
might want consider cqrs.
https://gist.github.com/kellabyte/1964094 (or google cqrs martin fowler, can post 2 links).
also found following article valuable when starting implement additional search type services: https://mathieu.fenniak.net/stop-designing-fragile-web-apis/
Comments
Post a Comment