Sharepoint学习笔记—习题系列--70-573习题解析 -(Q40-Q44)

2023-05-07,,

Question 40
You need to send a single value from a consumer Web Part to a provider Web Part.
Which interface should you use?
A. IAlertNotifyHandler
B. IWebPartField
C. IWebPartParameters
D. IWebPartRow

解析
本题的目的是在Webpart之间传递“单值”(single value)数据。
直接分析各选项:
选项A. IalertNotifyHandler在 microsoft.sharepoint.dll 中,提供发送警报信息的相关方法。 例如可能通过IAlertNotifyHandler来自定义Alert Email。显然此接口与WebPart之间的连接无关。更谈不上还要在两个Webpart之间传递“单值”数据了
选项B. IWebPartField 此接口用于在Web 部件控件之间实现根据数据字段的连接标准接口,即在它们之间传递“单值”数据,正是本题想要的答案。
选项C. IwebPartParameters: 在 Web 部件连接中,数据通常从提供者发送至使用者。但在某些情况下,提供者需要使用者的参数来确定它应发送回哪些值。IWebPartParameters 接口定义要实现的成员,这些成员有助于从使用者到提供者传递参数。也就是说,它是用来控件发送的数据的。
选项D. IwebPartRow 是一个提供者接口,用于实现Webpart之间传递” 数据行”
所以本题目正确选项应该是B

参考:
http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.webparts.iwebpartfield.aspx

Question 41
You need to connect two Web Parts by using the IWebPartRow interface.
Which method should you use?
A. DataItem
B. GetFieldValue
C. GetRowData
D. GetTableData

解析:
 本题是需要你判断备选项中哪个是属于IwebPartRow接口的方法。
A. DataItem 从字面上判断也绝不是属于”方法”的命名规范,至于它属于哪个类的对象,搜索一下,也许你能找到许多答案,但绝不是本题的答案。
B. GetFieldValue. 属于IwebPartField接口所包含的方法, 此接口用于在Web 部件控件之间实现根据数据字段的连接标准接口,即在它们之间传递“单值”数据
C. GetRowData 属于IWebPartRow接口所包含的方法, IwebPartRow是一个提供者接口,用于实现Webpart之间传递” 数据行”
D. GetTableData 属于IwebPartTable接口所包含的方法, 此接口用于实现在Webpart之间基于整个数据表的传递连接。
所以本题目正确选项应该是C

参考:
http://msdn.microsoft.com/zh-cn/library/microsoft.sharepoint.webpartpages.communication.icellprovider.aspx
http://msdn.microsoft.com/zh-cn/library/dd586425(v=office.11).aspx
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.iwebpartrow.aspx
http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.webparts.iwebpartrow(v=vs.80).aspx
http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.webparts.iwebparttable.aspx

Question 42
You create a sandboxed solution that contains a Web Part.
You need to debug the Web Part by using Microsoft Visual Studio 2010.
To which process should you attach the debugger?
A. owstimer.exe
B. spucworkerprocess.exe
C. spucworkerprocessproxy.exe
D. w3wp.exe

解析:
 本题主要想考你Sandbox Solution的Debug方面的相关知识。
在Sharepoint的开发环境中调试不同的对象有时需要Attach到不同的进程,下面就是一些常见的情况
   1、Farm Solution     -----W3WP.EXE
   2、SandBox Solution   -----PUCWorkerProcess.exe,( SharePoint 在一个独立于主 IIS 应用程序池 (w3wp.exe) 进程的进程 (SPUCWorkerProcess.exe) 中运行沙盒解决方案代码。所以你必须在SPUCWorkerProcess上进行调试)
   3、用到了Full-trust Proxy的SandBox Solution--SPUCWorkerProcessProxy.exe
   4、feature receivers----Feature Receiver默认情况下是自动被Visual Studio 启动。你可以在Visual Studio的部署设置中更改这种设置。
        4.1、feature receivers的 activation/deactivation :根据它被activation/deactivation 的方式,你需要Attaching到不同的进程。
             • 在web界面上启动或停止----W2WP.EXE
             • 在PowerShell中启动或停止---- PowerShell.exe
        4.2、feature receivers的 FeatureInstalled/FeatureUninstalling/FeatureUpgrading(安装/卸载/升级)----- owstimer.exe

所以本题目正确选项应该是B

参考:
http://msdn.microsoft.com/zh-cn/library/ee231562.aspx
http://msdn.microsoft.com/en-us/library/ee231550.aspx
http://www.cnblogs.com/wsdj-ITtech/archive/2011/12/08/2258260.html

Question 43
You create a custom Web Part.
You need to create a class to log Web Part errors to the Unified Logging Service (ULS) logs.
What should you use?
A. the ILogger interface
B. the ILoggingProvider interface
C. the SPDiagnosticsServiceBase class
D. the SPPersistedObject class

解析:
 本题想要实现定义某个类,完成向ULS中写入Error信息的功能。
每台运行 Windows SharePoint Services 3.0 和 Office SharePoint Server 2007 的服务器都会将日志记录信息写入 ULS 日志文件和服务器事件日志。在服务器场中每台运行 SharePoint 的服务器上的 {SharePoint Root}\LOGS 文件夹中找到的 ULS 日志文件可包含相当多的信息,具体取决于诊断日志限制的配置情况。尽管通常情况下日志记录越详细越好,但在日志文件中查找特定项可能会有一定难度。
通过为每个日志项分配唯一性,SharePoint 2010 提高了查找特定日志项的效率。此唯一性(称为相关令牌)是一个在出现错误时提供给用户的 GUID。管理员或开发人员随后可在错误中提取此 GUID 字符串,并使用它在日志文件中搜索特定项。这将加快在日志文件中查找项的速度以便跟踪特定事件。
在 Windows SharePoint Services 3.0 中,写入 SharePoint 跟踪日志和统一日志记录系统 (ULS) 日志的唯一方法是实现在实现其他代码时所需的 IDiagnosticsManager 接口。但在 SharePoint Foundation 中,首选方法是使用 SPDiagnosticsServiceBase 类,该类包含与 ULS 日志进行交互的更简单且更有效的方法,尤其是可轻松实现的 WriteEvent 和 WriteTrace 方法。所以选项C是本题的答案。

选项A. the ILogger interface 此接口是从 .NET Framework 2.0 版中开始新增的,用于定义代码生成任务报告错误时使用的接口。它用于定义 MSBuild 记录器,该记录器订阅生成系统事件。
选项B. the ILoggingProvider interface 此接口提供关于logging providers的通用功能定义。位于Microsoft.SharePoint.Administration命名空间,因此属于Administration管理方面的范畴。此空间提供了管理Windows SharePoint Services deployment的相关类型和成员。

选项D. the SPPersistedObject class  用于为对象提供自动序列化其状态值并持久保存以及在需要时获取前面所保存的值并反序列化的相关方法。也即,它属于定义自定义管理设置方面的类。  在 Windows SharePoint Services 平台上构建应用程序时,您可能需要创建一个类以定义应用程序的自定义属性设置并提供用于存储这些设置的方法。Windows SharePoint Services 3.0 中的 Microsoft.SharePoint.Administration 命名空间引入了对象持久性,使用它可将派生自基础 SPPersistedObject 类的类保留到 Windows SharePoint Services 数据库中。若要创建保留的对象,您可以创建一个类,该类从 SPPersistedObject 或派生自 SPPersistedObject 的 Microsoft.SharePoint.Administration 命名空间中的某个类继承。此类可以定义一个用于存储 Windows SharePoint Services 数据库中的自定义属性设置的对象模型。例如,您可以创建通过某种方式使用 Windows SharePoint Services 的 Windows 服务,这将需要创建一个继承自 SPWindowsService 类的类,以便存储特定于 Windows 服务的设置。已编译的 DLL 将为客户提供一个可用于检索或保存属性的对象模型。Windows SharePoint Services 提供用于存储设置的方法和位置,并管理它们对服务器场中的所有服务器和过程(包括缓存刷新)的可用性。
  在实际使用中,我们也可用它来保存用户的某些配置信息。
 
所以本题目正确选项应该是C

参考:
http://msdn.microsoft.com/zh-cn/library/ee535240(v=office.14).aspx
http://blogs.msdn.com/b/sharepoint_cht/archive/2011/03/24/uls-2.aspx
http://msdn.microsoft.com/zh-cn/library/microsoft.servicemodel.domainservices.tools.ilogger(v=vs.91).aspx
http://msdn.microsoft.com/zh-cn/library/microsoft.sharepoint.administration.iloggingprovider.aspx
http://msdn.microsoft.com/zh-cn/library/gg512103(v=office.14).aspx
http://msdn.microsoft.com/zh-cn/library/bb861848(v=office.12).aspx

Question 44
You create a SharePoint farm solution that contains a Web Part.
You need to debug the Web Part by using Microsoft Visual Studio 2010.
To which process should you attach the debugger?
A. owstimer.exe
B. spucworkerprocess.exe
C. spucworkerprocessproxy.exe
D. w3wp.exe

解析:
 还是关于Sharepoint项目如何Debug的问题。
 参考Question 42
本题目正确选项应该是D,因为Farm Solution是运行于Windows SharePoint Services 进程 (w3wp.exe)上的。

参考:
http://msdn.microsoft.com/en-us/library/ff798425.aspx
http://msdn.microsoft.com/zh-cn/library/ee231550.aspx

Sharepoint学习笔记习题系列--70-573习题解析 -(Q40-Q44)的相关教程结束。

《Sharepoint学习笔记—习题系列--70-573习题解析 -(Q40-Q44).doc》

下载本文的Word格式文档,以方便收藏与打印。