News:

SQL Table To C# Entity Model ConverterEntity Model (Class Properties) to SQL Table ConverterIf you encounter any trouble visiting our site, please contact us.

MCPD- Exam 70-516: Accessing Data with Microsoft .NET Framework 4

  1. Refresh

  2. SaveChanges

  3. DetectChanges

  4. ApplyPropertyChanges

Answer: Answer is c

  1. Add a handler for the ObjectContext.SavingChanges event. In the event handler, set the CustomerKey value.

  2. Add a handler for the ObjectContext.ObjectMaterialized event. In the event handler, set the CustomerKey value.

  3. Call the ObjectContext.Attach method before saving a Customer entity.

  4. Call the ObjectContext.CreateEntityKey method before saving a Customer entity.

Answer: Answer is a

01using (AdventureWorksEntities context = new AdventureWorksEntities()){
02ObjectQuery <SalesOrderHeader> orders =
03context.SalesOrderHeader.Where("it.CreditCardApprovalCode IS NULL").Top("100");
04foreach (SalesOrderHeader order in orders){
05order.Status = 4;
06}
07try {
08context.SaveChanges();
09}
10catch (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?

  1. context.Refresh(RefreshMode.ClientWins, orders);
    context.AcceptAllChanges();
  2. context.Refresh(RefreshMode.ClientWins, orders);
    context.SaveChanges();
  3. context.Refresh(RefreshMode.StoreWins, orders);
    context.AcceptAllChanges();
  4. context.Refresh(RefreshMode.StoreWins, orders);
    context.SaveChanges();
Answer: Answer is b

01using (AdventureWorksEntities advWorksContext = new AdventureWorksEntities())
02{
03ObjectQuery <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?

  1. race.WriteLine(productQuery.ToString());
  2. Trace.WriteLine(productQuery.ToTraceString());
  3. Trace.WriteLine(productQuery.CommandText);
  4. Trace.WriteLine(((IQueryable)productQuery).Expression);
Answer: Answer is b

  1. string instanceName = Assembly.GetEntryAssembly().FullName;
    PerformanceCounter perf = new PerformanceCounter( ".NET Data Provider for SqlServer", "NumberOfReclaimedConnections", instanceName, true);
    int leakedConnections = (int)perf.NextValue();
  2. string instanceName = Assembly.GetEntryAssembly().GetName().Name;
    PerformanceCounter perf = new PerformanceCounter( ".NET Data Provider for SqlServer", "NumberOfReclaimedConnections", instanceName, true);
    int leakedConnections = (int)perf.NextValue();
  3. string instanceName = Assembly.GetEntryAssembly().FullName;
    PerformanceCounter perf = new PerformanceCounter( ".NET Data Provider for SqlServer", "NumberOfNonPooledConnections", instanceName, true);
    int leakedConnections = (int)perf.NextValue();
  4. string instanceName = Assembly.GetEntryAssembly().GetName().Name;
    PerformanceCounter perf = new PerformanceCounter( ".NET Data Provider for SqlServer","NumberOfNonPooledConnections", instanceName, true);
    int leakedConnections = (int)perf.NextValue();
Answer: Answer is a

01using (SqlConnection connection = new SqlConnection(cnnStr)) {
02connection.Open();
03SqlTransaction sqlTran = connection.BeginTransaction();
04SqlCommand command = connection.CreateCommand();
05command.Transaction = sqlTran;
06try {
07command.CommandText = "INSERT INTO Production.ScrapReason(Name) VALUES('Wrong size')";
08command.ExecuteNonQuery();
09command.CommandText = "INSERT INTO Production.ScrapReason(Name) VALUES('Wrong color')";
10command.ExecuteNonQuery();
11
12}

You need to log error information if the transaction fails to commit or roll back. Which code segment should you insert at line 11?

  1. sqlTran.Commit();
    }
    catch (Exception ex) {
    sqlTran.Rollback();
    Trace.WriteLine(ex.Message); }
  2. sqlTran.Commit();
    }
    catch (Exception ex) {
    Trace.WriteLine(ex.Message);
    try {
    sqlTran.Rollback();
    }
    catch (Exception exRollback) {
    Trace.WriteLine(exRollback.Message);
    } } }
  3. catch (Exception ex){
    Trace.WriteLine(ex.Message);
    try{
    sqlTran.Rollback();
    } catch (Exception exRollback){
    Trace.WriteLine(exRollback.Message);
    }}
    finaly { sqltran.commit( );}}
  4. catch (Exception ex) {
    sqlTran.Rollback();
    Trace.WriteLine(ex.Message);
    }
    finaly {
    try {
    sqltran.commit( );
    } catch (Exception exRollback) {
    Trace.WriteLine(excommit.Message); }}
Answer: Answer is b

  1. Declare the method as static.

  2. Declare the method as abstract.

  3. Apply the EdmFunctionAttribute attribute to the method.

  4. Apply the EdmComplexAttribute attribute to the method.

Answer: Answer is c

<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?

  1. "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".

  2. "Create a SubEntity named Address. "Map the SubEntity to a stored procedure that retrieves city, region, and country.

  3. "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.

  4. "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: Answer is a

  1. "Add the stored procedures in the SSDL file along with a Function attribute. "Define a complex type in the CSDL file. "Map the stored procedure in the MSL file with a ModificationFunctionElement.

  2. "Add the stored procedures in the SSDL file along with a Function attribute. "Define a complex type in the CSDL file. "Map the stored procedure in the MSL file with an AssociationEnd element.

  3. "Use the edmx designer to import the stored procedures. "Derive an entity class from the existing entity as a complex type. "Map the stored procedure in the MSL file with an AssociationEnd element.

  4. "Add the stored procedures in the SSDL file along with a Function attribute. "Derive an entity class from the existing entity as a complex type. "Map the stored procedure in the MSL file with a ModificationFunctionElement.

Answer: Answer is a

  1. Modify the .edmx file to include the following line of code.

    <NavigationProperty Name="Type" FromRole="EmployeeType" ToRole="Contractor" />
  2. Modify the .edmx file to include the following line of code.

    <Condition ColumnName="EmployeeType" Value="Contractor" />
  3. Use the Entity Data Model Designer to set up an association between the Contractor class and EmployeeType.

  4. Use the Entity Data Model Designer to set up a referential constraint between the primary key of the Contractor class and EmployeeType.

Answer: Answer is b

Advertisement

BCS Preparation now even more easy. ReadBD is the place where you can find all kind of resources to be successful in BCS,Bank,Islami Bank exam and interview.

Looking for job. Try JobLoader- First ever job search engine in Bangladesh. All open bd jobs now a single mouse click away.

;