Alternatives to splitting tables Entity Framework 6 - VARBINARY(MAX) -


solution : idea loading problem table files. in order in order, had turn off lazy load, , load navigation property entity blob instead of other way around.

  public filedto[] retrievefileswithuserid(string id)         {             filedto[] files;             logger.info("looking files #{0}", id);             using (var db = contextfactory.getentities())             {                 db.configuration.lazyloadingenabled = false;                 logger.debug("user retrieved !");                  files = db.files.include("users").where(f => f.users.count(user1 => user1.id == id) > 0).select(                     x =>                         new filedto                         {                             contenttype = x.contenttype,                             id = x.id,                             name = x.name,                             type = db.typefiles.firstordefault(b => b.id == x.type).description                         }).toarray();                  db.configuration.lazyloadingenabled = true;             }              logger.info("done looking files");             return files;         } 

problem was: have issue seems quite classic. have table 1 large blob, , when load have huge performance issues (due loading large amount of data).

i have users, users have files , in file entity have datas. relations many many.

easy fix: table splitting, , problems solved.

problem: boss doesn't want me (i argued best option).

so, how can differently ? thought requiring directly don't have access intermediate tables (they navigation properties now.) procedure make trick ?

you can use projection fields want without blob:

var people = context.people.select(p => new persondto { id = p.id, name = p.name }); 

where persondto like:

class productdto {     public int id { get; set; }     public string name { get; set; } } 

dto means data transfer object , used such tasks.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -