Creating Advanced Business Data Connectivity Models

advertisement
Microsoft
Course
MicrosoftOfficial
SharePoint
2013
®
Creating Advanced Business Data
Connectivity Models
SharePoint Practice
Module Overview
• Configuring BDC Models for Search
• Developing Custom Connectivity Components
• Working with External Events and Notifications
Lesson 1: Configuring BDC Models for Search
• Searching External Data
• BDC Search Methods
• BDC Model Search Properties
• BDC Model Search Security
• Optimizing Crawl Performance
• Demonstration: Exploring BDC Models for Search
• Discussion: Custom BCS Connectors
Searching External Data
• SharePoint provides several ways to search
external data
Federation
• Protocol Handlers
• BCS Search Connectors
•
• BCS Search Connectors allow non-standardized
external data to be surfaced
•
Example: Custom proprietary, non-database based
data store of files, security and metadata
• Extensibility of SharePoint Search via BCS
Connector model is provided by .NET
programming layer
BDC Search Methods
• Search Connectors using BDC Models require
specific stereotyped methods
IDEnumerator
• StreamAccessor
• BinarySecurityDescriptorAccessor
• SpecificFinder
•
• Performance enhancing methods should be
considered
ChangedIdEnumerator
• DeletedIdEnumerator
•
BDC Model Search Properties
• In addition to stereotyped methods, several
special properties exist to support search
functionality
Used to tell search which crawled properties map to
search specific values
• Examples: DisplayUriField, MimeType,
LastModifiedTimeStampField
•
• Without these search properties, you cannot
select the model as a search content source:
ShowInSearchUI
• RootFinder
•
BDC Model Search Security
• Search security involves two levels
• Authenticate to the external source
• Get security details of items from the source
• External Source Authentication is same as any
BDC model
•
Exception is the search app pool account may be used
as the authenticated caller
• Retrieving security details from a target source
may require a mapping scheme
Example: JohnDoe, Grant =>Contoso\JohnD, NTLM
Allow
• Use the BinarySecurityDescriptorAccessor method
•
Optimizing Crawl Performance
• Indexing large external sources with several
millions of items presents challenges
• Incremental crawls should be implemented
ChangedIdEnumerator
• DeletedIdEnumerator
•
• Utilize the multipart architecture of BDC Search
model
Retrieve file contents via the StreamAccessor
• Retrieve security via the
BinarySecurityDescriptorAccessor
•
• UseClientCachingForSearch property can be
used to cache items
Demonstration: Exploring BDC Models for
Search
In this demonstration, your instructor will
walkthrough a simple BDC Model for searching
external content.
Discussion: Custom BCS Connectors
• What types of application data might you build a
BCS connector to index?
Lesson 2: Developing Custom Connectivity
Components
• BCS External Connectors
• Creating and Deploying .NET Connectivity
Assembly
• Creating and Deploying Custom Connectors
• Storing External System Credentials
• Search Connector Best Practices
• Troubleshooting and debugging BCS Connectors
BCS External Connectors
•
There are four types of BDC Model types
•
•
•
•
•
Database and WCF are easily created using SharePoint
Designer
•
•
Database
WCF
.NET Connectivity
Custom
Deeper level logic such as item level security and incremental
crawl support is not supported
.NET Connectivity and Custom require .NET developed
assemblies via Visual Studio
•
•
Both are .NET based artifacts, difference is in the way they are
implemented
Custom Connector is much more flexible in its ability to
integrate with the search architecture
Creating and Deploying .NET Connectivity
Assembly
• Visual Studio has several wizards and tools to
help support .NET Connector development
•
Mainly relates to the model file, but some support for
.NET connector is provided
• Deployment is two step process
• Deploy Model to BCS
• Call the ImportSPBusinessDataCatalogDotNetAssembly cmdlet to
deploy the assembly
• Once assembly is deployed, SharePoint designer
can be used to create new models
Creating and Deploying Custom Connectors
• Visual Studio support for Custom Connectors is
limited
Support for BDC model file
• Support for Interface implementation signatures
• No auto-generation support of methods or method
signatures
•
• Custom connector models require
implementation of specific interfaces
•
ISystemUtility, IConnectionManager, ITypeReflector,
IAdminsitrableSystem,ISystemPropetyValidator
• Model must have special properties added to
point to interface implementation classes
Storing External System Credentials
• Consider how you will store the credentials used
to connect to the external system
• Common approach is to utilize Secure Store
Service application
Store Application Id in the BDC Model file
• Implement the IContextProperty interface
• Implement code to retrieve the Application Id
• Use the Application Id to retrieve the credentials
• Use credentials to login to remote system
•
Search Connector Best Practices
• No matter what type of connector, ensure you
follow best practices
Handle null values
• Match parameter names
• Handle exceptions
• Avoid large memory usage
• Implement incremental crawl methods
• Use filters to limit data retrieval
•
Troubleshooting and debugging BCS
Connectors
• Utilize Search Crawl Logs and ULS logs to debug
and troubleshoot your BCS Search Connectors
• ULS crawl related logs will be under mssdmn.exe
process
Errors and stack trace will be more detailed than crawl
log entries
• Utilize the ULSViewer.exe tool to easily filter and
monitor for errors
• Attach the Visual Studio Debugger the mssdmn.exe to
debug your .NET connector
•
• Try to avoid common errors to decrease
development time
Lesson 3: Working with External Events and
Notifications
• Event and Notification Features
• Enabling External System Events
• BCS Events Feature
• Implementing BDC Event Methods
• Initiating Subscriptions
• External List Event Receivers
• Demonstration: Working with External Events
Event and Notification Features
• SharePoint 2010 External lists did not support
alerts or event receivers
• New SharePoint 2013 stereotyped operations
allow external lists to participate in notification
features of SharePoint
Alerts
• Event Receivers
• Remote Event Receivers
•
Enabling External System Events
• External system must provide subscription support
OData would provide a Subscribe and Unsubscribe HTTP
method
• Database model would provide a Subscribe and
Unsubscribe stored procedures
• External system must be record subscription data
• Example: DeliveryAddress, EntityName, Columns, User
• When data changes, it is responsibility of external system to
notify SharePoint of changes
• Same event may trigger multiple subscription
notifications
• Response message format must be an Atom feed
response
•
SoporteITC
BCS Events Feature
• BCS Event Support requires a hidden list to be
created to keep track of subscriptions
•
“External Subscriptions Store” list stored in
_private\ExtSubs folder
• Enabled by activating the ExternalSubscriptions
web feature
Implementing BDC Event Methods
• BDC Model has been extended to have two new
stereotypes methods
•
EventSubscriber, EventUnsubscriber
• Special properties drive the method behavior
• IsDeliveryAddress, IsEventType, IsOnBehalfOfField,
SubscriptionIdName
• OData method type requires specific properties
to drive information exchange
•
ODataEntityUrl, ODataHttpMethod, ODataPayloadKind
• Three Message Response Parsers
• Identity, ODataEntryContent, Custom
• Identity is default if none specified
Initiating Subscriptions
• Subscriptions can be created explicitly or
implicitly
Explicit calls are made via the entity’s subscribe method
• Implicit calls are made when alerts or event receivers
are created
•
• Conversely, a subscription can be removed
explicitly or implicitly
Explicit is made via entity’s unsubscribe method
• Implicit is called when an alert or event receiver is
removed
•
External List Event Receivers
• Once subscription methods are configured you
can place event receivers on your external lists
•
ItemAdded, ItemUpdated and ItemDeleted are only
supported events
• A new property of the SPItemEventProperties
class is ExternalNotificationMessage
•
Contains the encoded message that was sent from the
external system
• Convert the message to a string and analyze the
external event changes
Demonstration: Working with External Events
• In this demonstration your instructor will
demonstrate how to deploy an OData BCS model
that support event subscriptions
Lab: Creating and Deploying a .NET Connectivity
Assembly
• Exercise 1: Create a .NET Connectivity Assembly
• Exercise 2: Implementing Entity Methods
• Exercise 3: Deploying and testing a .NET
Connectivity Model
Lab Scenario
Contoso has a subsidiary company called
Northwind that would like to use the Contoso
SharePoint Farm to index their product data. They
have asked you as the Contoso Sr SharePoint
Developer to help them architect and build a
solution. The basic requirements are the
Northwind users would like to be able to search
on product data from multiple data sources using
SharePoint Search and be able to update that data
using SharePoint interfaces. The product data is
spread across two separate databases. They have
asked you to present all the data in the two
databases as a single item in the search results
Lab Scenario
• and in an external list. You have been tasked with
using BCS Search Connector framework to
accomplish this business requirement.
Lab Review
• What is the most important thing to double check
when building your entity model methods and
your entity class methods?
• What is the reason for having multiple methods
that retrieve information about a single items such
as metadata, security and the file contents?
Module Review and Takeaways
Download