Dynamic Method Binding in .NET

Dynamic Method Binding technology allows you to connect your Data Abstract client to to any custom defined remote service methods by providing dynamic mappings between client calls and the server methods.

Introduction

Client/server applications are known to not be the optimal choice when dealing with a large number of users and for working across the Internet. While multi-tier applications solve both of those problems, they also introduce new ones.

The hardest one to deal with, when moving from the client/server world, is probably related to fetching data. For instance, what will happen if a query returns 100,000 rows and the client is connected to your server using a 56k dial-up connection?

While in most cases problems like this only arise from an inappropriate user interface design, it's also possible that the connection used is just too slow to support even a minimal set of records. Users don't like to wait 5 or 10 seconds after they press a button, and this might ultimately affect your business.

Current Solutions

Frameworks like ADO.NET promote an all-or-nothing approach: you send all the records in one shot, including both the master and detail tables. While this might simplify development and greatly enhance scalability, it's definitely not the most appropriate solution for all cases. What if you don't know what you are looking for (e.g. trying to find an order that was processed last year) and your result set contains half a million records?

Data Abstract's approach

Data Abstract's Dynamic Method Binding avoids these problems and provides a data streaming solution that fits your business problems and design taste.

Data Abstract supports incremental (or paged) fetch for large row sets, details-on-demand, all-in-one-shot and combinations of the above (e.g. master page and details on demand). All this in a completely stateless fashion, allowing you to use the specific RDBMS dialect/engine at its best.

Example

Suppose that, in order to read data from your service, you want to use a custom defined method called MyCustomGetDataMethod which takes two input parameters (DataTableNames of type AnsiString, and ParameterTwo of type Integer) and returns a Binary stream.

The RODL file included in your server would look somewhat similar to this:

In order for your clients RemoteDataAdapter(class) to invoke this new method (instead of the default GetData), you will need to make use of Dynamic Method Binding and modify the value of its DataRequestCall property to point to this method.

The first thing you would do is query the remote service for all the available methods by opening the drop down associated with the DataRequestCall.MethodName:

After selecting the appropriate method, the IDE designers will update the parameters contained in the DataRequestCall.Parameters collection and inform you of that through a message similar to the following:

Now you can set the DataRequestCall.OutgoingTableNamesParameter and IncomingDataParameter to the appropriate values like show in the following screenshot:

Once these steps are complete, your RemoteDataAdapter(class) is set up. Any subsequent calls to the Fill method will invoke your custom MyCustomGetDataMethod method on the server.

Conclusion

Dynamic Method Binding provides a truly object oriented way to fetch data and, at the same time, increases design elegance because it does not restrict data-fetching to predefined (and often rigid) method calls.

DataTables are capable of fetching data in a variety of ways providing a solution to almost every possible scenario that you might face when streaming data, from tiny to huge record sets.

By combining these, you can design services and clients that are easy to code and maintain.

See Also

The following Data Abstract for .NET classes: