Question

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

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top