March 2004 - Posts

Visual Studio 2005 Community Technology Preview for MSDN Universal Subscribers

MSDN Subscribers can now download Visual Studio 2005 Community Technology Preview.

MSDN Subscriber Downloads

Of course, I started downloading about 18 hours ago and it is still going...  Hopefully it will be fully downloaded before my MSDN subscription runs out.

Much ado about provider design patterns

After reading Rob Howard's post, his MSDN article, and the reply from Nick Berardi, I decided to make a few comments.
The framework that I have started testing and using is from
Deyan Petrov's Data Access & Transaction Handling Framework that he posted on Code Project.

With his framework, you define your Providers in an xml file (very similar to the way Nick does):

<dataProvider name="OleDb_1.0" 
   
connectionType
="System.Data.OleDb.OleDbConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    commandType
="System.Data.OleDb.OleDbCommand, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
   
parameterType
="System.Data.OleDb.OleDbParameter, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
   
parameterDbType
="System.Data.OleDb.OleDbType, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
   
parameterDbTypeProperty
="OleDbType"
   
dataAdapterType
="System.Data.OleDb.OleDbDataAdapter, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
   
commandBuilderType
="System.Data.OleDb.OleDbCommandBuilder, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
   
parameterNamePrefix="@" />

You would do the same for SqlClient, Oracle, etc.
You then define your DataSources:

<dataSources>
    <
dataSource name="test.oledb.access.pubs" default
="True"    
       
provider
="OleDb_1.1"
       
connectionString
="provider=Microsoft.JET.OLEDB.4.0;data source=c:\test\pubs.mdb"
       
dataOperationsDir
="commands"
       
dataOperationsFileMask="pubs.oledb.access.*.xml"
 
       
parameterNamePrefix="@"
/>
</dataSources>

From your code, you no longer have to worry about what type of provider you are talking to.
Fore example, in your Data Access Layer, you would have the following code:

private IDataSource _ds = null;
_ds = DataSourceFactory.GetDataSource();  
// this gets the default Data Source.
// or this gets a specific named Data Source
// _ds = DataSourceFactory.GetDataSource("test.oledb.access.pubs");
IDataCommand cmd = _ds.GetCommand("InsertAuthor");
// ...
// Do stuff to the Command object here...
// ...
cmd.ExecuteNonQuery();

In another layer, you would wrap this with the Transaction model:

public int InsertAuthor(AuthorData value)
{
    int
result = 0;
    TransactionContext ctx = TransactionContextFactory.GetContext(TransactionAffinity.Required);
    try
    {
        ctx.Enter();
        AuthorService service = new
AuthorService();
        result = service.InsertAuthor(value
);
        ctx.VoteCommit();
    }
    catch
( Exception ex )
    {
        ctx.VoteRollback();
        Console.WriteLine(ex.ToString());
    }
    finally
    {
        ctx.Exit();
    }
}

It is very simple and easy to use as you can see, but we have gone a step further...
We have made the class that would normally hold the this transactional code, and made it inherit from ContextBoundObject.
Now we can use the following code:

[Transaction(TransactionOption.Required)]
public int InsertAuthor(AuthorData value
)
{
    int result = 0;

    AuthorService service = new AuthorService();
    result = service.InsertAuthor(value);
}

Under the covers, right now we are just calling Deyan's Transaction code to start, stop, commit & rollback a transaction.

One of the real beauties of all this is that you can make a transaction go around calls to different Providers! 
We are going to be customizing his work a little more by defining some of the common providers (SqlClient, OleDb, etc) in code instead of the xml, just to reduce the chance of error and to make the xml file a little smaller.  You will still be able to define other providers (MySql & others) in the xml and it will add it to the list of providers. 

If anyone else has been working with this framework, let me know as I will have to test this inside and out before it can go into production.

I also want to go through Rob Howards Provider model and see if there is anything I could use to make this framework better.  Feel free to give me a comments or suggestions!

 

[Rob Howard's Blog]

A couple months back I mentioned publishing our provider specification we're using for Whidbey. It's now available on MSDN in the resurrected Nothin' but ASP.NET column. This first article outlines the pattern, and in the following column we'll walk through using this pattern for ASP.NET 1.1. There are in fact two ASP.NET 1.1 applications following it today: the ASP.NET Forums (http://forums.asp.net/) and DotNetNuke (http://www.dotnetnuke.com).

Thanks to Kent our MSDN ASP.NET community superstar for helping get this pushed through --- and convincing the MSDN staff to start the column back up again! Hey, it was only a short-break (2 years <g>).


Onfolio -- Check It Out!!

After reading Scoble's review on Onfolio, I downloaded it and tried it out.  Very cool!  As someone who's favorites folder is huge and wildly out of control, this will be a real live saver!  I can't say that I expect any less from JJ & Jeremy Allaire.  I used to work for Allaire (now Macromedia) while I lived in Boston and it was one of the best experiences of my life.  They came out with products that their customers wanted instead of trying to force what they wanted on their customers.  I also saw that Charles Teague, my former boss, is one of the co-founders at Onfolio.  Fantastic work guys! 

The one thing I would like to see added (and it is possible that it is already there and I just didn't find it...) is the ability to schedule a page for updates so that the offline capture of a site could be updated.

It's real nice to see another cool .NET app out there!

 

[Scobleizer: Microsoft Geek Blogger]

So, what's Onfolio?

First, the screen captures (here's a PNG, same thing as GIF -- that's a screen capture of my browser Window on my Tablet PC -- Onfolio is designed to work with IE only at this point, sorry).

Onfolio is the most useful .NET client app that I've seen so far.

As I surf around I drag things into my list. Then I can right click and do a whole bunch of things. I can create a web page/report for my team (or, for other important people). I can email them around.

But, it lets me stay organized as I go around the Web. It really is like a Favorites list on steroids.

The Onfolio site has a good tour and other marketing aides. I'd be happy to answer questions or give examples.

By the way, one correction: JJ Allaire is behind this. Jeremy is a different person (Jeremy was there which confused me). Sorry about that!).

What would I like to see? A Web service architecture so that as soon as I dropped things into my folder, my teammate's Onfolio's would also show them. If they did that then they'd have something really wild and disruptive.


Posted by dotnetboy2003 | with no comments
More Posts