Oh, I've had a heck of a time trying to debug some custom web parts that I've written for our internal portal application. I'm using Jan Tielens' SmartPart v3, which is an excelent webpart for hosting ASP.NET UserControls. (It even now supports ASP.NET AJAX!) But the problem that I've constantly run into with sharepoint is the dreaded "An unexpected error has occurred" issue. It gives no event logging, no trace logging, nothing. It's a dead end.
But thanks to Vincent Rothwell, I finally have an answer. He details the solution to this problem here, and the answer is to simply change a single attribute in your web.config:
<
SafeMode MaxControls=200 CallStack=false
to
<SafeMode MaxControls=200 CallStack=true
You will also need to set custom errors to 'Off' .
<customErrors mode=Off/>
This wouldn't be appropriate for a production portal, but for testing and debugging, it's a lifesaver. Thanks Vincent for this; you've saved me from a huge headache!
The buzz from MIX07 is that Silverlight is far more than just Microsoft's answer to Flash. According to Ray Ozzie, Silverlight will include a CLR engine that is "identical to the desktop CLR", allowing developers to leverage .NET programming skills for client-side code.
Check out the article here.
I was reading the Visual Basic Team Blog a couple of days ago, and stumbled upon a pure gem that will be available in Visual Studio Orcas. From the post:
Keeping track of all inserts, updates and deletes across multiple related datatables and sending those changes in the right order back to the server is not an easy task. How do you make sure that new orders for your customer are added correctly to the system while updating the shipping address of the same customer and deleting one of old orders that had been canceled all at the same time?
With hierarchical update support in Typed Dataset, all you need to do is to call UpdateAll() method of the new TableAdapterManager component we've added. It takes care of collecting all changes and sending them back to the server in the right order. Of course, everything is wrapped into a transaction.
We believe this would significantly improve the productivity of developers using Typed Dataset to create data applications. You can try this new feature in March CTP of Visual Studio Orcas.
Apparently, the VS team has finally solved one of the most horrendous problems that comes with using DataSets. Before the TableAdapterManager, you needed to write a great deal of custom code in order to update your database with changes from different DataTables in the proper order. Each time you wanted to commit the changes in your DataSet to the database, your code had to follow a process something like this:
- Determine which DataTables in the DataSet have changes.
- Determine how the DataTables are related to one another (parents and children).
- For each table with changes (ordered from parents to children):
- Extract the rows inserted/updated in the table.
- Use the table's DataAdapter to commit the changed rows to the database.
- For each table with changes (ordered from children to parents):
- Extract the rows deleted from the table.
- Use the table's DataAdapter to commit the changed rows to the database.
ADO.NET provided a great deal of infrastructure to make the whole CRUD job easier, but it stopped short of implementing this fundamental algorithm for you. The DataAdapter class took care of managing these operations for a single table, but MS didn't provide any sort of "meta-DataAdapter" that orchestrated updates for the entire DataSet. Even with the introduction of generated TableAdapters in VS 2005, you still had to write this coordination code by hand. But now, (now meaning whenever Orcas is released) this piece of the data-access puzzle has been solved.
In case it isn't clear, note that the TableAdapterManager is not a framework class. It's a custom class generated for each strongly-typed DataSet in your project. The TableAdapterManager for a DataSet knows about the relationships between the DataTables in the set, and so is able to coordinate update operations for the individual tables. Like the conductor in an orchestra, the TableAdapterManager cues each TableAdapter to step in and play its part at the proper time.
I'm particularly interested in Microsoft's answer to this data access problem because I worked a few years back on a solution to the exact same issue. The Hydrus DataSet Toolkit is a data-access framework that also deals with this problem of coordinating DataAdapters to perform update operations in the proper order. The DataSet Toolkit contains a class called the MultiTableDataAdapter that implements the DataSet update algorithm listed above in a generic fashion. By inspecting the relationships between tables in a DataSet, the MultiTableDataAdapter can determine the order in which insert, update and delete operations should be performed against a database.
If you want this sort of functionality now, you can download and start using the DataSet Toolkit for free from Hydrus Software. It gives you hierarchical updates, as well as hierarchical DataAdapter.Fill operations and dynamic SQL generation.