Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

scala - OneToMany Relations with Lift -


i have question once again , have feeling solution simple. should simple, in case. have been trying model mappings database, nice onetomany trait, so

class user extends megaprotouser[user] onetomany[long, user] {   def getsingleton = user    object posts extends mappedonetomany(post, post.author, orderby(post.edited, descending)) }  class post extends longkeyedmapper[post] idpk onetomany[long, post] {   def getsingleton = post    object author extends longmappedmapper(this, user)    object title extends mappedstring(this, 100) {     override def dbindexed_? = true      override def defaultvalue = "new post"   }    object contents extends mappedtext(this)    object edited extends mappeddate(this) } 

all nice done, have one-to-many relationship right. but, troubles me real lot, how get data in relationship? supposing i've got post object , want author's name it?

bind("post", in, "title" -> post.title, "author" -> /* insert overly complicated method here */) 

i've learned can on box, post.author.obj or something. not quite work out, have match on , such?

i feel answer simple, yet fail see it.

mapper not guarantee post.author can succeed, must return box. use post.author.obj.map(_.name.is) openor "unknown name" or similar avoid using match statement.

alternatively, create helper method on post default handling , use instead.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -