100% Valid Dumps For 70-516 Exam Pass: PassLeader have been updated the 286q 70-516 exam dumps and added the new exam questions, in the latest version of 70-516 PDF dumps or VCE dumps, you will get all the new changed 286q 70-516 exam questions, which will help you 100% passing 70-516 exam, and you will get the free version of VCE Player together with your 70-516 VCE dumps. Welcome to visit our website — passleader.com and get your 70-516 exam passed easily!
keywords: 70-516 exam,286q 70-516 exam dumps,286q 70-516 exam questions,70-516 pdf dumps,70-516 vce dumps,70-516 braindumps,70-516 practice tests,70-516 study guide,TS: Accessing Data with Microsoft .NET Framework 4 Exam
QUESTION 1
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. You manually create your own Context class named AdventureWorksDB that inherits from ObjectContext. You need to use AdventureWorksDB to invoke a stored procedure that is defined in the data source. Which method should you call?
A. Translate
B. ExecuteFunction
C. ExecuteStoreQuery
D. ExecuteStoreCommand
Explanation:
ExecuteFunction(String, ObjectParameter[]) Executes a stored procedure or function that is defined in the data source and expressed in the conceptual model; discards any results returned from the function; and returns the number of rows affected by the execution.
ExecuteStoreCommand() Executes an arbitrary command directly against the data source using the existing connection.
ExecuteStoreQuery<TElement>(String, Object[]) Executes a query directly against the data source that returns a sequence of typed results.
Translate<TElement>(DbDataReader) Translates a DbDataReader that contains rows of entity data to objects of the requested entity type.
ObjectContext.ExecuteFunction Method
http://msdn.microsoft.com/en-us/library/dd986915.aspx
QUESTION 2
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application uses the ADO.NET Entity Framework to model entities. You create an entity as shown in the following code fragment.
<EntityType Name=”ProductCategory”>
<Key>
<PropertyRef Name=”ProductCategoryID” />
</Key>
<Property Name=”ProductCategoryID” Type=”int” Nullable=”false” StoreGeneraedPattern=”Identity” />
<Property Name=”ParentProductCategoryID” Type=”int” />
<Property Name=”Name” Type=”nvarchar” Nullable=”false” MaxLength=”50″ />
…
</EntityType>
You need to provide two entity-tracking fields:
– Rowguid that is automatically generated when the entity is created
– ModifiedDate that is automatically set whenever the entity is updated.
Which code fragment should you add to the .edmx file?
A. <Property Name=”rowguid” Type=”uniqueidentifier” Nullable=”false” StoreGeneratedPattern=”Computed”/>
<Property Name=”ModifiedDate” Type=”timestamp” Nullable=”false” StoreGeneratedPattern=”Computed”/>
B. <Property Name=”rowguid” Type=”uniqueidentifier” Nullable=”false” StoreGeneratedPattern=”Identity”/>
<Property Name=”ModifiedDate” Type=”timestamp” Nullable=”false” StoreGeneratedPattern=”Identity”/>
C. <Property Name=”rowguid” Type=”uniqueidentifier” Nullable=”false” StoreGeneratedPattern=”Identity”/>
<Property Name=”ModifiedDate” Type=”timestamp” Nullable=”false” StoreGeneratedPattern=”Computed”/>
D. <Property Name=”rowguid” Type=”uniqueidentifier” Nullable=”false” StoreGeneratedPattern=”Computed”/>
<Property Name=”ModifiedDate” Type=”timestamp” Nullable=”false” StoreGeneratedPattern=”Identity”/>
Answer: C
Explanation:
StoreGeneratedPattern Enumeration
http://msdn.microsoft.com/en-us/library/system.data.metadata.edm.storegeneratedpattern.aspx
QUESTION 3
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Communication Foundation (WCF) Data Services service. The service connects to a Microsoft SQL Server 2008 database. The service is hosted by an Internet Information Services (IIS) 6.0 server. You need to ensure that applications authenticate against user information stored in the database before the application is allowed to use the service. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Configure IIS to require basic authentication.
B. Configure IIS to allow anonymous access.
C. Configure IIS to require Windows authentication.
D. Enable the WCF Authentication Service.
E. Modify the Data Services service to use a Microsoft ASP.NET membership provider.
Answer: BE
QUESTION 4
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Communication Foundation (WCF) Data Services service. You discover that when an application submits a PUT or DELETE request to the Data Services service, it receives an error. You need to ensure that the application can access the service. Which header and request type should you use in the application?
A. an X-HTTP-Method header as part of a POST request
B. an X-HTTP-Method header as part of a GET request
C. an HTTP ContentType header as part of a POST request
D. an HTTP ContentType header as part of a GET request
Answer: A
Explanation:
The X-HTTP-Method header can be added to a POST request that signals that the server MUST process the request not as a POST, but as if the HTTP verb specified as the value of the header was used as the method on the HTTP request’s request line, as specified in [RFC2616] section 5.1. This technique is often referred to as “verb tunneling”. This header is only valid when on HTTP POST requests.
X-HTTPMethod
http://msdn.microsoft.com/en-us/library/dd541471(v=prot.10).aspx
QUESTION 5
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server 2008 database. You create classes by using LINQ to SQL based on the records shown in the exhibit. You need to create a LINQ query to retrieve a list of objects that contains the OrderID and CustomerID properties. You need to retrieve the total price amount of each Order record. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A. from details in dataContext.Order_Detail
group details by details.OrderID
into g
join order in dataContext.Orders on g.Key equals order.OrderID
select new
{
OrderID = order.OrderID,
CustomerID = order.CustomerID,
TotalAmount = g.Sum(od => od.UnitPrice * od.Quantity)
}
B. dataContext.Order_Detail.GroupJoin(dataContext.Orders,
d => d.OrderID, o => o.OrderID,
(dts, ord) => new {
OrderID = dts.OrderID,
CustomerID = dts.Order.CustomerID,
TotalAmount = dts.UnitPrice * dts.Quantity
})
C. from order in dataContext.Orders
group order by order.OrderID into g
join details in dataContext.Order_Detail on g.Key equals
details.OrderID select new
{
OrderID = details.OrderID,
CustomerID = details.Order.CustomerID,
TotalAmount = details.UnitPrice * details.Quantity
}
D. dataContext.Orders.GroupJoin(dataContext.Order_Detail,
o => o.OrderID,
d => d.OrderID,
(ord, dts) => new {
OrderID = ord.OrderID,
CustomerID = ord.CustomerID,
TotalAmount = dts.Sum(od => od.UnitPrice * od.Quantity)
})
Answer: AD
Explanation:
Alterantive A. This is an Object Query. It looks at the Order Details EntitySet and creating a group g based on OrderID.
– The group g is then joined with Orders EntitySet based on g.Key = OrderID
– For each matching records a new dynamic object containing OrderID, CustomerID and TotalAmount is created
– The dynamic records are the results returned in an INumerable Object, for later processing
Alterantive D. This is an Object Query. The GroupJoin method is used to join Orders to OrderDetails.
Parameters for GroupJoin:
1. An Order_Details EntitySet
2. Order o (from the Orders in the Orders Entity Set, picking up Order_id from both Entity Sets)
3. Order_ID from the first Order_Details record from the OD EnitySet
4. Lamda Expression passing ord and dts (ord=o, dts=d)
The body of the Lamda Expression is working out the total and Returning a Dynamic object as in A.
QUESTION 6
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server database. You use the following SQL statement to retrieve an instance of a DataSet object named ds:
SELECT CustomerID, CompanyName, ContactName, Address, City
FROM dbo.Customers
You need to query the DataSet object to retrieve only the rows where the ContactName field is not NULL. Which code segment should you use?
A. from row in ds.Tables[0].AsEnumerable()
where (string)row[“ContactName”] != null
select row;
B. from row in ds.Tables[0].AsEnumerable()
where row.Field<string>(“ContactName”) != null
select row;
C. from row in ds.Tables[0].AsEnumerable()
where !row.IsNull((string)row[“ContactName”])
select row;
D. from row in ds.Tables[0].AsEnumerable()
where !Convert.IsDBNull(row.Field<string>(“ContactName”))
select row;
Answer: B
Explanation:
Field<T>(DataRow, String) Provides strongly-typed access to each of the column values in the specified row. The Field method also supports nullable types.
QUESTION 7
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server database. You use Entity SQL to retrieve data from the database. You need to find out whether a collection is empty. Which entity set operator should you use?
A. ANYELEMENT
B. EXCEPT
C. EXISTS
D. IN
Answer: C
Explanation:
EXISTS Determines if a collection is empty.
Entity SQL Reference
http://msdn.microsoft.com/en-us/library/bb387118.aspx
QUESTION 8
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server database. You use Entity SQL to retrieve data from the database. You need to enable query plan caching. Which object should you use?
A. EntityCommand
B. EntityConnection
C. EntityTransaction
D. EntityDataReader
Answer: A
Explanation:
Whenever an attempt to execute a query is made, the query pipeline looks up its query plan cache to see whether the exact query is already compiled and available.
If so, it reuses the cached plan rather than building a new one.
If a match is not found in the query plan cache, the query is compiled and cached.
A query is identified by its Entity SQL text and parameter collection (names and types).
All text comparisons are case-sensitive.
Query plan caching is configurable through the EntityCommand.
To enable or disable query plan caching through System.Data.EntityClient.EntityCommand. EnablePlanCaching, set this property to true or false.
Disabling plan caching for individual dynamic queries that are unlikely to be used more then once improves performance.
You can enable query plan caching through EnablePlanCaching.
Query Plan Caching
http://msdn.microsoft.com/en-us/library/bb738562.aspx
QUESTION 9
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server 2008 database. You need to ensure that the application calls a stored procedure that accepts a table-valued parameter. You create a SqlParameter object. What should you do next?
A. Set the SqlDbType of SqlParameter to Udt.
B. Set the SqlDbType of SqlParameter to Variant.
C. Set the ParameterDirection of SqlParameter to Output.
D. Set the SqlDbType of SqlParameter to Structured. Set the TypeName of SqlParameter to Udt.
Answer: D
Explanation:
SqlParameter.DbType Gets or sets the SqlDbType of the parameter.
SqlParameter.TypeName Gets or sets the type name for a table-valued parameter. SqlDbType.Structured A special data type for specifying structured data contained in table-valued parameters.
Udt A SQL Server 2005 user-defined type (UDT).
Spatial types
http://msdn.microsoft.com/en-us/library/ff848797.aspx
Types of Spatial Data
http://msdn.microsoft.com/en-us/library/bb964711.aspx
QUESTION 10
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server 2008 database. You need to use a spatial value type as a parameter for your database query. What should you do?
A. Set the parameter’s SqlDbType to Binary.
B. Set the parameter’s SqlDbType to Variant.
C. Set the parameter’s SqlDbType to Udt. Set the parameter’s UdtTypeName to GEOMETRY.
D. Set the parameter’s SqlDbType to Structured. Set the parameter’s TypeName to GEOMETRY.
Answer: C
Explanation:
There are two types of spatial data. The geometry data type supports planar, or Euclidean (flat-earth), data. The geometry data type conforms to the Open Geospatial Consortium (OGC) Simple Features for SQL Specification version 1.1.0. In addition, SQL Server supports the geography data type, which stores ellipsoidal (round-earth) data, such as GPS latitude and longitude coordinates. SqlParameter.UdtTypeName Gets or sets a string that represents a user-defined type as a parameter.
CHAPTER 2 ADO.NET Connected Classes
Lesson 2: Reading and Writing Data
Working with SQL Server User-Defined Types (UDTs) (page 105)
Spatial types
http://msdn.microsoft.com/en-us/library/ff848797.aspx
Types of Spatial Data
http://msdn.microsoft.com/en-us/library/bb964711.aspx
http://www.passleader.com/70-516.html
QUESTION 11
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application contains the following XML fragment:
<ApplicationMenu>
<MenuItem name=”File”>
<MenuItem name=”New”>
<MenuItem name=”Project” />
<MenuItem name=”Web Site” />
</MenuItem>
<MenuItem name=”Open”>
<MenuItem name=”Project” />
<MenuItem name=”Web Site” />
</MenuItem>
<MenuItem name=”Save” />
</MenuItem>
<MenuItem name=”Edit”>
<MenuItem name=”Cut” />
<MenuItem name=”Copy” />
<MenuItem name=”Paste” />
</MenuItem>
<MenuItem name=”Help”>
<MenuItem name=”Help” />
<MenuItem name=”About” />
</MenuItem>
</ApplicationMenu>
The application queries the XML fragment by using the XmlDocument class. You need to select all the descendant elements of the MenuItem element that has its name attribute as File. Which XPath expression should you use?
A. //*[@name=’File’][name()=’MenuItem’]
B. /ApplicationMenu/MenuItem[‘File’]//MenuItem
C. /ApplicationMenu/MenuItem/descendant::MenuItem[‘File’]
D. /ApplicationMenu/MenuItem[@name=’File’]/descendant::MenuItem
Answer: D
Explanation:
http://msdn.microsoft.com/en-us/library/ms256086.aspx
QUESTION 12
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Communication Foundation (WCF) Data Services service. You deploy the service to the following URL: http://contoso.com/Northwind.svc. You want to query the WCF Data Services service to retrieve a list of customer objects. You need to ensure that the query meets the following requirements:
– Only customers that match the following filter criteria are retrieved: City=”Seattle” AND Level > 200.
– Data is sorted in ascending order by the ContactName and Address properties.
Which URL should you use for the query?
A. http://contoso.com/Northwind.svc/Customers?City=Seattle &
Level gt 200 & $orderby=ContactName,Address
B. http://contoso.com/Northwind.svc/Customers?City=Seattle &
Level gt 200 & $orderby=ContactName and Address
C. http://contoso.com/Northwind.svc/Customers?$filter=City eq ‘Seattle’
and Level gt 200 & $orderby=ContactName,Address
D. http://contoso.com/Northwind.svc/Customers?$filter=City eq ‘Seattle’
and Level gt 200 & $orderby=ContactName and Address
Answer: C
Explanation:
CHAPTER 7 WCF Data Services
Lesson 1: What Is WCF Data Services?
Working with Filters (page 474)
Accessing the Service from a Web Browser (WCF Data Services Quickstart)
http://msdn.microsoft.com/en-us/library/dd728279.aspx
Accessing Data Service Resources (WCF Data Services)
http://msdn.microsoft.com/en-us/library/dd728283.aspx
QUESTION 13
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Communication Foundation (WCF) Data Services service. You deploy the data service to the following URL: http://contoso.com/Northwind.svc. You need to update the City property of the Customer record that has its ID value as 123. You also need to preserve the current values of the remaining properties. Which HTTP request should you use?
A. PUT /Northwind.svc/Customers(123)
Host: contoso.com
Content-Type: application/json { City: ‘Seattle’ }
B. PUT /Northwind.svc/Customers(123)
Host: contoso.com
Accept: application/json { City: ‘Seattle’ }
C. MERGE /Northwind.svc/Customers(123)
Host: contoso.com
Content-Type: application/json { City: ‘Seattle’ }
D. MERGE /Northwind.svc/Customers(123)
Host: contoso.com
Accept: application/json { City: ‘Seattle’ }
Answer: C
Explanation:
HTTP Actions
OData supports the following HTTP actions to perform create, read, update, and delete operations on the entity data that the addressed resource represents:
HTTP GET-This is the default action when a resource is accessed from a browser. No payload is supplied in the request message, and a response method with a payload that contains the requested data is returned.
HTTP POST-Inserts new entity data into the supplied resource. Data to be inserted is supplied in the payload of the request message.
The payload of the response message contains the data for the newly created entity.
This includes any autogenerated key values.
The header also contains the URI that addresses the new entity resource. HTTP DELETE-Deletes the entity data that the specified resource represents. A payload is not present in the request or response messages. HTTP PUT – Replaces existing entity data at the requested resource with new data that is supplied in the payload of the request message.
HTTP MERGE-Because of inefficiencies in executing a delete followed by an insert in the data source just to change entity data, OData introduces a new HTTP MERGE action. The payload of the request message contains the properties that must be changed on the addressed entity resource. Because HTTP MERGE is not defined in the HTTP specification, it may require additional processing to route a HTTP MERGE request through non-OData aware servers.
Accessing and Changing Data Using REST Semantics
http://msdn.microsoft.com/en-us/library/dd728282.aspx
HTTP header fields
http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
Accept Content-Types that are acceptable
Content-Type The mime type of the body of the request (used with POST and PUT requests)
A Guide to Designing and Building RESTful WebServices with WCF 3.5
http://msdn.microsoft.com/en-us/library/dd203052.aspx
VB Scenario
Background
You are updating an existing Microsoft .NET Framework 4 application that includes a data layer built with ADO.NET Entity Framework 4. The application communicates with a Microsoft SQL Server 2008 instance named INST01 on a server named SQL01. The application stores data in a database named Contoso in the INST01 instance. You need to update the existing technology and develop new functionality by using Microsoft Visual Studio 2010.
Application and Database Storage
The application tracks bicycle parts as they pass through a factory. Parts are represented by the abstract Part entity and its associated partial classes. Each part has a name stored in the Name field and a unique identifier stored in the Id field.
Parts are either component s (represented by the Component class) such as chains, wheels, and frames, or finished product s (represented by the Product class) such as completed bicycles. The Component class and the Product class derive from the Part class and may contain additional class-specific properties.
Parts may have a color (represented by the Color class), but not all parts have a color, Parts may be composed of other parts, and those parts may in turn be composed of other parts ; any p art represents a tree of the parts that are used to build it, The lowest level of the tree consists of c omponents that do not contain other components.
A product is a p art that has been completed and is ready to leave the factory. A p roduct typically consists of many c omponents (forming a tree of child p arts) but can also be constructed by combining other p roducts and/or c omponents to form a bundled p roduct, such as a bicycle and a helmet that are sold together.
Components and products are stored in a database table named Parts by using a table-per-hierarchy (TPH) mapping. Components have a null ProductType field and a non-null PartType field. Products have a non-null ProductType field and a null PartType field.
The following diagram illustrates the complete Entity data model diagram (EDMX diagram).
The following graphic illustrates detail s of the Part-Color Association.
The following code segments show relevant portions of the files referenced by the case study items. (Line numbers in the samples below are included for reference only and include a two-character prefix that denotes the specific file to which they belong.)
Extension Methods.vb
Model.edmx
Model/Color.vb
Model/Component.vb
ModelContosoEntities.vb
Model IName.vb
Model Part.vb
Model Product.vb
sp_FindObsolete
QUESTION 14
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server 2008 database. The application uses DataContexts to query the database. You create a function that meets the following requirements:
– Updates the Customer table on the database when a customer is marked as deleted.
– Updates the related entries in other tables (CustomerAddress, CustomerContacts) by marking them as deleted.
– Prevents consumer code from setting the Deleted column’s value directly.
You need to ensure that the function verifies that customers have no outstanding orders before they are marked as deleted. You also need to ensure that existing applications can use the update function without requiring changes in the code. What should you do?
A. Override the Delete operation of the DataContext object.
B. Override the Update operation of the DataContext object.
C. Modify the SELECT SQL statement provided to the DataContext object to use an INNER JOIN between the Customer and Orders tables.
D. Add new entities to the DataContext object for the Customers and Orders tables.
Answer: A
QUESTION 15
You use Microsoft Visual Studio 2010 and the Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server database. The application uses DataContexts to query the database. You define a foreign key between the Customers and Orders tables in the database. You need to ensure that when you delete a customer record, the corresponding order records are deleted. You want to achieve this goal by using the minimum amount of development effort. What should you do?
A. Override the Delete operation of the customer entity.
B. Remove the foreign key between the Customers and Orders tables.
C. Use the ExecuteDynamicDelete method of the DataContext object.
D. Modify the foreign key between the Customers and Orders tables to enable the ON DELETE CASCADE option.
Answer: D
Explanation:
DataContext.ExecuteDynamicDelete Method
http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.executedynamicdelete.aspx
QUESTION 16
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server database. The application uses DataContexts to query the database. The application meets the following requirements:
– Stores customer data offline.
– Allows users to update customer records while they are disconnected from the server.
– Enables offline changes to be submitted back to the SQL Server by using the DataContext object.
You need to ensure that the application can detect all conflicts that occur between the offline customer information submitted to the SQL Server and the server version. You also need to ensure that you can roll back local changes. What should you do?
A. Add a try/catch statement around calls to the SubmitChanges method of the DataContext object and catch SqlExceptions.
B. Add a try/catch statement around calls to the SubmitChanges method of the DataContext object and catch ChangeConflictExceptions.
C. Override the Update operation of the DataContext object. Call the ExecuteDynamicUpdate method to generate the update SQL.
D. Call the SubmitChanges method of the DataContext object. Pass System.Data.Linq.ConflictMode.ContinueOnConflict to the method.
Answer: D
Explanation:
FailOnFirstConflict Specifies that attempts to update the database should stop immediately when the first concurrency conflict error is detected. ContinueOnConflict Specifies that all updates to the database should be tried, and that concurrency conflicts should be accumulated and returned at the end of the process. ExecuteDynamicUpdate() Method Called inside update override methods to redelegate to LINQ to SQL the task of generating and executing dynamic SQL for update operations.
ConflictMode Enumeration
http://msdn.microsoft.com/en-us/library/bb345922.aspx
DataContext.ExecuteDynamicUpdate Method
http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.executedynamicupdate.aspx
QUESTION 17
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a multi-tier application. You use Microsoft ADO.NET Entity Data Model (EDM) to model entities. The model contains entities named SalesOrderHeader and SalesOrderDetail. For performance considerations in querying SalesOrderHeader, you detach SalesOrderDetail entities from ObjectContext. You need to ensure that changes made to existing SalesOrderDetail entities updated in other areas of your application are persisted to the database. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
A. Re-attach the SalesOrderDetail entities.
B. Set the MergeOption of SalesOrderDetail to MergeOptions.OverwriteChanges.
C. Set the MergeOption of SalesOrderDetail to MergeOptions.NoTracking.
D. Call ObjectContext.ApplyCurrentValue.
E. Call ObjectContext.ApplyOriginalValue.
Answer: AE
Explanation:
ApplyCurrentValues(Of TEntity) Copies the scalar values from the supplied object into the object in the ObjectContext that has the same key.
The ApplyCurrentValues<TEntity> method is used to apply changes that were made to objects outside the ObjectContext, such as detached objects that are received by a Web service. The method copies the scalar values from the supplied object into the object in the ObjectContext that has the same key. You can use the EntityKey of the detached object to retrieve an instance of this object from the data source. Any values that differ from the original values of the object are marked as modified.
Note, the method does not apply the current values to the related objects of currentEntity. ApplyOriginalValues(Of TEntity) Copies the scalar values from the supplied object into set of original values for the object in the ObjectContext that has the same key.
The ApplyOriginalValues<TEntity> method is used to apply changes that were made to objects outside the ObjectContext, such as detached objects that are received by a Web service. The method copies the scalar values from the supplied object into the object in the ObjectContext that has the same key. You can use the EntityKey of the detached object to retrieve an instance of this object from the data source. Any values that differ from the current values of the object are marked as modified.
Note, the method does not apply the current values to the related objects of originalEntity.
QUESTION 18
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application uses the ADO.NET Entity Framework to manage customer and related order records. You add a new order for an existing customer. You need to associate the Order entity with the Customer entity. What should you do?
A. Set the Value property of the EntityReference of the Order entity.
B. Call the Add method on the EntityCollection of the Order entity.
C. Use the AddObject method of the ObjectContext to add both Order and Customer entities.
D. Use the Attach method of the ObjectContext to add both Order and Customer entities.
Answer: A
Explanation:
Entity Reference (Of Entity) Represents a related end of an association with a multiplicity of zero or one.
QUESTION 19
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server database over the network. The application uses data from multiple related database tables. You need to ensure that the application can be used if the connection is disconnected or unavailable. Which object type should you use to store data from the database tables?
A. DataSet
B. DataAdapter
C. DataReader
D. Data Services
Answer: A
Explanation:
The DataSet, which is an in-memory cache of data retrieved from a data source, is a major component of the ADO.NET architecture. The DataSet consists of a collection of DataTable objects that you can relate to each other with DataRelation objects. You can also enforce data integrity in the DataSet by using the UniqueConstraint and ForeignKeyConstraint objects.
QUESTION 20
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. You use a TableAdapter object to load a DataTable object. The DataTable object is used as the data source for a GridView control to display a table of customer information on a Web page. You need to ensure that the application meets the following requirements:
– Load only new customer records each time the page refreshes.
– Preserve existing customer records.
What should you do?
A. Set the ClearBeforeFill property of the TableAdapter to false.
Use the Fill method of the TableAdapter.
B. Set the ClearBeforeFill property of the TableAdapter to false.
Use the GetData method of the TableAdapter to create a new DataTable.
C. Set the ClearBeforeFill property of the TableAdapter to true.
Use the Fill method of the TableAdapter to load additional customers.
D. Set the ClearBeforeFill property of the TableAdapter to true.
Use the GetData method of the TableAdapter to create a new DataTable.
Answer: A
Explanation:
TableAdapter.Fill Populates the TableAdapter’s associated data table with the results of the TableAdapter’s SELECT command. TableAdapter.Update Sends changes back to the database. For more information, see How to:
Update Data Using a TableAdapter.
TableAdapter.GetData Returns a new DataTable filled with data.
TableAdapter.Insert Creates a new row in the data table. For more information, see How to: Add Rows to a DataTable.
TableAdapter.ClearBeforeFill Determines whether a data table is emptied before you call one of the Fill methods.
Table Adapter Overview
http://msdn.microsoft.com/en-us/library/bz9tthwx(v=vs.80).aspx