subsonic3

Grouping with SubSonic 3

I have the following table "GroupPriority": Id Group Priority 1 1 0 2 2 0 3 3 0 4 2 1 5 1 1 6 2 2 7 3 1 I would like to group these on "Group", order them by "Priority" and then get the one in each "Group" with the highest Pri...

Possible latest Branch Merge Insert Datetime Bug

I ran into a bug with version 3.0.0.3 and the linq templates. The one where Update was a null object. So I downloaded the latest source for Subsonic.Core from git (merge branch from eibrahim Nov 3 2009). I built the source and am using the latest dll in my project. It has fixed the problem with running Update queries but now I have anoth...

Making relations before save

Hi. I´m using subsonic 3. I´m need pass a parent object with his childs to a custom method before they are persisted , like this: Public Function ValidateParent(parent as Parent) as Boolean For Each child in parent.Childs ValidateChild(child) Next Return true End Function I'm trying to set the Parent.c...

Sub Sonic not closing connections

I'm using Linq from SubSonic 3 like this: for(int x; x < 100; x++) { var v = (from c in db.categories where c.parent == 10 select c); if (v.Count() > 0) return null; category[] c = v.ToArray(); } for some reason SubSonic is not closing the connections...so after a few runs of the above loop I run out...

Support for compact framework in subsonic 3.0?

I was wondering when support for compact framework and sql server compact edition will be added to the Subsonic 3.0 project? ...

Extract SQL from Subsonic 3

Is there a way to extract the SQL which is run against the database from a bit of subsonic? For instance I have foreach (var item in EVT.All().Where(e => e.EVT_USRNAME == "stimms")) { ... } Can I get at what is run? ...

SubSonic 3 Linq projecting anonymous types but not class types

I am fairly new to SubSonic 3/Linq, and don't know if I'm missing something obvious, but I think I ran into a projection issue. I am trying to perform the most basic query, and getting back proper results only when I use anonymous types. The moment I swap the anonymous types with regular class types, I get all properties set to null/zero...

Subsonic map POCO to table of a different name

I started a small project and wanted to use Subsonic's SimpleRepository for my database layer. If I have table in my database called Member and I want to create a POCO called TeamMember. Can I map class TeamMember to table Member via an attribute or some other method? It is possible that what I'm asking is not how the SimpleRepositor...

Advice on Subsonic Batch Insert Query

hi am running batch insert with subsonic 3.0.0.3 and MVC and i have wrote the following example: var myquery1 = new Insert(provider).Into<orderitem>("orderitem_orderid", "orderitem_productid", "orderitem_qty", "orderitem_total", "orderitem_sessionid", "orderitem_internal", "orderitem_measurement").Values("1", "1", "1...

Populating Childnode list: Linq confusion and separation of concerns

I am trying to implement a tree view in my application. I am using MVC2 Preview 1, and SubSonic 3 SimpleRepository. I am new to both MVC and Linq. My problem is that I am not sure how to add a list of child nodes to the model record that I am passing back to the View. So I have added a IEnumerable called Children to my model class that ...

Subsonic 3 injects the column TestMode on a join

return (from sge in Context.SecurityGroupEmployees join sg in Context.SecurityGroups on sge.SecurityGroupId equals sg.SecurityGroupId join lu in Context.Lookups on sg.SecurityGroupTypeId equals lu.LookupId where lu.Value == value select sge.Employee).ToList(); the above code w...

No datetime values populated from MySQL using SubSonic 3 Linq

I have a MySQL table with a couple of Datetime columns. The columns are set to allow null and some have default value '0000-00-00 00:00:00'. This is a conversion project from ASP to ASP.NET so the table is full of data, and where some rows still have the default value, so I had to set "Allow Zero Datetime=True" in the connectionstring to...

Inserting a Hierarchy with Subsonic 3

I have used the Subsonic3 Linq T4 templates to generate data access code for my database. The one table I have so far represents a class very much like the following. public class NavigationItem { int ID {get;set;} // Auto generated field in database int ParentId {get;set;} // equal to ID if this is a top level navigation string ...

SubSonic Error with MySql CONVERT()

I has encountered conversion from integer to string with MySql+SubSonic3 (it generates wrong SQL query). After I found root of the problem in SubSonic sources and fixed it, everything works fine, but I'm not sure that it won't pull some other stuff. I believe in MySqlFormatter.cs the following code on line 309 sb.Append...

Linq grouping by nullable datetime and using this as criteria

I am struggling with a nullable datetime column [DateInsp] in an ASP.NET app which uses SubSonic3, Linq, MS SQL Server 2005. I had this all working when the datetime column [DateInsp] did not allow nulls. A new requirement forced me to set the [DateInsp] column to allow nulls and now I am struggling getting this piece of functionality ...

SubSonic and not default connection string problem

I encountered bug in my programm because of SubSonic3 returns records with default connection string in SingleOrDefault(ByVal expression As System.Linq.Expressions.Expression(Of System.Func(Of Company.filter, Boolean)), ByVal connectionString As String, ByVal providerName As String) In Subsonic sources, Database.cs line 323: instanc...

Why won't SubSonic ActiveRecord update my data?

I am playing around with SubSonic 3 ActiveRecord. I have a table called Users and I have the following fields in a MySQL database: CREATE TABLE `users` ( `ID` int(10) NOT NULL auto_increment, `Username` varchar(50) NOT NULL, `FirstName` varchar(50) default NULL, `LastName` varchar(50) default NULL, `EmailAddress` varchar(10...

How to mock Add method of subsonic's SimpleRepository

Hi, I'm trying to mock the Add method of subsonic SimpleRepository with Rihino mocks, I'm using the IRepository Interface but I'm new to mocking and dont know how to go from there, can this be done? thanks for your help. ...

Injecting Subsonic SimpleRepository class to controller

Hi, I'm tryingot get started with IoC, I have an MVC project in which is use subsonic, I'm trying to inject subsonic simplerepository to my controllers but I'm getting this error: StructureMap Exception Code: 205 Missing requested Instance property "connectionStringName" for InstanceKey "60b735fb-0a7f-4eb4-be04-635f6f32233d" Here is my...

Subsonic 3 SimpleRepository NON Plural Table names?

Is it possible to use SubSonic 3's Simple Repository with non-plural table names? My DB already exists, the table names a re singular add I cannot change them. ...