开发者

ASP.NET: Thread-safety in a file-based database

I have worked a bit with ASP.NET before. I was using a MS SQL server to store and retrieve data to display in some dynamic pages in one project I started to learn ASP.NET a bit. Now I am about to start a new project but this time I would like to store the data in a file-based database , like say, an Access file. This project is also a hobby project and I'm not afraid of the scaling problem because perhaps only 3 users will be using the application at the same time and no be data traffic will be expected.

Now , about my question: using a MS S开发者_开发百科QL database there is no problem with several users reading-writing to the Db at the same time because the DB engine will take care of this, but using a file-based database with ADO.NET will be a problem in that case, am I right?

What I mean, do I need to take care of multiuser synchronization myself (using some synchronization mechanism, lock, mutex, whatever) to guarantee thread safety when working with the database or does ADO.NET takes care of that as well?

Should I use perhaps a singleton class for the data layer?


As fretje mentioned, ms access isn't a good db to use for web applications. But assuming you already know that there isn't anything special you need to do in order to use a access db with ado.net (other then using the right provider of course). ADO.Net will handle all that for you.

About having you data layer as singleton, I would really not recommend that.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜