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.

What's the difference in how Nhibernate treats .FirstOrDefault vs .SingleOrDefault? possible bug? -


just starting out nhibernate , using nhib 3.0's (3.0.0.2001) linq following models

public class request {     public virtual guid id { get; set; }     public virtual state {get;set;} } public class state {     public virtual guid id {get;set;} } 

so i'm trying retrieve request based on it's state id.

_session.query<request>().where(x => x.state.id==someguidvalue).firstordefault(); 

seems pretty straight forward, gets sql error based on generated sql looks @p0 parameter missing, though not sure why'd included here.

{"line 1: incorrect syntax near '('."}  select top (@p0) requ0_.id id0_ , requ0_.state_id state8_0_  [request] requ0_ requ0_.state_id=@p1 ]   name:p1 - value:a2e63925-6628-4786-a621-9e5200d5ab71 

however, using singleordefault works, fine.

_session.query<request>().where(x => x.state.id==someguidvalue).singleordefault(); 

any insight appreciated. thanks

i believe singleordefault error when more 1 records meets select criteria. firstordefault pull first regardless of how many records returned.

that's how works in linq-to-sql


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 -