GMF Hoogenraad

GMF Hoogenraad

  • NA
  • 23
  • 842

SPA: Angular, WEBapi, MVC on EF (CodeFirst approach)

Sep 28 2016 5:01 AM
Dear reader,
 
I'm looking for some advice on ProxyCreationEnabled setting in conjunction with the Include method to achieve an improved performance.
 
Why? I'm working on a study project: A Single Page Approach on Angular JS talking to a WEBapi (MVC, Automapper, FluentAPI) performing data operations using EF on a CodeFirst generated database.
 
The test project is now in such a state that I can easily switch ON or Off the ProxyCreationEnabled setting and notice clearly an improved performance retrieving data after logging in into the 'Administration' corner of my application. With ProxyCreationEnabled = true (meaning building a database schema retrieving everything) I notice: it takes seconds to build up the 'grid' page as starting page performing necessary CRUD operations.
Note: On the controller retrieving several HttpResponses I use DataAnnotations like AllowAnonymous and several other levels of 'User Roles' for instance a 'SuperAdministrator'. 
 
As soon as I switch Off the ProxyCreationEnabled (set it to false) meaning losing all Proxies (creating only detached POCO's) I do achieve a much better performance building up my 'grid' page, however.... only when I annotate the desired HttpResponse method with [AllowAnonymous] instead of [Authorize(Roles = "Super_Admin")].
 
Requirements: I want to keep up the membership I'm using, the use of DataAnnotations on the Controller methods and use only POCO's I need (ProxyCreationEnabled= false).
 
Questions:
1 Is there a way to partially switching On ProxyCreationEnabled? For instance only on my Membership part ('cause I do have set up my project in such a way I discriminate the membership part from the data; in my Data layer, Services layer, etc.) 
2 Where can I or such I use the .Include method (in case having ProxyCreationEnabled = false) on the User POCO retrieving the Role POCO through my UserRole POCO (many-to-many approach)?
 
In what direction should I look? 
 
Thanks for being with me 

Answers (1)