Subscribe to Sergio Tapia - Lost in the GC.        RSS Feed
-----

RSSBus' SalesForce data provider review. Easily access SalesForce data in .NET applications.

Icon Leave Comment
Today I'm going to give a run down on the RSSBus Salesforce ADO.Net Data Provider. It's a tool that lets you easily connect your .NET applications to the wealth of data provided by Salesforce.

I'm not going to go into too much depth of what Salesforce itself provides. Instead, I'll just show you how easy it is to use and integrate their library into an existing or new application.

Per their description:

Quote

The Salesforce Data Provider V2 for ADO.NET gives developers the power to easily connect .NET applications to Salesforce.com data including Leads, Contacts, Opportunities, Accounts, and more! The Salesforce Data Provider makes these Salesforce services look like SQL tables in your applications. With the Salesforce Data Provider V2 for ADO.NET developers can simply DataBind to data, just like using SQL Server.


It can't get much easier than that!


Installation

The installer for the data provider is very small and lightweight, running at 1.88MB. Installer can be found here:
http://www.rssbus.co...e/download.aspx

During installation you will be required to install a registry key entry on your machine with your license credentials, and after that you are good to go.

Very clean and simple.

Demo Applications

After installing the data provider you are given examples of how to use it in both C# and Visual Basic (for Visual Studio 2008 and Visual Studio 2010). There are also examples for both Windows Forms and ASP.Net Webforms. You can easily get up to speed on usage no matter what your target platform is.

Note that the demos are installed on your Program Files folder:
C:\Program Files (x86)\RSSBus\RSSBus ADO.NET Provider for SalesForce V2


Posted Image

Also, be sure to open your solution files (.sln) with elevated permissions as they are in the Program Files directory. Just right click and "Runs as Administrator".
I'll be focusing on the C# approach as that's my "native" language.


Salesforce on ASP.Net Webforms

Open up the C# 2010 Webforms example and run the application to make sure everything is running properly. You're greeted with a simple page that requires you to provide your Salesforce credentials.

Posted Image

You can easily create a free Developer account here:
http://developer.force.com/

Posted Image

After you have created your free account, type in your email, password and access token key.


Get Your Code On

Now that you're all set up, I'll give you a rundown of how this data provider works. If you have the necessary bits installed, feel free to follow along as I show you some basics.

The Salesforce Data Provider gives you classes that let you easily fetch information from the Salesforce service. The ones you will be using mostly will be the SalesForceDataAdapter, SalesForceConnection and SalesForceCommand.

For example, using the code below you can "ping" Salesforce data to get a list of all available tables for information -- pretty useful if you are just starting out with the platform:

string GET_TABLES_QUERY = "SELECT TableName FROM sys_tables";
string TABLE_NAME_FIELD = "TableName";

SalesForceDataAdapter _dataAdapter;
SalesForceConnection _conn;

protected void btnLogin_Click(object sender, EventArgs e) {
	if (Session["connection"] != null) 
	_conn = Session["connection"] as SalesForceConnection;

	else {
	_conn = new SalesForceConnection(String.Format("User={0};Password={1};Access Token={2}", txtUser.Text, txtPass.Text, txtToken.Text));
	Session["connection"] = _conn;
	}

DataTable table = new DataTable();
ddlSheet.DataSource = table;
ddlSheet.DataTextField = TABLE_NAME_FIELD;

try {
	SalesForceCommand _cmd = new SalesForceCommand("SELECT TableName FROM sys_tables", _conn);
        _dataAdapter = new SalesForceDataAdapter(_cmd);
        _dataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;

        _dataAdapter.Fill(table);
ddlSheet.DataBind();
txtQuery.Text = String.Format("SELECT * FROM [{0}]", ddlSheet.Text);

if (!txtLIMIT.Text.Equals(""))
txtQuery.Text += String.Format(" LIMIT {0}", txtLIMIT.Text);

btnExecute.Enabled = true;
    }
catch (Exception ex) {
MessageBox.Show(ex.Message);
    }
}


As you can see the SalesForceConnection requires you to provide a valid string for credentials, using your username, password and access token.

With your list of valid tables you can then construct a SQL query to fetch your data. It's a very simple process to get up and running and in that regard it was a breath of fresh air in comparison with other data providers I have tried in the past.


protected void btnExecute_Click(object sender, EventArgs e) {

	if (_conn == null)
	    _conn = Session["connection"] as SalesForceConnection;

	DataTable table = new DataTable();

	try {
	
	    //In this case, I constructed the query in the txtQuery control.

	    SalesForceCommand _cmd = new SalesForceCommand(txtQuery.Text, _conn);
	    _dataAdapter = new SalesForceDataAdapter(_cmd);
	    SalesForceCommandBuildercommandBuilder = new SalesForceCommandBuilder(_dataAdapter);
	    _dataAdapter.Fill(table);        
	    gvSheets.DataSource = table;
	    gvSheets.DataBind();
	}
	catch (Exception ex) {
	    MessageBox.Show(ex.Message);
	}
    }
}



There are no more steps -- that's all you have to do to access Salesforce data in your .NET applications!

The RSSBus data provider allows all sorts of nifty operations to run seamlessly with minimal configuration overhead, for example:

  • LINQ to Datasets
  • ADO.NET 2.0
  • .NET Framework 2.0, 3.0, 3.5, and 4.0
  • ADO.NET Entity Framework


As you can see from the code above integration won't be a problem to existing code bases. I remember when I tried to integrate a third party component to my WPF application and it complicated things terribly for me. Whereas here you just need a reference to their library.

Posted Image

Easily one of the libraries with least integration resistance I have ever used.

0 Comments On This Entry

 

Trackbacks for this entry [ Trackback URL ]

There are no Trackbacks for this entry

1 user(s) viewing

1 Guests
0 member(s)
0 anonymous member(s)

About Me

Posted Image


Bienvenidos! I'm a USA ex-pat living in Bolivia for the past 10 years. Web development is my forte with a heavy lean for usability and optimization. I'm fluent in both English and Spanish. I guest write for the popular Python website Python Central. Visit my website.

Categories