Pass Your Exam On First Try Real Microsoft 70-516 Exam Braindumps (141-150)

QUESTION 141
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 ADO.NET Entity Framework to manage order data. The application makes a Web service call to obtain orders from an order-tracking system. You need to ensure that the orders are added to the local data store. Which method should you call on the ObjectContext?

A.    Attach
B.    AttachTo
C.    AddObject
D.    ApplyCurrentValues

Answer: C

QUESTION 142
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application. You use the Entity Framework Designer to create an Entity Data Model using model-first development. The database has the following requirements:
each table must have a datetime column named time_modified
each table requires a trigger that updates the value of the time_modified column when a row is inserted or updated
You need to ensure that the database script that is created by using the Generate Database From Model option meets the requirements. What should you do?

A.    Create a new T4 template, and set the DDL Generation template to the name of the new template.
B.    Create a new Windows Workflow Foundation workflow, and set Database Generation Workflow to the name of the new workflow.
C.    Add a DateTime property named time_modified to each entity in the model and set the property’s StoreGeneratedPattern to Computed.
D.    Add a new entity named time_modified to the model, and modify each existing entity so that it inherits from the new entity.

Answer: A

QUESTION 143
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 as shown in the following diagram.
1431
You create an ObjectContext instance named objectContext1 and use it to create a SalesPerson instance named person1. You create an ObjectContext instance named objectContext2 and use it to create a SalesTerritory instance named territory1. You need to create and persist a relationship between person1 and terrotory1. What should you do?

A.    Detach person1 from objectContext1.
Attach person1 to objectContext2.
Set the SalesTerritory property of person1 to territory1.
Call SaveChanges on objectContext2.
B.    Attach person1 to objectContext2.
Attach territory1 to objectContext1.
Set the SalesTerritory property of person1 to territory1.
Call SaveChanges on both objectContext1 and objectContext2.
C.    Detach person1 from objectContext1.
Detach territory1 from objectContext2.
Set the SalesTerritory property of person1 to territory1.
Call Refresh on both objectContext1 and objectContext2.
D.    Attach person1 to objectContext2.
Detach territory1 from objectContext2.
Set the SalesTerritory property of person1 to territory1.
Call Refresh on objectContext1.

Answer: A

QUESTION 144
You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to develop an application that uses the Entity Framework. You create the following Entity Data Model.
1441
You add the following code fragment:
using(var context = new AdventureWorksLTEntities())
{
    Customer cust = context.Customers.First();
    cust.CompanyName = "Contoso";
    int count = 0;
}
The changes to the cust entity must be saved. If an exception is thrown, the application will attempt to save up to 3 times.
If not, an exception is thrown. Which code segment should you use?

A.    while(count++ < 3)
{
    try
    {
        context.SaveChanges();
        break;
    }
    catch(Exception)
    {
    }
}
B.    while(cust.EntityState == EntityState.Modified)
{
    try
    {
        context.SaveChanges();
     }
    catch(Exception)
    {
        if(count++ > 2 && context.Connection.State == ConnectionState.Broken
        {
              throw new Exception();
        }
    }
}
C.    while(true)
{
    context.SavingChanges += delegate(System.Object o, System.EventArgs e)
    {
        if(count++ >2)
        {
            throw new Exception();
        }
        context.SaveChanges();
    }
}
D.    while(context.ObjextStateManager.GetObjectStateEntry(cust).OriginalValues.IsDBNull(0))
{
    if(count++ >2)
    {
        break;
    }
    context.SaveChanges();
}

Answer: B

QUESTION 145
You have executed the Where query extension method on your collection, and it returned IEnumerable of Car, but you want to assign this to a variable whose type is List Of Car. How can you convert the IEnumerable of Car to List Of Car?

A.    Use CType (C# cast).
B.    It can’t be done.
C.    Use the ToList() query extension method.
D.    Just make the assignment

Answer: C

QUESTION 146
When working with LINQ to SQL, what is the main object that moves data to and from the database?

A.    DataSet
B.    SqlDataAdapter
C.    DataContext
D.    Entity

Answer: C

QUESTION 147
You want to use LINQ to SQL to run queries on a table that contains a column that stores large photos. Most of the time, you won’t need to view the photo, but occasionally you will need to see it. In the LINQ to SQL designer, which property can you set on the photo column to get the efficient loading of the data for most scenarios but still be able to retrieve the photo when needed?

A.    Skip
B.    Delay Loaded
C.    Take
D.    Auto Generated Value.

Answer: B

QUESTION 148
You retrieved a row of data into an entity object by using a LINQ to SQL DataContext object. You haven’t made any changes to the object, but you know that someone else has modified the data row in the database table, so you rerun your query, using the same LINQ to SQL DataContext object, to retrieve the updated data. What can be said about the result of the second query?

A.    It returns the updated data and you can use it immediately.
B.    The changes are thrown out and you use the cached data, so you don’t see the changes.
C.    An exception is thrown due to the difference in data.
D.    An exception is thrown because you already have the object, so you can’t re-query unless you create a new DataContext object.

Answer: B

QUESTION 149
You ran a LINQ to SQL query to retrieve the products that you are going to mark as discontinued. After running the query, you looped through the returned products and set their Discontinued property to true. What must you do to ensure that the changes go back to the database?

A.    Call the Update method on the DataContext object.
B.    Nothing; the changes are sent when you modify the object.
C.    Call the Dispose method on the DataContext object.
D.    Call the SubmitChanges method on the DataContext object.

Answer: D

QUESTION 150
You are working with an ObjectContext object that targets the mainframe and another ObjectContext object that targets SQL Server. When it’s time to save the changes, you want all changes to be sent to the mainframe and to SQL Server as one transaction. How can you accomplish this?

A.    Just save both ObjectContext objects because they automatically join the same transaction.
B.    Save to the mainframe and use an if statement to verify that the changes were successful. If successful, save to SQL Server.
C.    Wrap the saving of both ObjectContext objects within a TransactionScope object that is implemented in a using statement in which the last line executes the Complete method on the TransactionScope class.
D.    Use a Boolean flag to indicate the success of each save, which will tell you whether the save was successful.

Answer: C

Pass Your Exam On First Try Real Microsoft 70-516 Exam Braindumps

Welcome To Visit PassLeader