Home SubSonic MVC-Storefront

SubSonic 3: Alpha Is Ready

SubSonic 3 is ready for Alpha. It’s a pretty significant upgrade and I think I’ve tackled all the bugs and issues. Lofty hopes, but with your help maybe we can make this thing solid.

Changes
Here are the changes for this release:

  • Fixed a bug with Connection.GetSchema() that only retrieved columns when it felt like it. Now I’m using INFORMATION_SCHEMA
  • Altered the Class template to implement INotifyPropertyChanging, INotifyPropertyChanged. tysonAdded the eventing to support this as well (for anyone out there who wants to help make an UnitofWork container… I already have the basic bits in place…)
  • Added a ProviderFactory to make the instancing of IDataProvider work with an Abstract Factory as opposed to leaving it completely up to System.Data.Common. This will allow for using providers that don’t implement System.Data.Common.
  • Added a Factory for creation of the QuerySurface (The DB() context, for lack of better words). This allowed me to …
  • Added ForiegnKey properties to the Class template, so you can now access Product.Suppliers a la Linq To Sql.
  • Added Validation methods for each property on the Class template, so when you set a property you can override a "OnEmailChanged" and "OnEmailChanging(string value)" – just like in Linq To Sql.
  • Added Rodrigo Diniz’s change to the _Settings template that will use your config file’s connection string so you don’t have to set manually.
  • Added the Inflector to the Utility class, allowing you access to methods such as Pluralize(), PluralToSingular(), ToProperCase, ToPascalCase, etc. This is a class for naming only and is part of the templates.

These aren’t the only changes – Matt Warren released part 12 of his Linq tutorial which addressed 99% of the issues people were finding, including the use of variables in the Linq call. Hi IQToolkit is awesome, and is the backbone of SubSonic 3.0.

It’s a complete restructuring, which will be a tremendous help as we try to fit in support for Oracle and other providers (which I’ll need some help with).

I can’t thank Matt enough – his posts have been a tremendous help.

You can download it here.

Setup
You go through the same process as before. To recap, you:

  1. Add a web or app.config file to your project
  2. Add a connection string to your DB
  3. Add a reference to SubSonic, which is in the folder
  4. Drop in the "Generated" folder, wherever you want it to go.

Hopefully that will be it. Everything is working pretty well for Sql Server and MySQL, but I know there’s more to do. I definitely know there’s some love that needs to happen WRT to Oracle, and for that I’ll need some help.

The Source
I’ve made the source available here, in a new repository that’s separate from SubSonic 2.1. I’ve also changed the license (on 2.1 as well) to be New BSD. Please don’t read anything into this – it’s just what I wanted to do.

SubSonic 3.0 Code Repo

I also want to keep the discussions out of our forums – it’s too hard to manage, especially for alpha. Instead I’ve created a Google Group list here:

http://groups.google.com/group/subsonicproject

This is for SubSonic 3.0 Alpha ONLY. If you find bugs, I’d really appreciate you logging them here:

http://code.google.com/p/subsonicthree/issues/list

If you would like to create a patch, I’ll hug you.

Using SubSonic 3.0
Just about everything is exactly the same as Preview 2, sans some silly bugs. The great thing is that if you know Linq, you know how to use SubSonic. The one major difference is that now I am using a Factory to create the DB:

 

   23         [TestMethod]

   24         public void Select_Simple_With_Variable() {

   25 

   26             Chinook.DB _db = Chinook.DB.CreateDB();

   27             int albumID = 1;

   28             var result = from a in _db.Album

   29                          where a.AlbumId == albumID

   30                          select a;

   31 

   32 

   33             Assert.IsNotNull(result.SingleOrDefault().Title);

   34         }

 

And that’s about it.

If you want to take advantage of the ForeignKey stuff, you can do so like this:

 

        [TestMethod]

        public void Select_Simple_With_ForeignKeys() {

            int artistID = 1;

            var artist = (from a in _db.Artist

                         where a.ArtistId == artistID

                         select a).SingleOrDefault();

 

 

            Assert.AreEqual(2, artist.Albums.Count());

        }

 

Call for Help
If you would like to help ramp out support for your favorite database, please send me an email (using the groups list above) and your google login, and also what you’d like to do in particular.

More than anything, if you have a problem and can write a test that I can use (against the Chinook DB would be great) to verify, that would rock big time.

I’ll put together some more tutorial stuff later this week.

Cheers.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • DotNetKicks
  • del.icio.us
  • Technorati
  • TwitThis
  • Reddit
  • Slashdot