views:

14

answers:

1

I understand Subsonic 3.0 is the latest and greatest, and I understand Subsonic 3.0 has T4 templates.

But Subsonic 3.0 is not backwards compatible with Subsonic 2.2, meaning, my project with hundreds of code files written in the subsonic 2.2 query language will not work in Subsonic 3.0.

So my question: Is there t4 templates someone has made for Subsonic 2.2 to replace the Generated files it creates. My DB is huge and the amount of files being generated is getting a bit insane.

Has anyone made this ability or has anyone made a custom tool to help the upgrade path?

Thanks for reading

+1  A: 

SubSonic 3 has been a huge recode of the core, using some new techniques such as T4 instead of it's own templates and providing a linq query engine.

But most of the good old features, like the query tool, are still available.

If you did this:

var p = new Product();
p.ProductName = "new product";
p.Save();

or this

var p = DB.Select()
         .From<Product>()
         .Where(Product.ProductCode).IsEqualTo("1234")
         .ExecuteSingle<Product>();

this will still work with SubSonic3

If you are brave enough my suggestion for an upgrade path would be this:

  • Make sure your DAL uses "generatenullableproperties=true"
  • If not recreate it and fix possible compiler / runtime exceptions:

    if (p.QuantityHasValue) p.Total = p.Quantity * p.Price;
    // changes to
    if (p.Quantity.HasValue) p.Total = p.Quantity * p.Price;
    
  • Change the Namespace of you generated file from Your.Namespace.DAL to Your.Namespace.LegacyDAL

  • create the DAL with the ActiveRecord templates in your old namespace
  • If you used InlineQuery, the class name changed to CodingHorror
  • fix all compiler errors (maybe the generated property names / types differ a bit)
  • rewrite queries if needed
  • if you are using subsonic migrations: Stick with them since there is no coequal replacement in SubSonic3
  • test, test, test!!! until everything works fine
  • make use of the subsonic3 features (such as linq) only for new tasks
SchlaWiener
Thanks, didn't know those would work!
bladefist
Well, I would expect some api changes and bugs but most errors should be compiler related and easy to fix. Tip: If the generated class names do not match your current DAL objects, there is a `CleanUp()` method in the `settings.ttinclude` file that you can use to modify the table names.
SchlaWiener