Correct way of implementing database access using .net remoting

813 views Asked by At

Im looking to implement a .net remoting system, where a number of clients will need access to a server database. Client calls may be concurrent, but Im wanting to queue client requests to the database to avoid concurrent database access.

Im just learning .net remoting and have read about singlecall, singleton and client activated objects. Do any of these methods do what I want or at least support what I want?

Also, should I be using .net remoting or is the way to go WCF?

Kind Regards

Ash

2

There are 2 answers

0
Doctor Jones On BEST ANSWER

You might want to look at creating a WCF Data Service. You should definitely look at this rather than Remoting.

In a nutshell, you can use it to expose an Entity Framework or Linq to SQL model as a Webservice. It's pretty neat!

Marc Gravell has a very good blog post on the topic: http://marcgravell.blogspot.com/2008/12/astoria-and-linq-to-sql-getting-started.html.

Update: I don't know if you can configure the data service itself to queue requests, but you might be able to achieve it by configuring IIS to queue the requests for you. There will probably be a web.config setting you can use to do it.

One request at a time is a bit of an odd requirement though... WCF Data Services do support optimistic concurrency, might that be better suited to your needs? Without more information on your requirements it's only a guess, but it's worth considering.

I'm not sure why you're trying to achieve one request at a time, but it's worth asking yourself if there's a better way of achieving your goal. Limiting database access to one user at a time seems very heavy handed to me.

0
John Saunders On

.NET Remoting has been deprecated in favor of WCF. You should not be using it for any new development.