Using DataAbstract and the RemObjects SDK with MonoTouch
One of the more interesting technologies to make its way into my brain in the last year has been MonoTouch. If you’re not familiar with it, MonoTouch is a set of tools and wrappers developed by Novell, the makers of Mono. It allows you to write apps for Apple’s iOS devices – the iPhone, iPad, and iPod Touch – in various .NET languages, including of course C# but also our own Oxygene (aka Delphi Prism).
Up until now, there haven’t been many options for connecting to online services, or for data access. This is changing dramatically, with Data Abstract for Xcode, and coming soon to an iOS device near you, the ability to connect to your existing RemObjects SDK and Data Abstract servers with .NET and MonoTouch! The first glimpse of this new feature will be available in the next Data Abstract for .NET beta drop.
This article will be focusing on writing a MonoTouch client for Data Abstract (DA). I’m going to assume that you’re familiar with the basics of MonoTouch and it’s development environment, MonoDevelop. Also, the sample is currently in C# – an Oxygene version will be available soon.
The first step is getting DA (and the RemObjects SDK) onto your Mac. Copy the entire “RemObjects SDK for .NET” and “Data Abstract for .NET” folders from your windows installation over to a convenient folder on your Mac.
Start a new MonoTouch project. Now you have a choice of which way to reference the RemObjects dlls. You can either:
-
add them as .NET assemblies – browse to the /bin/Monotouch folder in both the SDK and DA folders that you copied earlier. You need RemObjects.SDK.Monotouch.dll from the former and RemObjects.DataAbstract.Monotouch.dll from the latter.
-
add the projects to your solution, and then add them as project references – look for RemObjects.SDK.Monotouch.csproj, and RemObjects.DataAbstract.Monotouch.oxygene. Note that you have to have the Delphi Prism addin for MonoDevelop to go this route.
If you’re using a Relativity server, copy the RelativityDataModule.cs from the sample into your project folder and add it to your project; otherwise, copy the DataModule.cs.
Now to set up the connections. This is how it’s set up in the sample for Relativity:
var fDataModule =new RelativityDataModule();{ TargetURL = fSettings.RelativityTargetURL, DomainName = fSettings.RelativityDomain, SchemaName = fSettings.RelativitySchema, UserID = fSettings.UserID, Password = fSettings.UserID}; |
var fDataModule =new DataModule(){ TargetURL = fSettings.CustomTargetURL, ServiceName = fSettings.CustomDataServiceName, UserID = fSettings.UserID, Password = fSettings.UserID}; |
DataSet lDataset =new DataSet(); fDataModule.DataAdapter.Fill(lDataset, newString[]{ fSettings.TableName}); |