Introduction to the SmartObject ADO.NET Provider
ADO.NET is a mechanism that provides consistent access to various data sources. You may already be familiar with the standard SQL server ADO provider supplied by Microsoft which makes it easy to connect to and retrieve data from a SQL database, and other software vendors may provide ADO.NET adapters for their own technologies.
As an alternative to the SmartObject Client APIs and Services, K2 also provides an ADO.NET-compatible provider which allows developers to execute SmartObject methods using a SQL-like query syntax. This adapter can be used by most design tools and technologies that are capable of consuming an ADO.NET provider, for example ASP.NET and the Business Intelligence design tools in Microsoft Visual Studio. The most common use cases for the ADO.NET provider is to consume K2 SmartObjects in a simple user interface where the developer is familiar with ADO.NET, and to use the ADO.NET provider to create custom reports against K2 SmartObjects in a technology like Visual Studio Business Intelligence Projects.
The SourceCode.Data.SmartObjectsClient.dll assembly is the assembly that implements the ADO.NET provider, and this assembly is installed in the GAC of the K2 server and on developer workstations when the K2 Core, K2 Studio or K2 for Visual Studio development tools are installed. You can also find the assembly at the following location:
%PROGRAMFILES%\K2\Bin\SourceCode.Data.SmartObjectsClient.dll
If you wish to explore the K2 assemblies in more detail, please refer to the Class Library Reference section of this developer reference.
Advantages of using ADO.NET
- ADO.NET can improve overall development time since query syntax is generally similar between different ADO providers
- Queries follow a familiar SQL-like syntax, see the topic ADO Query Syntax for samples
- All data in ADO.NET is transported in XML format
- K2's ADO provider supports both Read and Write operations
- A variety of development tools support ADO.NET
- ADO.NET can be used from all programming languages that target the .NET Framework
Implementation of ADO.NET in the provider
The K2 SmartObject Data Provider implements an ADO.NET DataProvider by extending the Microsoft System.Data interfaces and abstract base classes. The interfaces were extended to surface the SmartObject API as a data source and to provide SQL-like syntax parsing that translates these SQL-like statements to the equivalent concepts exposed by SmartObjects.
The ADO.NET interfaces includes a set of strongly typed classes that allow it to recognize generic objects like tables, views, and stored procedures, as well as generic properties on these objects. These are known as concepts. What makes the K2 ADO.NET provider unique is how K2 maps these concepts presented by ADO.NET to the Object Orientated concepts exposed by SmartObjects.
A SmartObject consists of Properties and Methods. Methods again consists of Parameters which can be unique to a method or are a “reference” to a SmartProperty defined on the SmartObject.
ADO.NET Concept | SmartObject Concept |
---|---|
Table | Results from a List Method |
Table Column | Return Property from a List Method |
Stored Procedure | Scalar Method (e.g. Create, Read, Update, Delete) |
Stored Procedure Parameters | Input Properties on scalar Methods |
Stored Procedure Columns | Return Properties on scalar Method |