How can you change emp_fn without changing the rest of PassGuideApp (that is using emp_fn)?

DRAG DROP
There is MS Visual Studio 2010 and MS .NET Framework 4 application PassGuideApp.
PassGuideApp connects to a MS SQL Server 2008 database PassGuideDB.
PassGuideApp uses Data Contexts to access data from the database.
There a function emp_fn that updates the employees table when an employee is marked as
deleted, updates related entries in the Employee_Details table by marking them as deleted,
and prevents employee code to directly update the deleted field.
Now you need to improve emp_fn by checking that there are no Emplyee_details entries for
an employee before it is marked as deleted.
How can you change emp_fn without changing the rest of PassGuideApp (that is using emp_fn)?

DRAG DROP
There is MS Visual Studio 2010 and MS .NET Framework 4 application PassGuideApp.
PassGuideApp connects to a MS SQL Server 2008 database PassGuideDB.
PassGuideApp uses Data Contexts to access data from the database.
There a function emp_fn that updates the employees table when an employee is marked as
deleted, updates related entries in the Employee_Details table by marking them as deleted,
and prevents employee code to directly update the deleted field.
Now you need to improve emp_fn by checking that there are no Emplyee_details entries for
an employee before it is marked as deleted.
How can you change emp_fn without changing the rest of PassGuideApp (that is using emp_fn)?

Answer:

Explanation:



Leave a Reply 1

Your email address will not be published. Required fields are marked *


John Galt

John Galt

Not sure if the specified answer is correct. Almost looks like there are some possible code selections missing. In any case, I think the Action #1 may be right:
The Delete operation…
…of the Data Context object should be overriden.

http://www.devart.com/linqconnect/docs/ExecuteDynamicMethods.html

But I also think there should be a 2nd action. I would go with:
…use an outer join.

That would return Employee’s that don’t have Employee_details, and Employee_details that don’t have Employees.

I suspect this question was copied wrong, hopefully won’t come up on the exam.