subsonic3

SubSonic 3.0.0.3 | Data Access Layer - Audit trails

Hi guys how do you implementing an Audit Trails on all objects/class on SubSonic under Data Access Layer? If what I want is, all changes on all objects will be recorded on a single table/object. public class AuditTrail { public int Id { get; set; } public string SourceObjectName { get; set; } public int RowPK { get; set; } // ...

Subsonic 3, SimpleRepository, SQL Server: How to find rows with a null field?

How ca I use Subsonic's Find<T> method to search for rows with a field containing the "null" value. For the sake of the discussion, let's assume I have a c# class called "Visit" which contains a nullable DateTime field called "SynchronizedOn" and also let's assume that the Subsonic migration has created the corresponding "Visits" table a...

SubSonic 3.0.0.3 | SimpleRepository - bit field to bool property

is this a bug? my property of type bool from a bit field on SQL DB, always return (false), even though the value on the Database is (true). although altering the property to true or false seems to be working, if you look at the database/table, the only problem is the fetching... return always "false" I am using - subsonic-SubSonic-3.0...

SubSonic 3.0 Create New and Delete and Insert Pattern Problem

3003 is the exact version I think. Anyway, I have the below code (using ActiveRecord) for creating 2 new entities, deleting any that have the same "Stamp1" and "Stamp2" values, and then I want to insert everything in my List. I cannot tell if the code is efficient for the delete, and I have no idea how to insert everything new from a lis...

Linq nested select new not working

Hi All, I'm trying to get eager loading working with Subsonic, and it's been returning null for me. In the method below, I'm trying to hydrate a domain model (UserModel) which contains another domain model (CompanyModel). However, with the code below, UserModel.Company is always null. What am I missing here. Any help would be appre...

Subsonic 3.0.0.3 with MySQL 4template is not working

Hi, I am ready and see all the tutorials and videos to configure the subsonic 3.0.0.3 with MySql and fail to genarate the ActiveRecords.cs. I use the MySQL.ttinclude in the folder to generate the class but it is still not working. I rename all the refenreces to SQLServer.ttinclude to MySQL.ttinclude and it still does not work. The error...

SimpleRepository and abstraction

Hello everyone, I've been using Sub Sonic 3.x.x.x and i've come across something i need help with. I'm using an abstract class and a factory pattern etc.. and this is basically the problem: public abstract class Person { } public class Male : Person { } public class Female : Person { } .... how do i get this to work String personTy...

SubSonic Generates Namespace, but my website doesn't recognize it.

Hey there, I've got a pretty basic setup in Visual Studio 2008 - Website project referencing my Class library project. SubSonic 3 is referenced from both projects, but the Template has been modified for my MySQL db. It connects and generates the most of code (Accept for StoreProcs for some reason), and the namespace is there, and my ...

SubSonic 3 / ActiveRecord: Find() on non-primary key field failing (VB.NET only)

I'm getting an SqlException when I call Find() on a non-primary key field. I only experience this when I make this call in VB. Details: SubSonic 3.0.0.3 and ActiveRecord Visual Studio 2008 solution SubSonic and T4 templates in a C# class library project My VB application in a separate project referencing the SubSonic project In m...

SubSonic 3.0.0.3 | SimpleRepository - OrderByDescending and .First()

this codes works fine on SQL Express 2008: return _repository.GetInstructions() .Where(x => x.PublishedDate != null) .OrderByDescending(x => x.PublishedDate) .First(); but when run using SQL Server 2000 , it breaks. here is the error. I'll post the trace if someone wants to see it. FailedSystem.Data.SqlC...

can't select into class using linq

I have a query that works fine when using an anonymous type but as soon as I try to un-anonymize it it fails to select all values into the class. here is the linq i'm using (in combination with Subsonic 3): var producten = (from p in Premy.All() join pr in Producten.All() on p.dekking equals pr.ID where p.kilometragemax >= 10...

Indirect binding to child collections in XAML

Hi folks, I am currently using a Linq template with SubSonic3 to create my models. I have a simple Member class, which has a collection of Notes. A Note class has a PublishedDate and Title properties. I have a UserControl which has a collection of Members for its DataContext. There are two ListBoxes and a bunch of TextBoxes and other c...

Subsonic ActiveRecord - Connections hanging when adding lots of records

I'm getting a familiar Timeout SqlException when I add a lot of new records quickly using Subsonic ActiveRecord and Sql Server. Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. I hav...

Question getting started with SubSonic 3 + ActiveRecord

I am struggling pulling a simple list of records from one table object and printing them out. I have a table called [Acceptance] that has four fields, two of which allow nulls. Here is the ddl for the schema object: CREATE TABLE [dbo].[Acceptance]( [AcceptanceID] [int] IDENTITY(1,1) NOT NULL, [AcceptanceCode] [nvarchar](2) NOT...

SubSonic 3.0.0.3 | SimpleRepository - On .Update() : exclude this field

Is there any way to tell SimpleRepository not to include certain properties/Fields on Update()/UpdateMany()? Alternative also is "Only properties with changes are to be updated". ...

Select Top N records with Subsonic 3

I'm using Subsonic 3.0.0.3 for a new project and on one of my pages I'm wanting to display only 5 records that are the top 5 read records. My SQL select statement is select top(5) * from myTable order by reads desc Is this possible to do with ActiveRecord? If it is I haven't came across how yet. Jon ...

Subsonic : Object of type 'System.UInt64' cannot be converted to type 'System.Int64'.

I just hooked up Subsonic to MySql for the first time. Everything seems to be cool except a simple: wp_1_post.All().ToList(); throws: Object of type 'System.UInt64' cannot be converted to type 'System.Int64'. It looks like the ID column in the wp_1_posts table is an unsigned bigint, just not sure what to do about it... ...

Subsonic 3 InnerJoin

Hi there, I am not sure how to go about this. I am looking to join columns of two tables together so that instead of just getting a foreign key back, I can display a name that is on the same row as the foreign id. I did something like this but I kept getting an error about my primary key: SqlQuery test = db.Select.From().InnerJoin(fi...

Subsonic 3 gridview join query

I have a gridview control on a page where I need to do a join query. I've written the LINQ query like so: from v in view_result.Find(f => f.user_id == Session["username"].ToString()) join od in article.All() on v.article_id equals od.article_id orderby v.view_date descending select v; I can't figure out how to write it in the other su...

subsonic 3 - The operation is not valid for the state of the transaction.

Hi I'm trying the following code UserDetail ud = UserDetail.SingleOrDefault(u => u.UserName == CurrentUserName); if (ud == null) ud = new UserDetail(); Address uAddress = ud.AddressId.HasValue ? Address.SingleOrNew(a => a.Id == ud.AddressId) : new Address(); using (TransactionScope tc = ...