tags:

views:

347

answers:

3

Hi,

I am designing a resource access layer that will sit on a database server on a LAN consisting of 5 workstations and 7 servers. My intention for the resource access layer is to expose a set of well defined C# methods to any C# (.Net 3.5) client on the LAN, and allow the client to access data stored in the DBMS without having any knowledge of how the data is being accessed. This is basically an exercise in simple abstraction.

So far I have configured an object relational mapper to retrieve data as entities from the DBMS (MS SQL Server 2008). I have then written a simple data access class that uses those entities to retrieve and insert data. Example methods include GetUser(Int ID) and SetUser(Int ID, String username, String password). All the methods take and return native types and not entity objects or similar wrappers.

I want to make this class remotely accessible on the LAN, so that any C# client code can use the same singleton class to access data in an simple format. In the days of .Net 2.0 the obvious choice would be to use .Net remoting and declare the class to inherit MarshalByRefObject. However with the arrival of .Net 3.5 and WCF there are many more options.

So far I have been reluctant to use WCF for the resource access layer. As I understand it all data is passed as SOAP messages, which is exactly what you want if the data is to traverse the internet and be accessed by multiple platforms but this may be a bit over kill for my needs. All platforms on the LAN are either windows vista or windows server 2008, all have .net 3.5 installed. There is no real need to serialize the data as XML since the all the data is native to the platforms who may need to access it. Another concern I have is speed. This layer needs to be as quick as possible, if the data needs to be transcoded to XML an overhead will be created.

I am looking for any advice on the best .Net technology to use in this situation. I may overlooked a significant benefit WCF can offer me or there may be a way to configure WCF to use very basic payloads. If however my concerns are well founded then I will use .Net remoting in its place.

Apologies for the long question, any advice would be welcome.

Thanks for your time,

James

A: 

you can see a comparison here or a comparison which microsoft made here But if choosed to use wcf , make sure that you dont Create ChannelFactory for each request

Adinochestva
A: 

With WCF you can use TCP/IP binding which is very fast but will only work on windows platforms (which is OK in your case). It works just like any web service except instead of binding to http:// it uses net.tcp://

vidalsasoon
+1  A: 

WCF is very fast and for properly-designed usage it is often faster than .NET remoting. The first article Adinochestva posted dealt with the performance of serializing .NET DataSets, which is the worst-case scenario.

To help you decide which binding to use with WCF for your purposes, take a look at this article from CoDe magazine. The flowchart at the top is very helpful: http://www.code-magazine.com/article.aspx?quickid=0605051&page=3

Near the end there is a description of the various bindings and the serialization method they use.

With .NET remoting you are also requiring a binary dependency be shared on both the client and service, which is not a requirement with WCF. This way you get versioning support you wouldn't get with remoting. Remoting is also a technology that Microsoft is no-longer investing in... they are investing heavily in WCF, however.

Hopefully you will find that the benefits of WCF outweigh its limitations.

Anderson Imes