Search code examples
ormsubsonicsubsonic3

Subsonic 3 Linq Documentation


I'm started looking at Subsonic just yesterday and having trouble figuring out how to do even the most basic tasks. I've watched the demos for ActiveRecord and SimpleRepository, but they don't fit what we want so I'm trying to use the Linq Templates.

The getting started guide for Linq walks through enough to do a query, but how do I do other things like insert a record and get it's auto-increment ID back?

Is there a reasonably comprehensive guide to using Subsonic Linq somewhere?


Solution

  • Well there is this: http://subsonicproject.com/docs/Using_AdvancedTemplates

    Which I can see is a bit sparse :). It works just like Linq to SQL in most cases in that you need to create "DB". That DB allows you to Insert, Delete, etc for all the objects. You can also do aggregates and so on.

    using(var db=new NorthwindDB()){ db.Insert.Into("Name").Values("New Name").Execute(); }

    The tools used to interact with the DB follow along with our Simple Query tool: http://subsonicproject.com/docs/Simple_Query_Tool

    If you want more things done for you (like getting the new id back, etc) you should stick with ActiveRecord.

    Out of curiosity - what doesn't fit?