Question:
Need advice from a pro for ASP.Net database transactions!?
automicss
2010-05-21 15:22:58 UTC
Hello, I'm creating an ASP.NET C# Web Application it will be connected to a (oraclexe) database there are many ways to do this but I want to use a best practice used by many professionals. (I'm a student)
I was thinking of creating one solution in VS2010 then adding the web app and creating a separate project to handle all database transactions. ( Sounds good so far right? )
Now I'm wondering what's the best type of project to do this, I'm thinking about a web service but I don't know if that's a good thing.

So.. what do the pros's use in this situation ?
Links to books, e-books, tutorials, forum posts , blogs are all welcome but I prefer you sharing your personal experience as a "pro".

I hope my question will be answered, thumbs up for the trouble!

Greets,
Automicss
Three answers:
Ratchetr
2010-05-21 16:25:40 UTC
What you described is exactly the architecture of the application I am working on now. There are pros and cons to this approach.

The Pros:

It's good to keep your data access outside your web app. That's just good design. Doing it this way enforces that, your web app doesn't have any database code in it.



The web service doesn't need to run on the same machine as the web application. This is good from both a performance and security standpoint. If you web server is busy, you can move the web services to a different machine to spread the work around. If you don't need other external customers to use your web service, you can run it on a machine that isn't directly connected to the internet, so there is no way an outsider can call your web services directly.



The Cons:

There is some overhead involved in calling a web service, particularly if you are returning large datasets from the database. You can return DataSets from a web service (some people claim that you shouldn't, because DataSet is a Microsoft specific data type. It's difficult to work with a DataSet as return type from a language such as Java). But if you do return a DataSet (we do in our app), they are serialized into XML data to send across the web service boundary, then deserialized back into a dataset on the other end. The XML overhead can get expensive, both in terms of memory and CPU for large datasets.



Security: if you do run the web service on the same machine as the web application, then you do need to worry about security. You don't want random strangers discovering your web service and calling it directly, so you need a way to do authentication. (Web services do have good support for that).



One approach that might be worth considering is to put all your database logic in a DLL rather than a web service. Then you write the web service as a very skinny wrapper around this DLL. For most web service calls, you would just do something like: return DataProvider.SomeFunction(param1, param2, etc).

The advantage of that is that the DLL can be used in any project. You could even construct your web app in such a way that it could use the web service or the DLL, based on a single configuration setting (it would take a fairly small amount of work to do this.)



Also, FYI, in our app there is no SQL in our web service. All the SQL is in packages in the oracle DB. The web service is really just a big wrapper around the database stored sprocs.



HTH.
Joe
2010-05-21 15:32:00 UTC
I think asking these questions are better on programming forums.



I know I saw a tutorial for something like this on either

dreamincode.net or coderisland.com.



I would just create a class with the webapplication using System.Data, (i've never used Oracle just MS SQL Server, not sure if .net libaries have something you can use).
ikeda
2016-11-06 03:47:00 UTC
i've got not yet owned a boxer - yet extremely do like them - yet I rather have owned or presently own the different 3 breeds - All of my canine got here from rescues - all have been and are astounding animals. one and all of them! Even the yank Bulldog - or Pit Bull. undergo in ideas that once you agree on a breed of canine - rescue canine are suited selections. the main important to possessing any canine is obedience training. make certain you pass to an excellent classification and shop up along with his training even after the class is over - Obedience is an astounding game btw - and correct use of those canine means. look at communities' canine ordinances earlier you get any canine. regrettably, in US, some communities have banned the pit bull or American Bulldog - that's unfair yet know that. As a youthful grad, you're able to ought to pass the place the artwork is - not that's handy on your decision of canine. additionally, make certain you have carved out significant time to spend at the same time with your canine. those canine require a minimum of two hours an afternoon of "your" time - be it training, playing, or only wonderful out on the settee - they want YOU. backside line - all 4 canine could be super pets.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...