Microsoft Exam Center Release New Exam 70-516 Braindump2go Provide Latest 70-516 Dumps for Free Download (41-50)

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)

We never believe in second chances and Braindump2go brings you the best 70-516 Exam Preparation Materials which will make you pass in the first attempt.We guarantee all questions and answers in our 70-516 Dumps are the latest released,we check all exam dumps questions from  time to time according to Microsoft Official Center, in order to guarantee you can read the latest questions!

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 41
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 create the classes shown in the following exhibit:
You add the following code segment to the application. (Line numbers are included for reference only.)
01 public void QueryPlayers (List <League> leagues) {
02 …
03 }
You create a LINQ query to retrieve a collection of Player objects.
You need to ensure that the collection includes all the players from each team and every league. Which code segment should you insert at line 02?
A.    var query =
leagues.Select(l => l.Teams.Select(t => t.Players));
B.    var query =
leagues.Select(l => l.Teams.SelectMany(t => t.Players));
C.    var query =
leagues.SelectMany(l => l.Teams.SelectMany(t => t.Players));
D.    var query =
leagues.SelectMany(l => l.Teams.Select(t => t.Players));

Answer: C

QUESTION 42
How do you call a model-defined function as static method on a custom class?

A.    Add a class to your application with a static method that does the following:
Apply an EdmFunctionAttribute to the method and ensure it accepts an IQueryable argument
and returns the results of the Execute method that is returned by the Provider property.
B.    Add a class to your application with a static method that does the following:
Apply an EdmFunctionAttribute to the method and ensure it accepts IEntityWithRelationships
argument and returns the results of the Execute method that is returned by the Provider
property.
C.    Add a class to your application with a static method that does the following:
Apply an EdmFunctionAttribute to the method and ensure it accepts ICollection argument
and returns the results of the Execute method that is returned by the Provider property.
D.    Add a class to your application with a static method that does the following:
Apply an EdmFunctionAttribute to the method and ensure it accepts
and returns the results of the Execute method that is returned by the Provider property.

Answer: A
Explanation:
To call a model-defined function as static method on a custom class:
1.Add a class to your application with a static method that does the following:
– Maps to the function defined in the conceptual model. To map the method, you must apply an
EdmFunctionAttribute to the method.
Note that the NamespaceName and FunctionName parameters of the attribute are the namespace name of the conceptual model and the function name in the conceptual model, respectively.
– Accepts an IQueryable argument.
– Returns the results of the Execute method that is returned by the Provider property.
2.Call the method as a member a static method on the custom class
Example:
– function mapping
<Function Name=”GetDetailsById”
ReturnType=”Collection(AdventureWorksModel.SalesOrderDetail)”>
<Parameter Name=”productID” Type=”Edm.Int32″ />
<DefiningExpression>
SELECT VALUE s
FROM AdventureWorksEntities.SalesOrderDetails AS s
WHERE s.ProductID = productID
</DefiningExpression>
</Function>
– source code
public partial class AdventureWorksEntities : ObjectContext {
[EdmFunction(“AdventureWorksModel”, “GetDetailsById”)]
public IQueryable<SalesOrderDetail> GetDetailsById(int productId)
{
return this.QueryProvider.CreateQuery<SalesOrderDetail>(Expression.Call(
Expression.Constant(this),
(MethodInfo)MethodInfo.GetCurrentMethod(),
Expression.Constant(productId, typeof(int))));
}
}
How to: Call Model-Defined Functions as Object Methods
(http://msdn.microsoft.com/en-us/library/dd456845.aspx)
How to: Call Model-Defined Functions in Queries
(http://msdn.microsoft.com/en-us/library/dd456857.aspx)

QUESTION 43
The database contains a table named Categories.
The Categories table has a primary key identity column named CategoryID.
The application inserts new records by using the following stored procedure.
CREATE PROCEDURE dbo.InsertCategory
@CategoryName nvarchar(15),
@Identity int OUT
AS
INSERT INTO Categories (CategoryName) VALUES(@CategoryName)
SET @Identity = SCOPE_IDENTITY()
RETURN @@ROWCOUNT
You write the following code segment.
SqlDataAdapter adapter = new SqlDataAdapter(“SELECT categoryID, CategoryName FROM dbo.Categories”,connection);
adapter.InsertCommand = new SqlCommand(“dbo.InsertCategory”, connection);
adapter.InsertCommand.CommandType = commandType.StoredProcedure;
adapter.InsertCommand.Parameters.Add(new SqlParameter(“@CategoryName”, SqlDbType.NVarChar, 15,”CategoryName”));
You need to retrieve the identity value for the newly created record.
Which code segment should you add?

A.    SqlParameter parameter =
adapter.InsertCommand.Parameters.Add(“@CategoryName”, SqlDbType.Int);
parameter.Direction = ParameterDirection.Output;
parameter =
adapter.InsertCommand.Parameters.Add(“@Identity”, SqlDbType.Int, 0,
“CategoryID”);
parameter.Direction = ParameterDirection.Output;
B.    SqlParameter parameter =
adapter.InsertCommand.Parameters.Add(“@CategoryName”, SqlDbType.Int);
parameter.Direction = ParameterDirection.Output;
parameter =
adapter.InsertCommand.Parameters.Add(“@Identity”, SqlDbType.Int, 0,
“CategoryID”);
parameter.Direction = ParameterDirection.ReturnValue;
C.    SqlParameter parameter =
adapter.InsertCommand.Parameters.Add(“@RowCount”, SqlDbType.Int);
parameter.Direction = ParameterDirection.ReturnValue;
parameter =
adapter.InsertCommand.Parameters.Add(“@Identity”, SqlDbType.Int, 0,
“CategoryID”);
parameter.Direction = ParameterDirection.Output;
D.    SqlParameter parameter =
adapter.InsertCommand.Parameters.Add(“@RowCount”, SqlDbType.Int);
parameter.Direction = ParameterDirection.Output;
parameter =
adapter.InsertCommand.Parameters.Add(“@Identity”, SqlDbType.Int, 0,
“CategoryID”);
parameter.Direction = ParameterDirection.ReturnValue;

Answer: C

QUESTION 44
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 a Microsoft ADO.NET SQL Server managed provider.
“Data Source=myServerAddress; Initial Catalog=myDataBase; User Id=myUsername; Password=secret;”
You need to ensure that the database credentials are secure.
Which is the correct Property to insert?

A.    Integrated Security=SSPI;
B.    Persist Security Info=true;
C.    Persist Security Info=false;
D.    Integrated Security=false;

Answer: C
Explanation:
Persist Security Info
Default: ‘false’
When set to false or no (strongly recommended), security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state.
Resetting the connection string resets all connection string values including the password.
Recognized values are true, false, yes, and no.
SSPI
(http://msdn.microsoft.com/en-us/library/windows/desktop/aa380493(v=vs.85).aspx)

QUESTION 45
You use Microsoft .NET Framework 4.0 to develop an ASP.NET application.
The application uses Integrated Windows authentication.
The application accesses data in a Microsoft SQL Server 2008 database that is located on the same server as the application.
You use the following connection string to connect to the database.
Integrated Security=SSPI; Initial Catalog=AdventureWorks;
The application must also execute a stored procedure on the same server on a database named pubs.
Users connect to the ASP.NET application through the intranet by using Windows-based authentication.
You need to ensure that the application will use connection pooling whenever possible and will keep the number of pools to a minimum.
Which code segment should you use?

A.    command.CommandText = “USE [pubs]; exec uspLoginAudit;”;
using (SqlConnection connection = new SqlConnection(
“Initial Catalog=AdventureWorks; Integrated Security=SSPI;
MultipleActiveResultSets=True”))
{
connection.Open();
command.ExecuteNonQuery();
}
B.    command.CommandText = “exec uspLoginAudit;”;
using (SqlConnection connection = new SqlConnection(
“Integrated Security=SSPI;”))
{
connection.Open();
command.ExecuteNonQuery();
}
C.    command.CommandText = “USE [pubs]; exec uspLoginAudit;”;
using (SqlConnection connection = new SqlConnection(
“Integrated Security=SSPI; Initial Catalog=AdventureWorks”))
{
connection.Open();
command.ExecuteNonQuery();
}
D.    command.CommandText = “exec uspLoginAudit;”;
using (SqlConnection connection = new SqlConnection(
“Integrated Security=SSPI; Initial Catalog=pubs”))
{
connection.Open();
command.ExecuteNonQuery();
}

Answer: C
Explanation:
Working with Multiple Active Result Sets
(http://msdn.microsoft.com/en-us/library/yf1a7f4f(v=vs.80).aspx)
SSPI
(http://msdn.microsoft.com/en-us/library/windows/desktop/aa380493(v=vs.85).aspx)

QUESTION 46
You use Microsoft Visual Studio 2010 and .NET Framework 4.0 to enhance and existing application use Entity Framework.
The classes that represent the entites in the model are Plain old CLR Object (POCO) Classes.
You need to connect the existing POCO classes to an entity framework context.
What should you do?

A.    1. Generate a MetadataWorkspace and create an ObjectContext for the model.
2. Disable Proxy object creation on the ContextOptions of the ObjectContext.
3. Enable lazy loading on the ContextOptions of the ObjectContext.
B.    1. Generate a MetadataWorkspace and create an ObjectContext for the model.
2. Create an ObjectSet fort he POCO classes.
3. Disable Proxy object creation on the ContextOptions of the ObjectContext.
C.    1. Generate an Entity Data Model fort he POCO classes.
2. Create an ObjectSet fort he POCO classes.
3. Disable Proxy object creation on the ContextOptions of the ObjectContext.
4. Enable lazy loading on the ContextOptions of the ObjectContext.
D.    1. Generate an Entity Data Model for the POCO classes.
2. Create an ObjectSet for the POCO classes.
3. Set Code Generation Strategy on the Entity Data Model to none.
4. Create an ObjectContext for the model.

Answer: D

QUESTION 47
You use Microsoft Visual Studio 2010 and .NET Framework 4.0 to develop an application.
You use entity Framework Designer to create an Entity Data Model from an existing database by using the Generate From Database wizard.
The model contains an entity type named Product.
The Product type requires an additional property that is not mapped to database colomn.
You need to add the property to product.
What should you do?

A.    Add the property in the generated class file, and select Run Custom Tool from the solution
menu.
B.    Add the property in a partial class named Product in a new source file.
C.    Create a comlex type with the name of the property in the Entity Framework Designer.
D.    Create a function import with the name of property in the Entity Framework Designer.

Answer: B

QUESTION 48
You use Microsoft Visual Studio 2010 and .NET Framework 4.0 to develop an application that uses the Entity Framewok.
You need to execute custom logic when an entity is attached to the ObjectContext.
What should you do?

A.    Create a partial method named OnStateChanged in the partial class for the entity.
B.    Create a partial method named OnAttached in the partial class for the entity.
C.    Create an event handler to handle the ObjectStateManagerChanged event.
D.    Create an event handler to handle the ObjectMaterialized event.

Answer: C
Explanation:
ObjectStateManagerChanged Occurs when entities are added to or removed from the state manager.
ObjectMaterialized Occurs when a new entity object is created from data in the data source as part of a query or load operation.
ObjectStateManagerChanged Event
(http://msdn.microsoft.com/en-us/library/system.data.objects.objectstatemanager.objectstatemanagerchanged.aspx)
ObjectMaterialized Event
(http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.objectmaterialized.aspx)

QUESTION 49
You use Microsoft Visual Studio 2010 and .NET Framework 4.0 to develop an application that uses the Entity Data Model for the fallowing database tables.
You need to ensure that the entity that is mapped to the ContectTypeDerived table derives from the entity that is mapped to the ContentTypeBase table.
What should you do?
A.    Use a Table-Per-Type mapping method.
B.    Use a Table-Per-Hierarchy mapping method.
C.    Create a function import for each entity.
D.    Create a complect type for each entity.

Answer: A

QUESTION 50
You use Microsoft Visual Studio 2010 and .NET Framework 4.0 to create an application.
The application connects to a Microsoft SQL Server 2008 database.
The application contains the following code segment.
string SQL = string.Format(
“SELECT * FROM Customer WHERE CompanyName LIKE  ‘%{0}%’,
companyName);
var cmd = new SqlCommand(SQL, con);
You need to reduce the vulnerability to SQL injection attacks.
Which code segment should you use?

A.    string SQL = “SELECT * FROM Customer Where “ +
“CompanyName LIKE @companyName”;
var cmd = new SqlCommand(SQL,con);
cmd.Parameters.AddWithValue(“@companyName”,
string.Format(“%{0}%”, companyName));
B.    string SQL = “SELECT * FROM Customer Where “ +
“CompanyName LIKE @companyName”;
var cmd = new SqlCommand(SQL,con);
var param = new SqlParameter (“@companyName”,
string.Format(“%{0}%”, companyName));
C.    string SQL = string.Format(“SELECT * FROM “ +
“ Customer Where CompanyName LIKE {0}”,
new SqlCommand(“@companyName”,
string.format(“%{0}%”, companyName)));
var cmd = new SqlCommand(SQL, con);
D.    string SQL = “SELECT” * FROM Customer @companyName;
var cmd = new sqlcommand(SQL,con);
cmd.Parameters.AddWithValue(“companyName”,
string.format(“where companyName LIKE ‘%{0}%’”,
companyName));

Answer: A
Explanation:
SqlParameterCollection.AddWithValue Method
(http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlparametercollection.addwithvalue.aspx)


Latest 70-516 Questions and Answers from Microsoft Exam Center Offered by Braindump2go for Free Share Now! Read and remember all Real Questions Answers, Guaranteed Pass 70-516 Real Test 100% Or Full Money Back!


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