Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3596356
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:58:39+00:00 2026-05-18T19:58:39+00:00

I feel foolish asking such a fundamental question but it would be more foolish

  • 0

I feel foolish asking such a fundamental question but it would be more foolish not to ask 🙂

I have been using SubSonic 2.x for years and love it (Thanks Rob and co.).

I have started a pilot project using SubSonic 3.0.0.4 and have chosen the LINQ T4 Templates (excuse me if I have the terminology wrong).

Now I am new to LINQ but I am doing OK working out how to build the queries.

What I am REALLY struggling with is how to create and update data with the new toolkit.

Previously it was super simple where I could:

  • ‘new’ an object if I didn’t have one
  • or Fetch or construct an existing one by id
  • set some properties
  • then ‘Save()’ it

Fantastic and saved me hours.

Now in the new toolkit some things seem to be the same like:

  • creating an object
  • setting some properties

but right now some things seem a lot harder like:

  • Loading an object seems to be:
db.Product.FirstOrDefault(x => ProductID.Id == 123);
  • Inserting seems to be:
db.Insert.Into<Northwind.Region>(
         x => x.RegionID, 
         x => x.RegionDescription)
        .Values(6, "Hawaii").Execute();
  • Updating an object seems even harder:
db.Update<Product>()
    .Set(x => x.UnitPrice == 100, x => x.ProductName == "Test")
    .Where(x => x.ProductID == 1).Execute();

The documentation (http://subsonicproject.com/docs/Linq_Updates) talks about using the Repository but that just doesn’t exist/get generated with the T4 templates I am using.

So any help to let me know that:

  1. I have obviously set this up wrong
  2. I have no idea what I am doing and the way to do it is … insert answer here
  3. I understand it correctly and should just suck it up

would be greatly appreciated.

If any more info is needed please let me know.

Thanks in advance.

Mark

—- Update —-

To summarise the answer from Denis:

LINQ is a query language not an ORM

You can get to the Repository object via:

var repo = new SubSonic.Repository.SubSonicRepository(db);

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T19:58:39+00:00Added an answer on May 18, 2026 at 7:58 pm

    Hmm.. I migrated one of my projects to the SubSonic 3 too but frankly have not had any troubles saving the entities. I use the same ActiveRecord techniques and it still works great for me. For example, to retrieve an entity I am issuing:

    var product = new Product(p => p.Id == 123);
    

    For inserting:

    var product = new Product();
    product.RegionID          = 6;
    product.RegionDescription = "Hawaii";
    product.Save();
    

    Updating:

    product.UnitPrice   = 100;
    product.ProductName = "Test";
    product.Save();
    

    As you can see you can still use the same Save() method.

    So, not really sure why you try to do that through the ‘db’ context even though it can be used too 🙂 Am I missing something?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I feel foolish asking such a fundamental question but it would be more foolish
I feel somewhat foolish asking such a simple question, but I can't seem to
I feel really dumb for asking this question, but here it goes. I have
Okay, I feel a bit foolish for having to ask this but I guess
I feel like such a noob asking this but, for some reason a horizontal
I feel embarrassed asking this question, but I've spent the last half an hour
I feel bad asking this question. I have seen it on SO a couple
Feel silly asking this question, since this should be easy, but I can't figure
I feel rather foolish as this is just a short question. I was reading
Feel free to close and/or redirect if this has been asked, but here's my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.