Using constructor to load data in subsonic3?

Posted by Dennis on Stack Overflow See other posts from Stack Overflow or by Dennis
Published on 2010-03-31T10:42:04Z Indexed on 2010/03/31 11:33 UTC
Read the original article Hit count: 693

I'm getting an error while trying to load an record through the constructor.

The constructor is:

public Document(Expression<Func<Document,bool>> expression);

and i try to load a single item in like this

var x = new Document(f=>f.publicationnumber=="xxx");

publicationnumber isn't a key but tried making an it an unique key and still no go..

Am i totally wrong regarding the use of the constructor? and can someone please tell me how to use that constructor?

The error i'm getting is:
Test method TestProject1.UnitTest1.ParseFileNameTwoProductSingleLanguage threw exception: System.NullReferenceException:

with the following stacktrace:

SubSonic.Query.SqlQuery.Where[T](Expression1` expression)
Load`[T]`(T item, Expression
1expression)
db.Document..ctor(Expression``1
expression) in C:\@Projects\DocumentsSearchAndAdmin\DocumentsSearchAndAdmin\Generated\ActiveRecord.cs: line 5613
rest removed for simplicity

Regards
Dennis

© Stack Overflow or respective owner

Related posts about subsonic-active-record

Related posts about subsonic