I started testing "workflow" with EF code first. First, I have created a class diagram. Some classes were designed -
Then I used the first EF code, I created the AntStatext.
Public class EntsConnectx: DBCOntax {Public DBset & lt; Project & gt; Projects {Receive; Set; } Public DbSet & lt; Step & gt; Step {Get; Set; } Public DBSet and Lt; Iteration & gt; Change {received; Set; } Public DbSet & lt; Work & gt; Work {get; Set; } Public DbSet & lt; Members & gt; Members {receive; Set; }} The next step was creating a project controller (ASP .NET MVC3) with simple work:
Public Action Result Index () {using (Var db = new anticonnect ()) {return see (db.product.ostit ()); }} The problem is: I can not see the project manager (list / matrolling used) I would like to know whether I am doing this wrong or scaffolding generation , Which ignores my properties, which are not the basic types. Hmm ... this is probably quite clear .. because the generator is not aware of this type should be used, is not it?
OK, then I can change my question a bit: What is a solid way of creating a project unit in this scenario (I want to choose a project manager during the project construction)? Should I make a view modal for this?
project manager will not be loaded by . You should either use lazy loading or curious loading. When you query projects : public actionResult Index () {curious loading} using {{var db = new EntsContext ()) ProjectManager {see refresh (db.Projects.Include (p = & gt; p.ProjectManager). Ollist ()); }} After viewing the property the lazy loading ProjectManager will be loaded. To allow for sluggish loading, you have to create all your navigation properties in the form of a virtual , but this is not a good evaluation in your current scenario because: - Lazy Before the context of loading is opened, you close the context so that you can get the exception of the disposed reference.
- In your case, sluggish loading is in N + 1 query in DB, where N is the number of projects because the manager of each project will be separately interrogated.
Comments
Post a Comment