subsonic

How to convert IEnumerable to Subsonic collection?

Embarrassing question really -- I have Subsonic collection, then I filter out some data using Where. MyColl.Where(it => it.foo()==true) now I would like to pass those data still as Subsonic collection. How to do it (the most properly way)? I checked constructor for Subsonic collection, ToX() methods, and googled. edit: Subsonic 2.x...

SubSonic SimpleRepository - Foreign Objects

SubSonic SimpleRepository doesn't seem to have a lot of support for foreign relations. How can I have foreign relationships in my code models that persist and load from the database naturally? ...

C# SQLite SubSonic: Unable to open database in Windows Service

Are there any issues with using SQLite and SubSonic in a windows service. (have only tested on Vista) edit: I have a windows application and windiows service that needs to run on the same database. The windows app works fine (after adjusting the connection string and compiling the SubSonic Core with the updates mentioned here http://ww...

How to extend linq partial classes

Hi guys, I need to extend a subsonic generated (using linq templates) I have created the class with the same name and namespace in the same project when I run a query like this IMBDB db=new IMBDB(); var r = (from query in db.Articles join cat in db.ArticleCategories on query.CategoryID equals cat.ID where query.ID == art...

SubSonic and SQL Azure DB with custom Schema

Hello Guys, I am using SubSonic to access a DB I migrated to SQL Azure. This db has a custom schema defined. Because of the differences with SQL Server 2008, I am getting a "Deprecated feature 'More than two-part column name' is not supported in this version of SQL Server. " error. If I'm using DataReaders to access the SQL Azure DB I ...

SubSonic 3.0 NullReferenceException when i try to create a query

Hi guys, i have 2 tables - products and categories. Each product belong to 1 category. When i delete category i need to delete all corresponding products, also i need to do that in transaction. So far i have this code: var batch = new BatchQuery(); var qryDelete = new SubSonic.Query.Delete<product>() .Where(productTable...

How to add additional tables in DashCommerce 2 using SubSonic 2.0.3

I've inherited an website that is base on DashCommerce 2 SubSonic 2.0.3 I wish to add some customfields to the project however cannot find .tt files. Also there is not option to "run tool" Did SubSonic 2.0.3 use .tt files? I'm assuming .tt = t4? I don't seen any active record .dll's in the bin. // EDIT // Ok, so i need to use s...

Distinct on paged result , SQL Server query

Hi How can I distinct result of paged query? I want to distinct results that I paged using SQL Server 2005 paging method SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY [dbo].[Tbl_Kartabl].[FKLoginID]) AS Row, [dbo].[Tbl_Kartabl].[FKLoginID] FROM [dbo].[Tbl_Kartabl]) AS PagedResults WHERE Row >= 1 AND Row <= 10 How can I ...

How to call a function inside of an Oracle package via SubSonic

Hello, I've got an Oracle package that contains many functions. In the package body, these functions can get very complex. Is it possible for SubSonic to generate against specific functions inside of a package? Right now if I have a package called ProjectData and there are functions in there such as GetEmail, CloneProject, GetProject...

Getting Record ID after saving with SubSonic 2.2

Hi, How do I get the Record ID (Primary Key) immediately after saving a record? I have the ID column as auto generated. I need to pass the ID to another object as a "Foreign Key" before saving that object. Currently I do Product.Save() Can't I do int id = Product.Save() ...

Subsonic2.2 and NEWSEQUENTIALID() Primary Key Column

Subsonic is returning 00000000-0000-0000-0000-000000000000 when I insert a record and try to get it's key after insert. product.Save(); GUID = product.ProdID; The record is inserted correctly with correct GUIDs. Any idea on how to resolve this? I am using version 2.2.0.0 This is my table schema GO SET ANSI_NULLS ON GO SET QUOTED_I...

Why is GetPaged() Executing two database calls?

I'm a bit new to subsonic (i.e. evaluating 3.0.0.3) and have come across a strange behavior in GetPaged(int pageIndex, int pageSize). When I execute the method it does two SQL calls. Any ideas why ? Details Lets say I have a "Cultures" table with 200 rows. In my code I do something like ... var sonicCollection = from c in RTE.Cultu...

Subsonic TransactionScope, SharedDBConnectionScope does not work in 3.0.0.3?

I have not been able to get this working following the docs or other ideas people have tried. If i use the below, there is no transactional behaviour at all. If i swap the shareddbscope with the transaction scope around, i dont get a save on a single record. if it call ts.complete at the bottom of the transaction i get a single record s...

[Subsonic SimpleRepository] - Columns not created

Hello, I'm using Subsonic (SimpleRepository) in my new project and enjoy using it but... With one, and only one of my table, it does not create all the columns and i don't understand why. Here is the code : public class Rating { public Rating() { UsernameVotant = ""; UsernameEvaluate = ""; Note = 0.0; ...

SubSonic: editor generation fails

I use SubSonic 2.2 for asp.net 2.0. I successfully generated the DAL for my web project. Now I'm trying to generate a web editor page for a particular database table: sonic editor /table Table /out OutDir but it doesn't work. This is the error: Generating editor for Cantiere ERROR: Trying to execute editor Error Message: System.NullRe...

Subsonic 3.0 missing output parameter/default parameter support in SQL Server?

I have a stored proc: CREATE PROCEDURE MyProc ( @P1 uniqueidentifier, @P2 int = NULL output, @P3 int = NULL output ) The signature on the C# side should be (Guid P1, int? P2, int? P3) I would think. But it's not, it's just (Guid,int,int). Furthermore, the output params are not created as output params, they're just straight "AddPara...

Update a primary key value using SubSonic 2.2

Hello everyone, I'm currently developing an app using SubSonic 2.2 and I'm having problems updating one of the columns of a composite PK on a table. My code is roughly this: foreach (pageItem page in pages) { page.IdFile = newIdFile; page.PageNumber = counter; counter++; page.Save(); } This does not update my record....

SubSonic equivalent of an SQL update

Hey everyone, I'm wondering if the following SQL update query is possible using the equivalent SubSonic commands: UPDATE MYTABLE SET MYFIELD = MYFIELD + 3 WHERE ANOTHERFIELD = ANOTHERVALUE I couldn't find a suitable way to make a reference to the same field with the Setting object. Any help on this will be greatly appreciated. Rega...

T4 Template issue in web application (VB) (Subsonic)

Hey there, new to SubSonic and Templates. I'm compiling my Web Application using VB.net (I didn't notice anywhere that SubSonic requires C#.net and although I can write c# code I am more versed in VB.NET) and I'm having an issue with the ActiveRecord.tt file. I took the files from the 3.0 download from the "SubSonic_3_0_0_3\SubSonic 3 ...

LINQ Left Join Causes error in SubSonic.Core

I am using the latest version of SubSonic 3 and ActiveRecord. I am trying to do a left join in LINQ. It fails with an error somewhere down in SubSonic. I have a Vehicle object and a VehicleImage object The Vehicle can have multiple images, but it is not required. so a left join is appropriate. This is what I have var ve...