开发者

Correct way of implementing database access using .net remoting

开发者 https://www.devze.com 2023-02-09 22:16 出处:网络
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

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 rem开发者_如何学Coting 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


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消