How to deal with database access in long-running 2-tier application?
I am currently working on server application that has to deal with reasonable amount of clients over TCP in LAN. Tasks that server has to accomplish vary from trivial to mildly-complex, and most of them include some form of database interaction. 开发者_Go百科I'd like to make database access asynchronous, since not all queries are equally complex.
The question I have is what is the best way to deal with database access in this kind of application? Is it wise to use persistence layer or DAL (eg. NHibernate, Subsonic)? I am worried about potential leaks, eventual problems with GC that could all have a negative impact on uptime, and which are something to think about in long running apps.
The main benefit you get out of using an O/RM tool like NHibernate is essentially productivity. Vendors have been working on such tools for years and the level of sophistication of an average o/RM tool is currently far beyond the capabilities of a single man or a small team.
Using an O/RM tool will not necessarily give you extra days off. And an O/RM tool is not exactly a wizard or rapid application development instrument. It is still a programming tool, however, and a sophisticated one too. Using an O/RM tool can enhance your productivity as long as you know the tool and supply a well-built domain model.
I am not familiar with Subsonic but NHibernate is a mature product that is currently being used successfully in a large number of enterprise applications around the globe. If the product had significant bugs like leaks or a negative impact on uptime this would certainly have been examined and fixed.
精彩评论