Kayıtlar

Aralık 25, 2014 tarihine ait yayınlar gösteriliyor

Code first entity framework ile console ile migration işlemleri

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 PM > Enable - Migrations No packages installed . The EntityFramework package is not installed on project ' WorkSpace ' . PM > Enable - Migrations No packages installed . The EntityFramework package is not installed on project ' WorkSpace ' . PM > Enable - Migrations No packages installed . The EntityFramework package is not installed on project ' WorkSpace ' . PM > Install - Package EntityFramework ' EntityFramework 6.1 . 2 ' already installed . Adding ' EntityFramework 6.1 . 2 ' to WorkSpace . Successfully added ' EntityFramework 6.1 . 2 ' to WorkSpace . Type ' get - help EntityFramework ' to see all available Entity Framework commands . One or more packages could not be completely uninstalled: EntityFramework . 6.1 . 1 . Restart Visual Studio

Include metodu ne için kullanılır?

Kod örneğimiz şekildeki gibi 1 2 3 4 5 public ViewResult Index () { var albums = db.Albums.Include(a => a.Genre).Include(a => a.Artist); return View (albums.ToList()); } LOADING RELATED OBJECTS The Include method calls that you see in the Index action tell the EF to use an eager loading strategy in loading an album’s associated genre and artist information. An eager loading strategy attempts to load all data using a single query. The alternative (and default) strategy for the EF is a lazy loading strategy. With lazy loading, EF loads only the data for the primary object in the LINQ query (the album), and leaves the Genre and Artist properties unpopulated: 1 var albums = db.Albums; Lazy loading brings in the related data on an as-needed basis, meaning when something touches the Genre or Artist property of an Album, EF loads the data by sending an additional query to the database. Unfortunately, when dealing with a list of album information, a lazy loadin

Data Access Layer yaklaşımları nasıl olmalı

There are many different approaches to accessing data these days, and the approach you use will depend not only on the type of application you build, but also on your personality (or your team’s personality). There is no single data access strategy that can work for all applications and all teams. The approach in this chapter uses the tooling of Visual Studio and will get you up and running quickly. There isn’t anything explicitly wrong with the code; however, for some developers and some projects, the approach is too simplistic. The scaffolding we use in this chapter assumes you are building an application that needs to implement basic create, read, update, and delete (CRUD) functionality. Many applications exist only to provide CRUD functionality with basic validations and a minimal amount of business workfl ows and business rules. The scaffolding works well for these applications. For more complex applications you’ll want to investigate different architectures and design pattern