One of the comments that showed up on the blog post about using 3-tiered with DataSets and the ObjectDataSource was, “How do we set this up so that we can swap out the DAL?” The simple answer to this is, “roll your own Table Adapter.”
The main project I’m working on these days is moving several web sites to Azure. It is something I’ve wanted to be able to try for a while. I’m working with several other agencies on this project and some Microsoft consultants so there is some good guidance along the way.
One of the things I wasn’t aware of until yesterday is that SqlAzure can shut down in the middle of your code trying to access it. Actually, this could happen on any SQL server, but it happens frequently enough under Azure that we need to code for it.
Enter the Transient Conditions Handling Framework.
There has been a lot written about how to use this, and I don’t plan on covering that material yet again. The particular issue we ran up against is that our code uses the standard DataSet/TableAdapter framework that MS gave us long ago.
I received the following question a few days ago:
“I am trying to use three tables from the same dataset in one form that I am creating in vs.net winforms my problem I guess is the setup of it as I can get them all on the form but cant get them to all post to the separate tables when I click save I am using a mysql database with the Mysql connector not the obdc can this even be done?”
Frustrating, isn’t it? .NET makes some things SO easy, and then when it isn’t you figure you must have done something wrong.
The good news is, your problem probably has nothing to do with using mySQL–it is all in how you are using the database stuff in WinForms.
In the last several posts, I’ve demonstrated various ways of getting data onto the screen. What I’ve purposely omitted up until this point is how to update this information.
So let’s start by going back to the demo we created in Febuary.
What we ended up with is an application that would display the First name and the last name out of the Person class.
What we want to do today is to update the code so that the person class gets its data from a database on the server using a web service. So the first thing we’ll want to do is create a web service.
I sat down today to learn about using Silverlight and Dataset from a Web Service. Something you’d think would be rather trivial.
I mean, seriously folks. We use Datasets as a means of transporting data up and down the tiers of just about everything we do in .NET. It would stand to reason that using DataSets as our transport mechanism in Silverlight would be a given.