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.

c# - Linq - Is there are way to build up a linq statement from several snippets of linq -


i have several methods use similar linq statements different enough them in own methods. say, sake of arguemnt, had following linq snippet repeated across methods (the real snippets longer this):

        su.objid == serviceuserid         cl.staffmemberid == staffmemberid 

if working in sql contatenate repeated sql follows:

private string getrepeatedsql() {  return "where su.objid = serviceuserid , cl.staffmemberid = staffmemberid"; }  private void dosomething() {  string mysql = "select * ...... lots of sql .." + getrepeatedsql() + ".. more sql"; } 

(usual health warnings around contatenating sql string noted).

is there equivalent in linq? i'm sick of having make changes in several places - seems contravene dry principle.

thanks!

correct me if i'm wrong thought linq statements weren't executed until used them. (coming linq nhibernate)

if case add whatever need existing statement. example:

var temp=from x in sometable select x; 

then adding clause:

temp = x in temp x.id==1234 select x; 

then order by

temp=from x in temp order x.id select x; 

i won't lie have never done way assume should work. if knows won't work please explain why. thanks.

found on msdn: http://msdn.microsoft.com/en-us/library/bb397906.aspx

in linq execution of query distinct query itself; in other words have not retrieved data creating query variable.

so creating variable have not retrieved data. although maybe way i'm doing above return data because calling from x in temp change query.


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 -