subsonic3

SubSonic 3 Linq Join Problems

using the linqtemplates, I tried getting the linq syntax close to what is in the docs var query = from c in db.CountyLookups join s in db.StateLookUps on c.StateLookupID equals s.StateLookupID where c.Name2 == countyName && s.Abbr == stateAbbr select new { Latitude = c.Latitude, Longitude...

What is the difference between Add and Update in SubSonic3 SimpleRepository?

What is the difference between IRepository.Add and IRepository.Update in SubSonic3 SimpleRepository? ...

Subsonic 3 Hierarchic Collection Creation?

I have a single table with a hierarchy inside. I am using ActiveRecord. How can I convert this into a hierarchic collection that I can then bind to a WinForms or WPF treeview? Thanks. ID Name ParentID 1 ALL 1 2 ARGENTINA 1 15 AUSTRALIA 1 16 NW 15 17 BLACKTOWN 16 18 CORLETTE 16 19 PRIMBEE 16 20 TWEED HEADS 16 21 QL 15 22 AS...

How to delete all records in a table using SubSonic 3

I am a little stuck at the moment trying to delete all the records from a table using this approach: new Delete<Contact>().Execute(); This statement fails with a NullReferenceException in BuildDeleteStatement method at line: sb.Append(query.FromTables[0].QualifiedName); because, although FromTables has one entry, it is set to null....

SQLite Int64 vs Int32 Problem and SubSonic ActiveRecord

I thought this was covered elsewhere but I don't see it now. Anyway, having a problem with a simple v3 query. Using SQLite ADO.NET provider 1.0.65.0. My table structure looks like this: CREATE TABLE "SamplerData" ("RowId" INT PRIMARY KEY NOT NULL ,"SampName" VARCHAR(128),"SampPurpose" VARCHAR(2048),"ActiveState" INTEGER NOT NULL DEFAU...

Subsonic 3 and Linq Group by with Count

I have the following two tables: Customer { int Id int Name } Bills { int Id int CustomerId decimal Amount bool IsDue } Now I am trying to get a list where I have: A entry for every customer with the count of associated bills. A entry for every customer with the count of associated bills where IsDue is true. I tried doing the fir...

use subsonic 2.x and 3.x in the same project

Is it possible to mix them? I'm asking because I have a big project that uses Subsonic 2.x generated classes (in a compiled dll) but would like to start using 3.x for new stuff. I tried it last night with a project where I had references to both subsonic.dll and subsonic.core.dll but that didn't work with ambiguous references, etc. So...

When and how can I enforce validation in Subsonic 3?

Is there any event like OnValidate in LINQ where I can add my business validation rules so that they are ALWAYS called whenever I use Add() or Update()? If not: What do you suggest to do? I could add a partial class and wrap the Add/Update methods with own ones but then one could still use the original ones ignoring any business valida...

Subsonic 3.0.0.3 not generating parameters for stored procedures

I have a SQL Server 2008 database with a bunch of stored procedures. When I use the ActiveRecord Template provided with Subsonic 3.0.0.3, it generates methods for all of my stored procedures, but they do not have any parameters. I am dbo on the server and can execute the stored procedures with no issue from Management studio. Example St...

Subsonic 3 using User.Identity.Name versus Environment.Username for Audit Fields?

Hi, Using Subsonic v3.0.0.3 and seems the Update() and Add() methods are using the Environment.Username for the ModifiedBy and CreatedBy fields. What would be the best way for me to get this to use the MVC/Asp.net User.Identity.Username as there are many 'Bob' names in our user collection and currently having a new record created with C...

Subsonic it's not generate the class templates for MySQL in LINQ 4Temapltes

Hi, Iam try to configure and generate the files for subsonic 3.0.0.3 using MySQL. I using the 4 templates to LINQ, but the class.cs it's not generate. Someone can help-me? All the configs works. ...

Subsonic Compare Two Objects

I would like to use this generic CompareObjects class but it seems that the Subsonic record objects don't implement IComparable. User userFromDB = User.SingleOrDefault(x => x.UserName == "CmdrTallen"); User modifiedUser = new User(); TryUpdateModel(modifiedUser); if(CompareOjbects<User>(userFromDB, modifiedUser) != 0) { this.log("U...

Problems with encoding

I'm using MySQL 5.1 and Susbsonic 3.0.0.3. Database and all tables are in cp1251. I have problems with saving russian symbols. After saving it looks like "?????". How i can setup subsonic to save symbols in cp1251? P.S. With reading everything is ok. ...

Subsonic 3.0.0.3 SQL Paging using Linq

Have just updated from Subsonic 2.2 ActiveRecord to 3.0.0.3. I am trying to use LINQ to do a paged Find query like this (my object/table is called "Repository"): Repository.Find(item => item.DocumentTitle.Contains(searchTerm)) .OrderBy(i => i.DocumentTitle).Skip((currentPage - 1) * itemsPerPage) .Take(itemsPerPage); When I v...

Can I run Subsonic 2.1 and 3.0 side by side

I have a small code base using Subsonic 2.1 in my project. I would like to start using Subsonic 3.0 as soon as possible. But I don't currently have resources to convert the 2.1 implementation. Is it possible to start using 3.0 for new code and leave the 2.1 code running. Will I have any special conflicts. Anything I should watch for? ...

Subsonic 3.0: How to use LIKE on objects?

New to Subsonic 3.0 and wondering how to perform LIKE operators on object attributes. Given the following class, how would I perform a LIKE operation using Subsonic 3.0. For example SELECT * FROM categories WHERE name LIKE '%foo%'; public class Category { private String categoryID; private String name; public Category() ...

SubSonic 3 VS SubSonic 2 Genrating Code flexibility ?

Hi, How can i reach same flexibility with Generated clases in SubSonic 3 as i had in subsonic 2. Main needs: -Select wich tables include or exclude. -geneeated files Target. thanks, TheGodfather ...

SubSonic 3: Unit Tests were working but now it cannot find the connection string

I had set up a bunch of NUnit unit tests using the Test connection string in my App.config file and everything was working fine. Then all of a sudden all my tests stopped working and threw the same exception: System.ApplicationException : Connection string 'ApplicationServices' does not exist Yet here are the contents of my Ap...

Subsonic 3: Update<T> problem

I am using SS 3.0.0.3 ActiveRecord. This query: new Update<BillDetail>(provider) .Set(bd => bd.DivisionDetails == divisionDetails) .Where(bd => bd.BillNumber == documentId && bd.IsInvoice == true); produces this SQL: UPDATE `BillDetails` SET `DivisionDetails`=@up_DivisionDetails WHERE `BillNumber` = @0 Where did the IsIn...

SubSonic3 VB.Net Add,Update, FirstOrDefault Problems

Hi, I hade build sctive record dal with subsonic3 Vb.net templates. and i am dealing with alot of bugs in the sub sonic dlls. 1)in Add() function: (i have fix) when indx has counter in the db the returnd new key type is decimal the active record fil have an exception "Public member 'Change Type To' n type 'Decimal' not found". i manage...