Compartilhar via


Data Types Not Supported By the Business Data Connectivity (BDC) Service

Applies to: SharePoint Server 2010

In this article
When Using the Database Connector
When Using the .NET Assembly Connector
When Using the Web Service Connector
General Restrictions of the Business Data Connectivity (BDC) Service

This topic lists the data types that are not supported by the Business Data Connectivity (BDC) service.

When Using the Database Connector

  1. The following data types are not supported: HIERARCHYID and Spatial data types in Microsoft SQL Server 2008.

  2. SQL Server 2008 data types, DATE and DATETIME2, will be mapped to the .NET DateTime.

    1. .NET DateTime can be in the range: 1/1/0001 (the value of MinValue) to 23:59 12/31/9999 (the value of MaxValue).

    2. External lists allow the user to enter the datetime only in the range: 1/1/1900 - 12/31/8900, even though the DateTime2 data type accepts values in range: 1/1/0001 through 12/31/9999. However, the given ranges will work through the BDC object model, so you can work around this by using custom Web Parts.

  3. SQL Server 2008 data type TIME will be mapped to .NET Timespan.

    BDC do not support multiple result sets.

When Using the .NET Assembly Connector

BDC supports all .NET data types when using the .NET assembly connector. Also, when using custom types in the BDC metadata model, the types must be completely defined in the primary assembly.

In the following example, XClass, will not work because it depends on a type that has been defined in a dependent assembly; however YClass will work.

[Dependent Assembly]
Public MyClass 
{
}
[Primary Assembly]
Public XClass : MyClass
{
}
Public YClass
{
}

When Using the Web Service Connector

You should avoid the following in a Web service:

  • DataSet

  • DataTable

However, if you must use them, make sure to include the following property on the LobSystem element for them to work correctly.

<Property Name="ReferenceKnownTypes" Type="System.Boolean">true</Property>

The following will not work in a Web service:

  • Nested struct

  • Nested enum

  • Nested classes

  • Any type that does not have a public parameterless constructor

General Restrictions of the Business Data Connectivity (BDC) Service

  1. BDC does not support structs that are not simple types. Using non-primitive structs will cause data loss and inconsistencies. Do not use non-primitive structs.

  2. BDC does not support nested collections (for example, array of arrays or collections, where the elements of which are also collections). You can have these types, but you cannot model these types as collections. One of the levels must be modeled as a structure with the IsCollection="false" workaround.

  3. BDC does not support multidimensional arrays.

  4. BDC does not support dynamic programming introduced in .NET Framework 4. BDC works only with .NET Framework 3.5. However, you can use the DynamicType class, which works in a similar way.

  5. BDC does not support the ICollection or IEnumerable interfaces to represent collections in data structures, as well as the generic ICollection<T>, IEnumerable<T>, and IList<T> interfaces. All collections must implement IList. This applies to data structures in input and inout parameters, and fields of external items. For the return types of method instances, such as a Finder returning multiple items, we require the return value to implement either IEnumerable or IEnumerator (except for database, where we support onlyIDataReader). BDC does not support generic versions of these IEnumerable<T> and IEnumerator<T>. So for example, for a Web service or .NET assembly, the Finder method can return an enumerator that contains customer objects; however, the customer object cannot contain an enumerable of addresses to represent the list of addresses. Also for the restrictions mentioned in this paragraph, "BDC does not support" means: It will not work if you implement only the not supported interfaces; however, it will work if you implement these not supported interfaces and the ones that BDC requires.