Hanalei, Hawaii Saturday, March 13, 2010

More On SubSonic’s Simple Repository

A lot of people have been asking me about the SimpleRepository and “which approach should I use”. Decision Paralysis – having too many choices is not a good thing some times :).

A lot of people have been asking me about the SimpleRepository and “which approach should I use”. Decision Paralysis – having too many choices is not a good thing some times :).

Instead of giving a decision matrix, I decided to go the other direction and feed this paralysis. In my mind there is no “wrong” decision, but in general if you “touch” less of the framework you’re better off. No one likes to have to do silly workarounds (and yes I know there are some bugs in 3.0 that I need to attend to – I’m on it) so ideally you can use what you have to and move on.

Anyway. I put together “yet another screencast” for the SimpleRepository and posted it on our docs site but realized that I didn’t really tell anyone about it. I like it – I backed it with one of my favorite songs (talking is boring) and I think it shows pretty nicely how you can work with the SimpleRepo.

View it here (6 mins).

Download it here.


robconery - July 15, 2009 - Short answer is I didn't want to support every data annotation and all I needed were 6 simple attributes. Very little code, easy to do :)
Alex - July 15, 2009 - Rob, i'm your fan.
hilton smith - July 15, 2009 - thanks for this.... the simple repository has changed the way i look at data access rob...
rmassart - July 15, 2009 - Looks great. Just a quick question on Simple Repository. Can it also start off from the database, ie create a bunch of classes from a given DB structure (in the same way that SubSonic 2 works)?
robconery - July 15, 2009 - That would be ActiveRecord:
http://subsonicproject.com/docs/Using_ActiveRecor...
Matt - July 15, 2009 - The screen cast was great, except I think I would have preferred narration then the music.
Fred Pinto - July 15, 2009 - @rmassart: Maybe it can pick up a existing table transparently if you model your class to exactly reflect the table. I haven't tried it yet, going to download the bits now.
David - July 15, 2009 - Hi Rob, what would be cool is a quick example of how to use the simple repository as the "M" in the asp.net mvc framework. Do you have to do the wrapping yourself, or do things like UpdateModel work?
David - July 15, 2009 - Ah, my bad. Now I see that it's there in the examples. Cheers Rob
Alex Simkin - July 15, 2009 - Hi, Rob. Does subsonic re-reads/re-checks db schema on every 'save' to see if it needs to update it?
robconery - July 15, 2009 - If the migration options are on, yes.
reza - July 15, 2009 - how can we use lazy loading in subsonic 3.0? thanks
robconery - July 15, 2009 - Use IQueryable
Daniel - July 16, 2009 - Hi Rob, Just a question about the screencasts on the subsonic documentation site: Would it be possible to get a link to a downloadable version. Seems like the Novell/Linux version of Silverlight doesn't like the media player yet!
robconery - July 16, 2009 - Yes - gimme a day to do this...
Earshole - July 16, 2009 - Is that (Sub)SonicYouth playing?
robconery - July 16, 2009 - Sure is :)
bonder - July 16, 2009 - Great, great stuff! (The product, the screencast, the music!) One question: It seems like the auto migrations do not provide the upgrade/downgrade feature that version 2 migrations offered. Is there a reason for this?
reza - July 17, 2009 - how can do this ? in your documents in IQueryable section i can't find anything about this
mgutz - July 29, 2009 - Man, this is good stuff. I like your ActiveRecord stuff and this is even better. How will associations be handled? one_to_many, many_to_many, etc? For example class Post { public List<Tag> tags; } Is that something you plan to address in the future or is this simply a framework for 1:1 mapping of entities to tables?
Zarzand - August 2, 2009 - Hello I'm getting this error when I try to have two Primary Key "Multiple identity columns specified for table 'TblUsersGroups'. Only one identity column per table is allowed." I need to have two Primary Key in this table. Is there a fix for this please help..... public class TblUsersGroup { [SubSonicPrimaryKey] public int UserID { get; set; } [SubSonicPrimaryKey] public int GroupID { get; set; } }
AJ - November 13, 2009 - What's the song name and artist?
Gecko