nerdexam
Microsoft

70-518 · Question #52

You are designing a Windows Presentation Foundation (WPF) application by using Microsoft .NET Framework 4, Microsoft Visual Studio 2010, and Microsoft SQL Server 2008. You have designed the…

The correct answer is C. Create persistent-aware objects. This will be achieved by non-POCO i.e. persistant aware objects or an observable collection of Since it's specified we are using Entity Objects we will not have to use an observable collection. My answer is therefore C. POCO is often considered good because it allows for a…

Designing the Data Access Layer

Question

You are designing a Windows Presentation Foundation (WPF) application by using Microsoft .NET Framework 4, Microsoft Visual Studio 2010, and Microsoft SQL Server 2008. You have designed the application to use the ADO.NET Entity Framework for the Data Access Layer (DAL). You have designed the user interface (UI) of the application by using the Model-View-ViewModel (M-V-VM) pattern. The middle tier of the application is designed by using Windows Communication Foundation (WCF). The database schema changes often. The DAL entity objects are required to be referenced from the middle tier and the ViewModel layer of the UI. You need to ensure that the DAL entity objects are updated when the database schema changes. What should you do?

Exhibit

70-518 question #52 exhibit

Options

  • AEntity objects are being used. => A, B out
  • BThe DAL always have to be updated not only when you are retrieving the data. => D out
  • CCreate persistent-aware objects.
  • DCreate persistent-ignorant objects.

How the community answered

(43 responses)
  • A
    5% (2)
  • B
    9% (4)
  • C
    84% (36)
  • D
    2% (1)

Explanation

This will be achieved by non-POCO i.e. persistant aware objects or an observable collection of Since it's specified we are using Entity Objects we will not have to use an observable collection. My answer is therefore C. POCO is often considered good because it allows for a strong separation of concerns. You can define your data objects to have absolutely zero knowledge of the mechanism that will be used to store them. (So it makes it easy to switch out the storage mechanism for something different in the future). It also means you don't have to design your data objects with any consideration for the database/framework that is used to store them. persistence ignorant All classes must have a default constructor Some features don't work unless classes are unsealed and all members are virtual Object identity doesn't work properly unless you abuse Equals/GetHashCode (Aside: Before anybody gets upset, I don't mean to pick on NHibernate here, it's just a frequently quoted example of a framework that supposedly permits persistence ignorance. I'm sure similar arguments could be applied to other ORMs that claim the same.) Now although the class in itself does not have any persistence-framework-specific attributes or base classes etc., to me it is not really "persistence ignorant" because it must follow a set of design guidelines to facilitate use by the chosen persistence framework

Topics

#Entity Framework#persistent-aware objects#MVVM pattern#DAL design

Community Discussion

No community discussion yet for this question.

Full 70-518 Practice