vb.net - Tuning Entity Framework - dbContext? -
I have some model classes: Actually, I am calling In addition to the code analysis I need to apply I need to implement I am confused - is the best practice acceptable? after comment (s), which, in a nutshell, are not referring context in a global variable And prefer short-term disposable references in return) except that I want to point out that most of the references were not done according to the creation of the initial thing but were done once for the lifetime of the application. This is primarily the process of building your internal model, which it does and then caches. See more details here:
public class MyViewModel public property MyID () integer Go into the form of Folk ReadOnly Property FirstList IEnumerable (SelectListItem) as the new MyContext dim itemQuery form using dbContext = (d in T. dbContext.ItemSet T) Dim Item IEnumerable (item) = itemQuery.ToList () return item. Select (function as O) New SelectListItem () {.text = o.ItemDesc, .Value = o.ID}) End assets publicly readOnly property using second end Go to SecondList using IEnumerable (as selectListItem) using the dbContext as the new MyContext _actu (get from dbContext.FrameworkSet in T.) IEnumerable (ITEM2) = _Query.ToList () Return _list.Select (Function (o) {.text = o.Item2Desc, .Value = o.ID as _list slow}) and end and end and property and class with new SelectListItem ()
MyContext twice, it instantiates EF repeatedly, right? So my idea is just a square global
dim dbContext as new MyContext
IDisposable
Comments
Post a Comment