Skip to content

[Pass Ensure VCE Dumps] Pass 70-516 Exam By Training PassLeader Free 70-516 Braindump (81-100)

Where To Get The 100 Percent Valid 70-516 Exam Dumps? PassLeader — one famous IT Certification Exam Study Materials Supplier — is offer the 100 percent valid 286q 70-516 exam dumps, which covers all the new 70-516 exam questions with detailed explanation and it has been helped many people passing 70-516 exam easily! Welcome to choose the best 286q 70-516 practice test from passleader.com, both 70-516 PDF dumps and 70-516 VCE dumps are available now!

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 81
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses LINQ to SQL. The application contains the following model. Each region contains a single vendor. Customers order parts from the vendor that is located in their region. You need to ensure that each row in the Customer table references the appropriate row from the Vendor table. Which code segment should you use?

A.    SalesDataContext dc = new SalesDataContext(“…”);
var query = from v in dc.Vendors
join c in dc.Customers on v.VendorlD equals c.VendorID
select new { Vendor = v, Customer = c };
foreach (var u in query){
u.Customer.Region = u.Vendor.Region;
}
dc.SubmitChanges();
B.    SalesDataContext dc = new SalesDataContext(“…”);
var query = from c in dc.Customers
join v in dc.Vendors on c.VendorlD equals v.VendorID
select new { Customer = c, Vendor = v };
foreach (var u in query){
u.Vendor.Region = u.Customer.Region;
}
dc.SubmitChanges();
C.    SalesDataContext dc = new SalesDataContext(“…”);
var query = from v in dc.Vendors
join c in dc.Customers on v.Region equals c.Region
select new { Vendor = v, Customer = c };
foreach (var u in query){
u.Customer.VendorlD = u.Vendor.VendorlD;
}
dc.SubmitChanges();
D.    SalesDataContext dc = new SalesDataContext(“…”);
var query = from c in dc.Customers
join v in dc.Vendors on c.Region equals v.Region
select new { Customer = c. Vendor = v };
foreach (var u in query){
u.Vendor.VendorlD = u.Customer.VendorID;
}
dc.SubmitChanges();

Answer: C

QUESTION 82
You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server 200B database. You populate a SqlDataAdapter by using the following code. (Line numbers are included for reference only.)
01 SqlDataAdapter dataAdapter1 = new SqlDataAdapter(“SELECT * FROM [BlogEntries] ORDER BY CreationDate”, connection);
02 cmdBuilder = new SqlCommandBuilder(dataAdapter1);
03 dataAdapter1.Fill(BlogEntryDataSet, “BlogEntries”);
04 ….
05 connection.Close();
You need to update the blog owner for all BlogEntry records. Which code segment should you insert at line 04?

A.    foreach(DataRow row in BlogEntryDataSet.Tables[“BlogEntries”].Rows)
{
row.Item[“BlogOwner””] = “New Owner”;
}
dataAdapter1.Update(BlogEntryDataSet, “BlogEntries”);
B.    foreach(DataRow row in BlogEntryDataSet.Tables[“BlogEntries”].Rows)
{
row.Item[“BlogOwner””] = “New Owner”;
}
dataAdapter1.Fill(BlogEntryDataSet, “BlogEntries”);
C.    SqlDataAdapter dataAdapter2 = new SqlDataAdapter(
“UPDATE [BlogEntries] SET [BlogOwner] = “New ‘Owner’ 3″,
connection);
dataAdapter2.Update(BlogEntryDataSet, “BlogEntries”);
D.    SqlDataAdapter dataAdapter2 = new SqlDataAdapter
(dataAdapterl.UpdateCommand);
dataAdapter2.Fill(BlogEntryDataSet, “BlogEntries”);

Answer: A
Explanation:
SqlDataAdapter.Update()-Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the System.Data.DataSet with the specified System.Data.DataTable name.
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommandbuilder.aspx

QUESTION 83
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses LINQ to SQL. The application contains the following model. You write the following code. (Line numbers are included for reference only.)
01 static void Insert()
02 {
03    NorthwindDataContext dc = new NorthwindDataContext();
04    Customer newCustomer = new Customer();
05    newCustomer.Firstname = “Todd”;
06    newCustomer.Lastname = “Meadows”;
07    newCustomer.Email = “[email protected]”;
08    …..
09    dc.SubmitChanges();
10 }
A product named Bike Tire exists in the Products table. The new customer orders the Bike Tire product. You need to ensure that the correct product is added to the order and that the order is associated with the new customer. Which code segment should you insert at line 08?

A.    Order newOrder = new Order();
newOrder.Product = (from p in dc.Products
where p.ProductName == “Bike Tire”
select p) .First();
B.    Product newProduct = new Product();
newProduct.ProductName = “Bike Tire”;
Order newOrder = new Order();
newOrder.Product = newProduct;
C.    Product newProduct = new Product();
newProduct.ProductName = “Bike Tire”;
Order newOrder = new Order ();
newOrder.Product = newProduct;
newCustomer.Orders.Add(newOrder) ;
D.    Order newOrder = new Order();
newOrder.Product = (from p in dc.Products
where p.ProductName == “Bike Tire”
select p).First();
newCustomer.Orders.Add(newOrder) ;

Answer: D

QUESTION 84
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application that connects to a database by using the Entity Framework. You create an Entity Data Model (EDM) by using the Generate from database wizard for the following tables. You need to ensure that the EDM contains an entity type named Employee that contains all of the data from both tables. What should you do?

A.    Delete the EmployeeAccess entity, create a new property named CanAccessBuildings on the Employee entity, and add a mapping for the new property.
B.    Create an inheritance relationship between the Employee and EmployeeAccess entities, and use CanAccessBuildings as an inheritance condition.
C.    Modify the .edmx file to include the following line of code:
<NavigationProperty Name=”Type” FromRole=”EmployeeAccess” ToRole=”Employee” />
D.    Create a one-to-one association named CanAccessBuildingsAssociation between the EmployeeAccess entity and the Employee entity.

Answer: A
Explanation:
<Association Name=”FK_OrderDetails_Orders1″>
<End Role=”Orders” Type=”StoreDB.Store.Orders” Multiplicity=”1″> <OnDelete Action=”Cascade” />
</End>
<End Role=”OrderDetails” Type=”StoreDB.Store.OrderDetails” Multiplicity=”*” /> <ReferentialConstraint>
<Principal Role=”Orders”>
<PropertyRef Name=”ID” />
</Principal>
<Dependent Role=”OrderDetails”>
<PropertyRef Name=”OrderId” />
</Dependent>
</ReferentialConstraint>
</Association>

QUESTION 85
When working with a data set that has data in it, you decide you want to store the schema, but not the data, of the data set to a file so you can share the schema with other users. Which method must you execute to store the schema?

A.    InferXmlSchema
B.    ReadXmlSchema
C.    WriteXmlSchema
D.    WriteXml

Answer: C

QUESTION 86
Before you can execute a command on a connection object, which method must you execute to prepare the connection?

A.    Open
B.    BeginTransaction
C.    GetSchema
D.    Close

Answer: A

QUESTION 87
You want to set up a secure connection between your application and SQL Server. SQL Server has a trusted certificate that is set up properly. What must you do?

A.    Execute BeginTransaction on the command object.
B.    Add Encrypt=true to the connection string.
C.    Encrypt the CommandText property on the command object.
D.    Close the connection before sending the command.

Answer: B

QUESTION 88
You want to secure the connection strings contained within your Web.config file to ensure that no one can open the file easily and see the connection information. Which tool must you use to encrypt the connection strings?

A.    ASPNET_REGSQL.EXE
B.    CASPOL.EXE
C.    INSTALLUTIL.EXE
D.    ASPNET_REGIIS.EXE.

Answer: D

QUESTION 89
You are going to execute a Select command to SQL Server that returns several rows of customer data. You don’t need a data table to hold the data because you will simply loop over the returned results to build a string of information that will be displayed to the user. You create and open a connection and then create the command and set its properties. Which method on the command will you execute to retrieve the results?

A.    ExecuteScalar
B.    Close
C.    ExecuteReader
D.    ExecuteNonQuery

Answer: C

QUESTION 90
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the Entity Framework Designer to create the following Entity Data Model. You write a method named ValidatePostalCode to validate the postal code for the application. You need to ensure that the ValidatePostalCode method is called before the PostalCode property set method is completed and before the underlying value has changed. Which code segment should you place in the entity’s partial class?

A.    partial void OnPostalCodeChanged(string value)
{
PostalCode = GetValidValue<string>
(value, “ValidatePostalCode”, false, true) ;
}
B.    public string ValidatedPostalCode
{
   set
   {
ValidatePostalCode(value);
      _PostalCode = value;
   }
   get
   {
      return _PostalCode;
   }
}
C.    partial void OnPostalCodeChanging(string value)
{
   ValidatePostalCode(value);
}
D.    public string ValidatedPostalCode
{
   set
   {
      _PostalCode = StructuralObject.SetValidValue
(“ValidatePostalCode”, false);
   }
   get
   {
      return _PostalCode;
   }
}

Answer: C
Explanation:
Another area of extensibility is with the partial methods created on each entity type. There is a pair of partial methods called OnXxxChanging and OnXxxChanged for each property, in which Xxx is the name of the property. The OnXxxChanging method executes before the property has changed, and the OnXxxChanged method executes after the property has changed. To implement any of the partial methods, create a partial class and add the appropriate partial method with implementation code.
CHAPTER 6 ADO.NET Entity Framework
Lesson 1: What Is the ADO.NET Entity Framework?
Partial Classes and Methods(page 390)
How to: Execute Business Logic During Scalar Property Changes
http://msdn.microsoft.com/en-us/library/cc716747.aspx


http://www.passleader.com/70-516.html

QUESTION 91
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the ADO.NET Entity Framework to model entities. You create an entity model as shown in the following diagram. You need to ensure that all Person entities and their associated EmailAddresses are loaded. Which code segment should you use?

A.    var people = context.People.Include
(“EmailAddresses”).ToList();
B.    var people = context.People.Except
(new ObjectQuery<Person>(“Person.EmailAddresses”, context)).ToList();
C.    var people = context.People.Except
(new ObjectQuery<Person>(“EmailAddresses”, context)).ToList();
D.    var people = context.People.Include
(“Person.EmailAddresses”).ToList();

Answer: A
Explanation:
CHAPTER 6 ADO.NET Entity Framework
Lesson 1: What Is the ADO.NET Entity Framework?
Lazy Loading vs. Explicit Loading vs. Eager Loading (page 384)
http://msdn.microsoft.com/en-us/library/bb896272.aspx

QUESTION 92
You use Microsoft .NET Framework 4.0 to develop an application that connects to a local Microsoft SQL Server 2008 database. The application can access a high-resolution timer. You need to display the elapsed time, in sub-milliseconds (<1 millisecond), that a database query takes to execute. Which code segment should you use?

A.    int Start = Environment.TickCount;
command.ExecuteNonQuery();
int Elapsed = (Environment.TickCount) – Start;
Console.WriteLine(“Time Elapsed: {0:N} ms”, Elapsed);
B.    Stopwatch sw = Stopwatch.StartNew();
command.ExecuteNonQuery() ;
sw.Stop() ;
Console.WriteLine(“Time Elapsed: {0:N} ms”,
sw.Elapsed.TotalMilliseconds);
C.    DateTime Start = DateTime.UtcNow;
command.ExecuteNonQuery();
TimeSpan Elapsed = DateTime.UtcNow – Start;
Console.WriteLine(“Time Elapsed: {0:N} ms”, Elapsed.Milliseconds);
D.    Stopwatch sw = new Stopwatch();
sw.Start() ;
command.ExecuteNonQuery();
sw.Stop();
Console.WriteLine(“Time Elapsed: {0:N} ms”, sw.Elapsed.Milliseconds);

Answer: D
Explanation:
Stopwatch Class
http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx

QUESTION 93
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the ADO.NET Entity Framework Designer to model entities. You need to associate a previously deserialized entity named person1 to an object context named model and persist changes to the database. Which code segment should you use?

A.    person1.AcceptChanges();
model.SaveChanges();
B.    model.People.ApplyChanges(person1) ;
model.SaveChanges();
C.    model.AttachTo(“People”, person1);
model.SaveChanges();
D.    model.People.Attach(person1);
model.SaveChanges();

Answer: C
Explanation:
Cosiderations from Attaching and Detaching objects
http://msdn.microsoft.com/en-us/library/bb896271.aspx
The object that is passed to the Attach method must have a valid EntityKey value. If the object does not have a valid EntityKey value, use the AttachTo method to specify the name of the entity set.
Attach Use the Attach method of ObjectContext where the method accepts a single typed entity parameter.
AttachTo The AttachTo method of ObjectContext accepts two parameters. The first parameter is a string containing the name of the entity set.
The second parameter’ type is object and references the entity you want to add.
Attach The Attach method of ObjectSet, which is the entity set’ type, accepts a single typed parameter containing the entity to be added to the ObjectSet.
CHAPTER 6 ADO.NET Entity Framework
Lesson 2: Querying and Updating with the Entity Framework
Attaching Entities to an ObjectContext(page 437)
Attaching and Detaching objects
http://msdn.microsoft.com/en-us/library/bb896271.aspx
http://msdn.microsoft.com/en-us/library/bb896248(v=vs.90).aspx
http://msdn.microsoft.com/en-us/library/bb896248.aspx

QUESTION 94
You use Microsoft .NET Framework 4.0 to develop an application that uses WCF Data Services to persist entities from the following Entity Data Model. You create a new Blog instance named newBlog and a new Post instance named newPost as shown in the following code segment. (Line numbers are included for reference only.)
01 Blog newBlog = new Blog();
02 Post newPost = new Post();
03 ….
04 Uri serviceUri = new Uri(“…”);
05 BlogsEntities context = new BlogsEntities(serviceUri);
06 ….
You need to ensure that newPost is related to newBlog through the Posts collection property and that newPost and newBlog are sent to the service. Which code segment should you insert at line 06?

A.    context.AttachLink(newBlog, “Posts”, newPost);
context.SaveChanges(SaveChangesOptions.Batch) ;
B.    newBlog.Posts.Add(newPost);
context.AddToBlogs(newBlog);
context.AddToPosts(newPost);
context.SaveChanges(SaveChangesOptions.Batch);
C.    newBlog.Posts.Add(newPost);
context.AttachTo(“Blogs”, newBlog);
context.AttachTo(“Posts”, newPost);
context.SaveChanges(SaveChangesOptions.Batch);
D.    newBlog.Posts.Add(newPost);
context.UpdateObject(newBlog);
context.UpdateObject(newPost);
context.SaveChanges(SaveChangesOptions.Batch);

Answer: C
Explanation:
Attaching and Detaching objects
http://msdn.microsoft.com/en-us/library/bb896271.aspx

QUESTION 95
You use Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server 2008 database. The application includes a table adapter named taStore, which has the following DataTable. There is a row in the database that has a ProductID of 680. You need to change the Name column in the row to “New Product Name”. Which code segment should you use?

A.    var dt = new taStore.ProductDataTable();
var ta = new taStoreTableAdapters.ProductTableAdapter();
ta.Fill(dt);
taStore.ProductRow row = (taStore.ProductRow)dt.Rows.Find(680) ;
row.Name = “New Product Name”;
ta.Update(row);
B.    var ta = new taStoreTableAdapters.ProductTableAdapter();
var dt = ta.GetData();
var row = dt.Select(“680”) ;
row[0][“Name”] = “New Product Name”;
ta.Update(row);
C.    var dt = new taStore.ProductDataTable();
var ta = new taStoreTableAdapters.ProductTableAdapter();
ta.Fill(dt);
var dv = new DataView();
dv.RowFilter = “680”;
dv[0][“Name”] = “New Product Name”;
ta.Update(dt);
D.    var dt = new taStore.ProductDataTable();
var row = dt.NewProductRow();
row.ProductID = 680;
row.Name = “New Product Name”;
dt.Rows.Add(row) ;

Answer: A
Explanation:
DataRowCollection.Find() Method To use the Find method, the DataTable object to which the DataRowCollection object belongs to must have at least one column designated as a primary key column. See the PrimaryKey property for details on creating a PrimaryKey column, or an array of DataColumn objects when the table has more than one primary key.
var dt = new CustomersDS.CustomersDataTable();
var ta = new CustomersDSTableAdapters.CustomersTableAdapter();
ta.Fill(dt);
CustomersDS.CustomersRow row = (CustomersDS.CustomersRow)dt.Rows.Find(4); row.Name = “A. Found Customer Id”;
ta.Update(row);
DataTable.Select() Method Gets an array of all DataRow objects that match the filter criteria. To
create the filterExpression argument,
use the same rules that apply to the DataColumn class’s Expression
property value for creating filters.
var ta = new CustomersDSTableAdapters.CustomersTableAdapter();
var dt = ta.GetData();
var row = dt.Select(“CustomerID > 2”);
row[0][“Name”] = “B. Found Customer Id”;
ta.Update(row);
TableAdapter Overview
http://msdn.microsoft.com/en-us/library/bz9tthwx(v=vs.80).aspx

QUESTION 96
You use Microsoft .NET Framework 4.0 to develop an application that exposes a WCF Data Services endpoint. The endpoint uses an authentication scheme that requires an HTTP request that has the following header format:
GET  /OData.svc/Products(1)
Authorization: WRAP access_token “123456789”
You add the following method to your DataService implementation.
01 protected override void OnStartProcessingRequest(ProcessRequestArgs args)
02 {
03      ….
04 }
You need to ensure that the method retrieves the authentication token. Which line of code should you use?

A.    string token = args.OperationContext.RequestHeaders[“Authorization”];
B.    string token = args.OperationContext.RequestHeaders[“WRAP access_token”];
C.    string token = args.OperationContext.ResponseHeaders[“Authorization”];
D.    string token = args.OperationContext.ResponseHeaders[“WRAP access_token”];

Answer: A
Explanation:
OData and Authentication-OAuth WRAP
http://blogs.msdn.com/b/astoriateam/archive/2010/08/19/odata-and-authentication-part-8-oauth-wrap.aspx

QUESTION 97
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that connects to a Microsoft SQL Server 2008 database. You use the ADO.NET Entity Framework Designer to model entities. You add the following stored procedure to the database, and you add a function import to the model.
CREATE PROCEDURE [dbo].[InsertDepartment]
@Name nvarchar(50),
@ID int NULL OUTPUT
AS
INSERT INTO Department (Name) VALUES (@Name)
SELECT @ID = SCOPE_IDENTITY()
You need to insert a new department and display the generated ID. Which code segment should you use?

A.    using (SchoolEntities context = new SchoolEntities())
{
   var  id = new ObjectParameter(“ID”, typeof(int));
   context.InsertDepartment(“Department 1”, id);
   Console.WriteLine(id.Value);
}
B.    using (SchoolEntities context = new SchoolEntities())
{
   var id = context.InsertDepartment(“Department 1”, null);
   Console.WriteLine(id);
}
C.    using (SchoolEntities context = new SchoolEntities())
{
   ObjectParameter id = null;
   context.InsertDepartment(“Department 1”, id);
   Console.WriteLine(id.Value);
}
D.    using (SchoolEntities context = new SchoolEntities())
{
   var id = new ObjectParameter(“ID”, null));
   context.InsertDepartment(“Department 1”, id);
   Console.WriteLine(id.Value);
}

Answer: A
Explanation:
Reference: http://blogs.microsoft.co.il/blogs/gilf/archive/2010/05/09/how-to-retrieve-stored-procedure-output-parametersin-entity-framework.aspx

QUESTION 98
You use Microsoft .NET Framework 4.0 to develop an ASP.NET Web application that connects to a Microsoft SQL Server 2008 database. The application uses Integrated Windows authentication in Internet Information Services (IIS) to authenticate users. A connection string named connString defines a connection to the database by using integrated security. You need to ensure that a SqlCommand executes under the application pool’s identity on the database server. Which code segment should you use?

A.    using (var conn = new SqlConnection())
{
   conn.ConnectionString = connString;
   SqlCommand cmd = null;
   using (HostingEnvironment.Impersonate())
   {
      cmd = new SqlCommand(“SELECT * FROM BLOG”, conn);
   }
   conn.Open();
   var result = cmd.ExecuteScalar();
}
B.    using (var conn = new SqlConnection(connString))
{
   var cmd = new SqlCommand (“SELECT * FROM BLOG, conn);
   conn.Open();
   using(HostingEnvironment.Impersonate())
   {
      var result = cmd.ExecuteScalar();
   }
}
C.    using (var conn = new SqlConneccion())
{
   using (HostingEnvironroent.Impersonate())
   {
      conn.ConnectionString = connString;
   }
   var cmd = new SqlCommand(“SELECT * FROM BLOG, conn);
   conn.Open() ;
   var result = cmd.ExecuteScalar();
}
D.    using (var conn = new SqlConnection())
{
   conn.ConnectionString = connString;
   var cmd = new SqlCommand(“SELECT * FROM BLOG”, conn);
   using (HostingEnvironment.Impersonate())
   {
      conn.Open();
   }
   var result = cmd.ExecuteScalar();
}

Answer: D

QUESTION 99
You use Microsoft .NET Framework 4.0 to develop an ASP.NET 4 Web application. You need to encrypt the connection string information that is stored in the web.config file. The application is deployed to multiple servers. The encryption keys that are used to encrypt the connection string information must be exportable and importable on all the servers. You need to encrypt the connection string section of the web.config file so that the file can be used on all of the servers. Which code segment should you use?

A.    Configuration config = WebConfigurationManager.OpenWebConfiguration(“~”);
ConnectionStringsSection section = (ConnectionStringsSection)config.GetSection(“connectionStrings”);
section.Sectionlnformation.ProtectSection
(“RsaProtectedConfigurationProvider”); config.Save();
B.    Configuration config = WebConfigurationManager.OpenMachineConfiguration(“~”);
ConnectionStringsSection section = (ConnectionStringsSection)config.GetSection(“connectionStrings”);
section.Sectionlnformation.ProtectSection
(“RsaProtectedConfigurationProvider’*); config.Save();
C.    Configuration config = WebConfigurationHanager.OpenWebConfiguration (“~”);
ConnectionStringsSection section = (ConnectionStringsSection)config.GetSection(“connectionStrings”);
section.Sectionlnformation.ProtectSection
(“DpapiProtectedConfigurationProvider”); config.Save ();
D.    Configuration config = WebConfigurationManager.OpenMachineConfiguration (“~”);
ConnectionStringsSection section = (ConnectionStringsSection)config.GetSection(“connectionStrings”);
section.Sectionlnformation.ProtectSection
(“DpapiProtectedConfigurationProvider”); config.Save ();

Answer: A
Explanation:
You encrypt and decrypt the contents of a Web.config file by using System.Configuration . DPAPIProtectedConfigurationProvider from the System.Configuration.dll assembly, which uses the Windows Data Protection API (DPAPI) to encrypt and decrypt data, or by using System.Configuration. RSAProtectedConfigurationProvider, which uses the RSA encryption algorithm to encrypt and decrypt data. When you use the same encrypted configuration file on many computers in a web farm, only System. Configuration.RSAProtectedConfigurationProvider enables you to export the encryption keys that encrypt the data and import them on another server. This is the default setting.
CHAPTER 8 Developing Reliable Applications
Lesson 3: Protecting Your Data
Storing Encrypted Connection Strings in Web Applications (page 555)

QUESTION 100
You use Microsoft .NET Framework 4.0 and the Entity Framework to develop an application. You create an Entity Data Model that has an entity named Customer. You set the optimistic concurrency option for Customer. You load and modify an instance of Customer named loadedCustomer, which is attached to an ObjectContext named context. You need to ensure that if a concurrency conflict occurs during a save, the application will load up-to-date values from the database while preserving local changes. Which code segment should you use?

A.    try
{
   context.SaveChanges();
}
catch(EntitySqlException ex)
{
   context.Refresh(RefreshMode.StoreWins, loadedCustomer);
}
B.    try
{
   context.SaveChanges();
}
catch(OptimisticConcurrencyException ex)
{
   context.Refresh(RefreshMode.ClientWins, loadedCustomer);
}
C.    try
{
   context.SaveChanges();
}
catch(EntitySqlException ex)
{
   context.Refresh(RefreshMode.ClientWins, loadedCustomer);
}
D.    try
{
   context.SaveChanges();
}
catch(OptimisticConcurrencyException ex)
{
   context.Refresh(RefreshMode.StoreWins, loadedCustomer);
}

Answer: B
Explanation:
EntitySqlException Represents errors that occur when parsing Entity SQL command text. This exception is thrown when syntactic or semantic rules are violated.
System.Object
System.Exception
System.SystemException
System.Data.DataException
System.Data.EntityException
System.Data.EntitySqlException
OptimisticConcurrencyException
The exception that is thrown when an optimistic concurrency violation occurs.
System.Object
System.Exception
System.SystemException
System.Data.DataException
System.Data.UpdateException
System.Data.OptimisticConcurrencyException
Optimistic Concurrency (ADO.NET)
http://msdn.microsoft.com/en-us/library/aa0416cz.aspx
http://msdn.microsoft.com/en-us/library/system.data.objects.refreshmode.aspx
http://msdn.microsoft.com/en-us/library/bb738618.aspx


http://www.passleader.com/70-516.html