castle-activerecord

Missing reference to Castle.ActiveRecord when compiling in Release

In debug, everything builds normally. When I try to compile in release mode, I get: "The type or namespace name 'Castle' could not be found (are you missing a using directive or an assembly reference?)" I obviously have the reference, or the project would not compile in debug either. So, what am I doing wrong? ...

Is it possible to configure default settings on Castle Activerecord attributes?

Is it possible to configure the default settings on Castle Activerecord attributes? For example, I'd like all strings to have length 4001 (which makes it a nvarchar(MAX) on SQL Server) without having to put Length=4001 on every [Property] attribute. I'd also like all collections to be lazy-loaded without having to put Lazy=true on every ...

Use both Class Table and Single Table inheritance in Castle Activerecord?

In Castle Activerecord (on top of NHibernate), is it possible to use class table inheritance globally, and single table inheritance on part of the inheritance tree? I would like to do something like /// <summary> /// Base class for models /// </summary> [ActiveRecord("model"), JoinedBase] public abstract class Model: ActiveRecordBase { ...

Is this a place for ActiveRecordMediator<T>? Knowing I shouldn't do child fetches ahead of time.

In a hierarchical data model i have Parent and Child. Parent has Fields[] and each child will also have the same "Count" of fields.. we'll call them ChildField[] public class Parent : ActiveRecordBase<Parent> { [HasMany] IList<Field> Fields {get; set;} [HasMany] IList<Child> Children {get; set;} } public class Child : Acti...

Using castle project on VS 2008

I've read alot about the Castle Project and decided to start using it, primarilly ActiveRecord. But how to get started? There's an msi that installs an old release on VS 2005. Nothing happens on my VS 2008. There's also a bunch of project specific zips available for downloading indivudually. They contain files: dlls and xmls mostly. Li...

ASP.NET MVC + Castle ActiveRecord + elmah on Mono 2.6 on windows 7

I am trying to get xsp2 to run my asp.net mvc application, but I get the attached error message with no debug information. Nothing useful is produced if I run xsp2 with --verbose. The app runs fine under IIS on Windows Vista and Windows 7 and VS's built in webserver. I know others have had success with this, so I'm hoping that I just...

Can Castle ActiveRecord open a stateless session?

Real simply question: can Castle ActiveRecord open a stateless session? If so, how would I do it? And if not, how would I go about opening a stateless session without it? ...

How do I create different sessions for different windows in a desktop application with ActiveRecord?

I'm building a desktop application with Castle ActiveRecord and want to be able to do the equivalent of 1 nHibernate session per window form. Any ideas on how can I do this with Active Record? Specifically, I have a main window that allows you to browse the data (read-only) and then you can open separate forms to edit the data. Each...

.NET ORM solution with class auto-generation: Subsonic, Castle AR, ...?

I used to work with a custom data mapping library, and curently I'm trying to switch to a more widespread ORM solution. After some experimentation, I refined my requirements to the following: able to generate usable classes from database schema (SQL Server support is enough), support for ActiveRecord pattern, programmaticaly configura...

Castle ActiveRecord something like RowState Property?

Hi! I was looking web for something like DataRow.RowState property in ActiveRecord class, but no luck. I simply want to know whether object has changed or not. Is there something like this in castle ar? ...

How to map a database view using ActiveRecord?

Has anybody tried mapping database views in oracle using ActiveRecord? Please can I get some sample code for that? ...

Insert or Update in Castle ActiveRecord

Is there a built-in way to do an "insert-or-update" in Castle ActiveRecord? Something along the lines of: try { ActiveRecordMediator<TEntity>.Create(e); } catch (Exception) { ActiveRecordMediator<TEntity>.Update(e); } ...

TryDelete in Castle ActiveRecord

How do I delete a record only if it exists? Something equivalent to: try { ActiveRecordMediator<TEntity>.Delete(entity); } catch (Exception) { } ...

Castle ActiveRecord: Save is throwing StaleStateException

Following this question, I tried to convert a sequence of try..Insert()..catch..Update() into a single call to Save(). I'm getting StaleStateException with "Unexpected row count: 0; expected: 1". What am I doing wrong? Here is the code that fails: var u = new User {SignupDate = DateTime.Now, Name="Foo", OpenId = "Bar"}; ActiveRecordMe...

Should I use Linq-to-SQL or the Castle ActiveRecord implementation?

I don't want to write stored procedures any more (not unless I have to), so should I use out of the box Linq-to-SQL or the Castle ActiveRecord implementation? I understand there are some differences between the two as mentioned here on Stackoverflow ...

Deleted object would be re-saved by cascade

What I have is this: Domain.List has many ListToListMemberships called "SubLists" Domain.List also has many ListToListMemberships called "ParentLists" ListToListMembership has one List (the parent). ListToListMembership has another List (the member). Given this I want the following test to pass: [Test] public void WhenDeleti...

TryFindByPrimaryKey in Castle ActiveRecord

How do I search for a record by primary key, but return null if it doesn't exist? public static T FindByPrimaryKeyOrDefault(object id) { try { return ActiveRecordMediator<T>.FindByPrimaryKey(id); } catch (NotFoundException) { return null; } } ...

Transactions in Castle ActiveRecord + NHibernate for dummies

I would like to do the following, all in a single atomic transaction: Read an object through ActiveRecord Save a new object through ActiveRecord Update another table via NHibernate Also, if by the time I finish the transaction, the value of the object I've read in step 1 has changed, I would like the transaction to fail. I've never ...

Return entity via projection query

Is it possible to return an entity using a projection query? I've successfully done it with a SQL query (see below), but can't find how to do it with a projection query. Dim sql As String = "SELECT {a.*}, {b.*} FROM a LEFT OUTER JOIN b ON a.pk = b.fk") ' Convert SQL results into entities {a} and {b} Dim query As IQuery = session.Creat...

How to use Expression.Or() in Castle ActiveRecord?

Please, explain me how to use Experssion.Or() in FindAll function. for example i have 2 conditions - Expression.Like("Text", "%coolstuff%") and Expression.Eq("FromInternet", false) how to use them together via "or"? ...