RemoXPO – My adaptation of DevExpress Oliver Sturm’s XPO Publication Service
OK, as I promised, here is my adapation of the XPO Publication Service.
Background: Oliver Sturm of DevExpress back in 2006 made a small unofficial helper app(XPO Publication Service, http://community.devexpress.com/blogs/xpo/archive/2006/10/13/388.aspx) which allowed a user to easily expose XPO over .NET Remoting. The issue is most people tried to expose the Datastore itself and DataLayers and what not, the correct practice is exposing just the IDatastore as it has a small signature.
More Background: eXpress Persistent Objects (XPO) is a Object Relation Mapping (ORM) solution provided by DevExpress (DX), XPO is a Object->Database model (ie. You create strongly typed objects to which XPO will handle the persistance to a database store). XPO supports persisting to 16databases out of the box (although you can easily extend their DataStore classes to gain support for your database). See here for more details http://www.devexpress.com/Help/?document=XPO
I decided to use this as a base for my own Windows Service, see my other post http://alfware.com.au/2009/09/devexpress-xpo-and-net-remoting-a-perfect-match/
The differences are:
- You can host multiple publications on the same Channel/Port
- Included compression library from CodeProject (http://www.codeproject.com/KB/IP/remotingcompression.aspx)
The XML looks pretty much the same
<?xml version="1.0" encoding="utf-8" standalone="yes"?><!--IMPORTANT: if you change the namespace of these projects make sure you change it here tooRemoXPO will look for the CreatableClass in this namespace--><XPOPublication xmlns:xpopub="clr-namespace:RemoXPO"><Publication Name="XPOCacheSamePort8880"><Source><xpopub:ConnectionStringSource><ConnectionString>XpoProvider=MSAccess;Provider=Microsoft.Jet.OLEDB.4.0;Mode=Share Deny None;data source=testdb.mdb;user id=;password=;</ConnectionString><AutoCreateOption>DatabaseAndSchema</AutoCreateOption></xpopub:ConnectionStringSource></Source><Target><xpopub:RemotingTarget><Channels><xpopub:TCPTargetChannel><Port>8880</Port><!--NOTE: New elements to enable compression and set the threshold--><compressionEnabled>true</compressionEnabled><!-- The Threshold is the amount of bytes required before compressing the streamSo if it is a very simple text transmission it won't bother compressing it, whereas if itis a large amount of data it will compress, in this example I have set it to 1KB--><compressionThreshold>1000</compressionThreshold></xpopub:TCPTargetChannel></Channels><ServiceName>XPOCache</ServiceName><RemotableClassCreation><!--Note this will create a ICacheToCacheCommunication object and use a DataCacheRoot as Source--><xpopub:CacheRootRemotableClassCreation/></RemotableClassCreation></xpopub:RemotingTarget></Target><!--Using links you can Wrap the datastore in something, such as a DatastoreLogger, which will output the SQL XPO uses when communicating to the Database--><Links><xpopub:FileLoggerLink><FileName>TestDBCacheLog.log</FileName></xpopub:FileLoggerLink></Links></Publication></XPOPublication>
Everything else is pretty much the same. The XML file has some additional elements to set the Compression these are:
<xpopub:TCPTargetChannel><Port>8880</Port><!--NOTE: New elements to enable compression and set the threshold--><compressionEnabled>true</compressionEnabled><!-- The Threshold is the amount of bytes required before compressing the streamSo if it is a very simple text transmission it won't bother compressing it, whereas if itis a large amount of data it will compress, in this example I have set it to 1KB--><compressionThreshold>1000</compressionThreshold></xpopub:TCPTargetChannel>
At this stage you can only expose a IDatastore Class over Remoting, I am hoping to change the RemotableClass to allow for any MarshalByRef object allowing the service to publish not only a XPO Datastore but your BL/Server object as well.
Post a comment if you have issues or suggestions.
I have exposed this via a SVN repository or you can download it here.
http://dev.nqmining.com.au:8080/svn/RemoXPO/trunk
Username: guest
Password: <leave blank>
I personally use VisualSVN for Visual Studio which also uses TortoiseSVN
You can always catch me on Twitter @aussiealf.
Hope it helps someone
UPDATE: Have updated the source to have a sample Client application that will connect to your publication server, all you need to do is either run the Install.bat to install the service on your machine, or you can run the application based server instead. Have updated the SVN repo too.

Should AussieALF stay bald?
Latest Comments
- How to make XPO only...
Hi Sean, Very true ;) however keep in mi... More...
09-Apr-10 - How to make XPO only...
True, but it's worth noting that DX do ... More...
09-Apr-10 - How to make XPO only...
I would have to check with Gary, as alth... More...
09-Apr-10 - How to make XPO only...
Hi, I agree it seems like a "normal" thi... More...
09-Apr-10 - How to make XPO only...
Another question, how does it work with ... More...
09-Apr-10






Comments
I'm newbie in Devexpress products, can you explain using your Service with eXpressApp Framework Solution (Windows Forms Application Project)
However recently of couple of supporting apps that the people use require 3.5 so there is no need to lock myself into 2 anymore.
I have already begun the research and will be implmenting a WCF service in future.
The current structure of RemoXPO wouldn't really make sense in WCF, so you would be better just creating the Service/Contracts as per the sample at community.devexpress.com/blogs/xpo/archive/2006/12/06/513.aspx
One issue I have yet to resolve 100% is compression of WCF, most solutions revolve around IIS compression, there is a WS-Compression for WCF out there but the issue I have is I am looking for this "replacement" service to be Silverlight compatable.
My research is pivoting around the concept of having a WCF Service that can serve up requests for a WinForm and Silverlight application, at this stage the AgXPO is in it's infancy and alot of changes are occuring behind the scenes within DX to get XPO inline with Async operations to support Silverlight, so ultimately I don't think I can serious start on a XPOwcf till 2010.2 which should be out around Oct/Nov this year.
I am more than happy to discuss this further, you can tweet me at @aussiealf or MSN on michael [at.no.spam] expandsoftware.com.au
I might just go the WCF route using Oliver's sample, and worry about compression later if it's required.
Regards,
Tim
Yeah if you are starting new I would agree that starting with WCF would be the best place to start. Ultimately what DevExpress do www.devexpress.com/Home/Announces/Roadmap-2010.xml#frameworks to support Silverlight will ultimately give me what my next path is moving forward from .NET Remoting.
The new Data Transport Layer sounds interesting, and what I believe is in the pipeline is the ability to have a "disconnected" object that can be persisted, meaning you don't have to have the Object tightly held to a Session. Which would open up the scenario of being able to send Objects over your WCF service instead of the backend data communication.
But we will have to wait and see ;) have a good one
RSS feed for comments to this post.