Tuesday, December 09, 2008 -
SubSonic 3 is ready for Alpha. It's a pretty significant upgrade and I think I've tackled all the bugs and issues. Lofty hopes, but with your help maybe we can make this thing solid.
Changes
Here are the changes for this release:
Added the eventing to support this as well (for anyone out there who wants to help make an UnitofWork container... I already have the basic bits in place...)These aren't the only changes - Matt Warren released part 12 of his Linq tutorial which addressed 99% of the issues people were finding, including the use of variables in the Linq call. Hi IQToolkit is awesome, and is the backbone of SubSonic 3.0.
It's a complete restructuring, which will be a tremendous help as we try to fit in support for Oracle and other providers (which I'll need some help with).
I can't thank Matt enough - his posts have been a tremendous help.
Setup
You go through the same process as before. To recap, you:
Hopefully that will be it. Everything is working pretty well for Sql Server and MySQL, but I know there's more to do. I definitely know there's some love that needs to happen WRT to Oracle, and for that I'll need some help.
The Source
I've made the source available here, in a new repository that's separate from SubSonic 2.1. I've also changed the license (on 2.1 as well) to be New BSD. Please don't read anything into this - it's just what I wanted to do.
I also want to keep the discussions out of our forums - it's too hard to manage, especially for alpha. Instead I've created a Google Group list here:
http://groups.google.com/group/subsonicproject
This is for SubSonic 3.0 Alpha ONLY. If you find bugs, I'd really appreciate you logging them here:
http://code.google.com/p/subsonicthree/issues/list
If you would like to create a patch, I'll hug you.
Using SubSonic 3.0
Just about everything is exactly the same as Preview 2, sans some silly bugs. The great thing is that if you know Linq, you know how to use SubSonic. The one major difference is that now I am using a Factory to create the DB:
23 [TestMethod]
24 public void Select_Simple_With_Variable() {
25
26 Chinook.DB _db = Chinook.DB.CreateDB();
27 int albumID = 1;
28 var result = from a in _db.Album
29 where a.AlbumId == albumID
30 select a;
31
32
33 Assert.IsNotNull(result.SingleOrDefault().Title);
34 }
And that's about it.
If you want to take advantage of the ForeignKey stuff, you can do so like this:
[TestMethod]
public void Select_Simple_With_ForeignKeys() {
int artistID = 1;
var artist = (from a in _db.Artist
where a.ArtistId == artistID
select a).SingleOrDefault();
Assert.AreEqual(2, artist.Albums.Count());
}
Call for Help
If you would like to help ramp out support for your favorite database, please send me an email (using the groups list above) and your google login, and also what you'd like to do in particular.
More than anything, if you have a problem and can write a test that I can use (against the Chinook DB would be great) to verify, that would rock big time.
I'll put together some more tutorial stuff later this week.
Cheers.
Sent from my phone. Please excuse brief replies.
1. Will it be much of a stretch to move things from LINQ to SQL to Subsonic 3?
2. What do you think the time frame of a stable release will be?
Thanks and keep up the great work!
2. Asked the same question, didn't got a reply yet :P
@Rob:
I liked the old way where I could address parent foreign keys in SubSonic 2, so I changed class.tt to work exactly like the previous way.
Great Indeed.
Is it possible to blog or show a code demo of Subsonic 3.0 + IronRuby.
I think many Rubyists like me, would love to see it.
Just a little remark though, i would consider naming _db.Artist to _db.Artists and _db.Album to _db.Albums having them plural instead of cingular. Which makes it a little more readable and nicer :)
Otherwise, nice job!
What are you trying to say?
I know you have invested a lot of time into this. However, after spending some real time with NHiberate (+Linq) and FluentNHibernate I am wondering if you might be better served if you used NHibernate to do the heavy lifting behind your templates.
The benefit would be Oracle (and many other) provider support today, less messy SQL code to manage, and giving users the option to use NHiberate where appropriate.
Thoughts?
Thanks,
Scott
If I want to use NHIbernate, why don't I just use NHibernate!?!?
2. Please re-read, with FluentNHibernate there are no XML files.
3. In regards to edge cases, why not have something which can easily handle the edge cases.
Again, I am not saying you would ever have to muck around with NHibernate directly. You can still use the nice layer generated today, I am just saying instead of re-inventing the wheel in regards to query building and data access, why not use something that already works (and will give Oracle, MySQL, and many others support today).
-Scott
Several things.
1. The stored proc wrappers don't compile. Consider the following generated line:
StoredProcedure sb=new StoredProcedure("ms_rpt_Scheduled_Revenue_Summary",new DbDataProvider("MyDatabase"));
DbDataProvider class does not have a constructor that takes a parameter. I am not sure how this is supposed to play out.
2. I'd add to the readme.txt that the project should add dependencies to System.Transactions and System.Data.Linq
Makes for a smoother experience.
And I sent you a patch for the tinyint issue.
I just downloaded this version and I think there could be some problems with serialization with regards to events exposed by the objects.
Have a look here:
http://www.cosminonea.net/2008/12/10/Subsonic30AndAPossibleSerializationProblem.aspx
well, if serialization is an issue. That said - I'm hoping to start a
template share (somehow) and would love your ideas.
I don't know if this is what you're looking for but there's a new project called NCommon that has a well thought out unit of work pattern from www.codeinsanity.com. Direct link to the project: http://www.codeplex.com/ncommon
I did that because of getting rid of table prefixes.
Is it a bug or am I missing the point?
I like SubSonic a lot!
So... Is the SubSonic 3 Alpha compatible with Oracle?
I'm try to generate for Oracle..
connectionString="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=Oracle92)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=Oracle92)));User Id=TRACTEBEL_SITE;Password=TRACTEBEL_SITE"/>
connectionStringName="SRSCnt" generatedNamespace="SRS.DataAccess" />
Thanks!!!