Sep
15
2009

RemoXPO – My adaptation of DevExpress Oliver Sturm’s XPO Publication Service

User Rating: / 0
PoorBest 

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.

XPOLogoMore 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:

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 too

RemoXPO 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 stream

            So if it is a very simple text transmission it won't bother compressing it, whereas if it
            is 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 stream

            So if it is a very simple text transmission it won't bother compressing it, whereas if it
            is 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.

Comments  

 
0 # Setya 2010-03-01 15:58
Hi,
I'm newbie in Devexpress products, can you explain using your Service with eXpressApp Framework Solution (Windows Forms Application Project)
Reply | Reply with quote | Quote
 
 
0 # im 2010-03-02 06:45
Thanks Aussie, very handy.
Reply | Reply with quote | Quote
 
 
0 # Tim 2010-03-09 06:40
Thanks for this, using it in a commercial product as a Data Provider service.
Reply | Reply with quote | Quote
 
 
0 # Tim 2010-03-09 10:44
Hi, did you consider migrating from Remoting to WCF?
Reply | Reply with quote | Quote
 
 
0 # Michael Proctor [Dx-Squad] 2010-03-09 11:00
Funny you should mention that, in my particular project I was locked into .NET 2 mainly from a corporate POV where the chances of having .NET 3.5 were slimmer than .NET 2, so Remoting allowed the lowest common denominator.

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
Reply | Reply with quote | Quote
 
 
0 # Tim 2010-03-12 06:37
Thanks for detailed response Michael

I might just go the WCF route using Oliver's sample, and worry about compression later if it's required.

Regards,
Tim
Reply | Reply with quote | Quote
 
 
0 # Michael Proctor [Dx-Squad] 2010-03-12 11:00
Hi 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
Reply | Reply with quote | Quote
 

Add comment

Although I believe your free to say what you want, please don't abuse either myself or other peoples, be constructive.


Security code
Refresh

Should AussieALF stay bald?




Results

Latest Comments

My Twitter

Follow me on twitter