70-516 Exam Dumps Free Download in Braindump2go 100% 70-516 Real Questions (131-140)

MICROSOFT NEWS: 70-516 Exam Questions has been Updated Today! Get Latest 70-516 VCE and 70-516PDF Instantly! Welcome to Download the Newest Braindump2go 70-516 VCE&70-516 PDF Dumps: http://www.braindump2go.com/70-516.html (286 Q&As)

Microsoft Official Exam Center New Released 70-516 Dumps Questions, Many New Questions added into it! Braindump2go Offer Free Sample Questions and Answers for Download Now! Visit Our Webiste, get the new updated Questions then pass Microsoft 70-516 at the first try!

Exam Code: 70-516
Exam Name: TS: Accessing Data with Microsoft .NET Framework 4
Certification Provider: Microsoft
Corresponding Certifications: MCPD, MCPD: Web Developer 4, MCPD: Windows Developer 4, MCTS, MCTS: Microsoft .NET Framework 4, Data Access

70-516 Dumps,70-516 Dumps PDF,70-516 Exam PDF,70-516 Book,70-516 Study Guide,70-516 eBook,70-516 eBook PDF,70-516 Exam Questions,70-516 Training Kit,70-516 PDF,70-516 Microsoft Exam,70-516 VCE,70-516 Braindump,70-516 Braindumps PDF,70-516 Braindumps Free,70-516 Practice Test,70-516 Practice Exam,70-516 Preparation,70-516 Preparation Materials,70-516 Practice Questions

QUESTION 131
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You use the ADO.NET Entity Framework to model your entities.
You use Plain Old CLR Objects (POCO) entities along with snapshot-based change tracking.
The code accesses the POCO entities directly.
You need to ensure that the state manager synchronizes when changes are made to the object graph.
Which ObjectContext method should you call?

A.    Refresh
B.    SaveChanges
C.    DetectChanges
D.    ApplyPropertyChanges

Answer: C
Explanation:
When working with POCO, you must call the DetectChanges method on the ObjectContext to attach the POCO entity to the ObjectContext. Be sure to call DetectChanges prior to calling SaveChanges.
ApplyPropertyChanges Obsolete. Applies property changes from a detached object to an object already attached to the object context.
CHAPTER 6 ADO.NET Entity Framework
Lesson 2: Querying and Updating with the Entity Framework Attaching Entities to an ObjectContext (page 438)

QUESTION 132
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.
The application includes a Customer entity along with a CustomerKey property of the Guid type as shown in the following exhibit:
You discover that when the application adds a new instance of a Customer, calling the SaveChanges method results in the following error message:
“Server generated keys are only supported for identity columns.”
You need to ensure that the application can add new Customer entities.
What should you do?


A.    Add a handler for the ObjectContext.SavingChanges event.
In the event handler, set the CustomerKey value.
B.    Add a handler for the ObjectContext.ObjectMaterialized event.
In the event handler, set the CustomerKey value.
C.    Call the ObjectContext.Attach method before saving a Customer entity.
D.    Call the ObjectContext.CreateEntityKey method before saving a Customer entity.

Answer: A
Explanation:
SavingChanges() Event Occurs when changes are saved to the data source.
ObjectMaterialized() Event Occurs when a new entity object is created from data in the data source as part of a query or load operation.
Attach() Method Attaches an object or object graph to the object context when the object has an entity key.
CreateEntityKey() Creates the entity key for a specific object, or returns the entity key if it already exists.
ObjectContext Class
(http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.aspx)

QUESTION 133
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You use the ADO.NET Entity Framework to model entities.
The application connects to a Microsoft SQL Server database named AdventureWorks.
The application includes the following code segment. (Line numbers are included for reference only.)
01 using (AdventureWorksEntities context = new AdventureWorksEntities())
02 {
03 ObjectQuery <SalesOrderHeader> orders = context.SalesOrderHeader.
    Where(“it.CreditCardApprovalCode IS NULL”).Top(“100”);
04 foreach (SalesOrderHeader order in orders){
05 order.Status = 4;
06 }
07     try {
08         context.SaveChanges();
09     }
10     catch (OptimisticConcurrencyException){
11         …
12     }
13 }
You need to resolve any concurrency conflict that can occur.
You also need to ensure that local changes are persisted to the database.
Which code segment should you insert at line 11?

A.    context.Refresh(RefreshMode.ClientWins, orders);
context.AcceptAllChanges();
B.    context.Refresh(RefreshMode.ClientWins, orders);
context.SaveChanges();
C.    context.Refresh(RefreshMode.StoreWins, orders);
context.AcceptAllChanges();
D.    context.Refresh(RefreshMode.StoreWins, orders);
context.SaveChanges();

Answer: B
Explanation:
SaveChanges() Persists all updates to the data source and resets change tracking in the object context.
Refresh(RefreshMode, Object) Updates an object in the object context with data from the data source.
AcceptAllChanges() Accepts all changes made to objects in the object context. Refresh(RefreshMode refreshMode, Object entity) Method has the dual purpose of allowing an object to be refreshed with data from the data source and being the mechanism by which conflicts can be resolved.
ObjectContext.Refresh Method
(http://msdn.microsoft.com/en-us/library/bb896255.aspx)

QUESTION 134
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 the following object query to load a product from the database. (Line numbers are included for reference only.)
01 using (AdventureWorksEntities advWorksContext = new AdventureWorksEntities())
02 {
03    ObjectQuery <Product> productQuery = advWorksContext.Product.Where(“it.ProductID = 900”);
04    …
05 }
You need to log the command that the query executes against the data source.
Which code segment should you insert at line 04?

A.    Trace.WriteLine(productQuery.ToString());
B.    Trace.WriteLine(productQuery.ToTraceString());
C.    Trace.WriteLine(productQuery.CommandText);
D.    Trace.WriteLine(((IQueryable)productQuery).Expression);

Answer: B
Explanation:
CHAPTER 8 Developing Reliable Applications
Lesson 1: Monitoring and Collecting Performance Data Accessing SQL Generated by the Entity Framework (page 509)

QUESTION 135
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Windows Forms application.
The application connects to a Microsoft SQL Server database.
You need to find out whether the application is explicitly closing or disposing SQL connections. Which code segment should you use?

A.    string instanceName = Assembly.GetEntryAssembly().FullName;
PerformanceCounter perf = new PerformanceCounter(
“.NET Data Provider for SqlServer”,
“NumberOfReclaimedConnections”, instanceName, true);
int leakedConnections = (int)perf.NextValue();
B.    string instanceName = Assembly.GetEntryAssembly().GetName().Name;
PerformanceCounter perf = new PerformanceCounter(
“.NET Data Provider for SqlServer”,
“NumberOfReclaimedConnections”, instanceName, true);
int leakedConnections = (int)perf.NextValue();
C.    string instanceName = Assembly.GetEntryAssembly().FullName;
PerformanceCounter perf = new PerformanceCounter(
“.NET Data Provider for SqlServer”,
“NumberOfNonPooledConnections”, instanceName, true);
int leakedConnections = (int)perf.NextValue();
D.    string instanceName = Assembly.GetEntryAssembly().GetName().Name;
PerformanceCounter perf = new PerformanceCounter(
“.NET Data Provider for SqlServer”,
“NumberOfNonPooledConnections”, instanceName, true);
int leakedConnections = (int)perf.NextValue();

Answer: A
Explanation:
NumberOfNonPooledConnections The number of active connections that are not pooled. NumberOfReclaimedConnections The number of connections that have been reclaimed through garbage collection where Close or Dispose was not called by the application. Not explicitly closing or disposing connections hurts performance.
Use of ADO.NET performance counters
(http://msdn.microsoft.com/en-us/library/ms254503(v=vs.80).aspx)
Assembly Class
(http://msdn.microsoft.com/en-us/library/system.reflection.assembly.aspx)

QUESTION 136
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 write the following code segment that executes two commands against the database within a transaction. (Line numbers are included for reference only.)
01 using(SqlConnection connection = new SqlConnection(cnnStr)) {
02      connnection.Open();
03      SqlTransaction sqlTran = connection.BeginTransaction();
04      SqlCommand command = connection.CreateCommand();
05      command.Transaction = sqlTran;
06      try{
07         command.CommandText = “INSERT INTO Production.ScrapReason(Name) VALUES(‘Wrong size’)”;
08         command.ExecuteNonQuery();
09         command.CommandText = “INSERT INTO Production.ScrapReason(Name) VALUES(’Wrong color’)”;
10         command.ExecuteNonQuery();
11         …
l2   }
You need to log error information if the transaction fails to commit or roll back.
Which code segment should you insert at line 11?

A.           sqlTran.Commit();
}
catch (Exception ex) {
       sqlTran.Rollback();
       Trace.WriteLine(ex.Message);
}
B.           sqlTran.Commit();
}
catch (Exception ex) {
       Trace.WriteLine(ex.Message);
       try {
              sqlTran.Rollback();
       }
       catch (Exception exRollback) {
              Trace.WriteLine(exRollback.Message);
       }
}
C.    catch (Exception ex){
       Trace.WriteLine(ex.Message);
       try{
              sqlTran.Rollback();
       }
       catch (Exception exRollback){
              Trace.WriteLine(exRollback.Message);
       }
}
finaly {
       sqltran.commit( );
}
D.    catch (Exception ex) {
       sqlTran.Rollback();
       Trace.WriteLine(ex.Message);
}
finaly {
       try {
              sqltran.commit( );
       }
       catch (Exception exRollback) {
Trace.WriteLine(excommit.Message);
       }
}

Answer: B
Explanation:
A would work, but B is better since we are checking for possible errors during the rollback. C & D would try to do a rollback before a commit?
The finally block is only executed when the application ends, which may not be the appropriate place to put this logic.
Normally, a finally block would contain code to close a Database connection.
The finally block executes even if an exception arises.

QUESTION 137
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 ADO.NET LINQ to Entity model to retrieve data from the database.
You need to call a function that is defined in the conceptual model from within the LINQ to Entities queries.
You create a common language runtime (CLR) method that maps to the function.
What should you do next?

A.    Declare the method as static.
B.    Declare the method as abstract.
C.    Apply the EdmFunctionAttribute attribute to the method.
D.    Apply the EdmComplexTypeAttribute attribute to the method.

Answer: C
Explanation:
CHAPTER 6 ADO.NET Entity Framework
Lesson 1: What Is the ADO.NET Entity Framework?
Model-Defined Functions (page 413-414)

QUESTION 138
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application.
You use Microsoft ADO.NET Entity Data Model (EDM) to model entities.
You create an entity named Person with a schema defined by the following XML fragment.
<EntityType Name=”CPerson”>
<Key>
<PropertyRef Name=”PersonId” />
</Key>
<Property Name=”PersonId” Type=”Int32″ Nullable=”false” />
<Property Name=”CompanyName” Type=”String” />
<Property Name=”ContactName” Type=”String” />
<Property Name=”ContactTitle” Type=”String” />
<Property Name=”Address” Type=”String” />
</EntityType>
You need to ensure that entities within the application are able to add properties related to the city, region, and country of Person’s address.
What should you do?

A.    Create a new complex type named CAddress that contains the properties for city, region,
and country. Change the Type of the Address property in CPerson to “Self.CAddress”.
B.    Create a SubEntity named Address.
Map the SubEntity to a stored procedure that retrieves city, region, and country.
C.    Create a new entity named Address.
Add a person ID property to filter the results to display only the City, Region, and Country
properties for a specific Person entity.
D.    Create a view named Name that returns city, region, and country along with person IDs.
Add a WHERE clause to filter the results to display only the City, Region and Country
properties for a specific Person entity.

Answer: A

QUESTION 139
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 ADO.NET Entity Framework to model entities.
You need to add a new type to your model that organizes scalar values within an entity.
You also need to map stored procedures for managing instances of the type.
What should you do?

A.    1.Add the stored procedures in the SSDL file along with a Function attribute.
2.Define a complex type in the CSDL file.
3.Map the stored procedure in the MSL file with a ModificationFunctionElement.
B.    1.Add the stored procedures in the SSDL file along with a Function attribute.
2.Define a complex type in the CSDL file.
3.Map the stored procedure in the MSL file with an AssociationEnd element.
C.    1.Use the edmx designer to import the stored procedures.
2.Derive an entity class from the existing entity as a complex type.
3.Map the stored procedure in the MSL file with an AssociationEnd element.
D.    1.Add the stored procedures in the SSDL file along with a Function attribute.
2.Derive an entity class from the existing entity as a complex type.
3.Map the stored procedure in the MSL file with a ModificationFunctionElement.

Answer: A
Explanation:
EndProperty Element (MSL)
(http://msdn.microsoft.com/en-us/library/bb399578.aspx)
AssosiationEnd Attribute
(http://msdn.microsoft.com/en-us/library/cc716774.aspx)

QUESTION 140
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create a Microsoft ASP.NET application.
You want to connect the application to a Microsoft SQL Server Express 2008 database named MyDatabase.
The primary database file is named MyDatabase.mdf and it is stored in the App_Data folder.
You need to define the connection string.
Which connection string should you add to the Web.config file?

A.    Data Source=localhost; Initial Catalog=MyDataBase; Integrated Security=SSPI;
User Instance=True
B.    Data Source=.\SQLEXPRESS; Initial Catalog=MyDataBase; Integrated Security=True;
User Instance=True
C.    Data Source=.\SQLEXPRESS; AttachDbFilename=|DataDirectory|\MyDatabase.mdf;
Integrated Security=True; User Instance=True
D.    Data Source=.\SQLEXPRESS;
AttachDbFilename=|DataDirectory|\App_Data\MyDatabase.mdf;
Integrated Security=SSPI; User Instance=True

Answer: C
Explanation:
CHAPTER 2 ADO.NET Connected Classes
Lesson 1: Connecting to the Data Store
Attaching to a Local SQL Database File with SQL Express (page 73)


Thanks For Trying Braindump2go Latest Microsoft 70-516 Dumps Questions! Braindump2go Exam Dumps ADVANTAGES:
? 100% Pass Guaranteed Or Full Money Back!
? Instant Download Access After Payment!
? One Year Free Updation!
? Well Formated: PDF,VCE,Exam Software!
? Multi-Platform capabilities – Windows, Laptop, Mac, Android, iPhone, iPod, iPad.
? Professional, Quick,Patient IT Expert Team 24/7/3286 Onlinen Help You!
? We served more than 35,000 customers all around the world in last 5 years with 98.99% PASS RATE!
? Guaranteed Secure Shopping! Your Transcations are protected by Braindump2go all the time!
? Pass any exams at the FIRST try!


FREE DOWNLOAD: NEW UPDATED 70-516 PDF Dumps & 70-516 VCE Dumps from Braindump2go: http://www.braindump2go.com/70-516.html (286 Q&A)