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.

entity framework - EF CTP 5 create and persist object graph trouble -


code:

something smt = new something(){ prop = 123, prop2 = "asdad" }  foreach(var related in relatedsomething) {     smt.related.add(new related(){     relatedprop = 123,     }; } 

runtime gives me error null reference. related virtual icollection. no foreign key fields in entities defined.

on contrary if do

foreach(var related in relatedsomething) { db.related.add(new related(){     relatedprop = 123,     = smt     }; } 

it works.
although, want work in first snippet.
doing wrong? 'cos in shipped ef4 works both ways.

model classes (relevant part):

public class printer {     public int id { get; set; }     public string  name { get; set; }     public virtual icollection<replica> replicas { get; set; }   } public class replica {     public int id { get; set; }     public virtual printer printer { get; set; }   }   public class printerscontext: dbcontext {     public dbset<printer> printers { get; set; }     public dbset<replica> replicas { get; set; }  } 

i think might have run same problem. i posted on msdn, got no response.

it's bug in ef, have live , work around.


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 -