castle-activerecord

How to find object in nHibernate/castle activerecord session

I am getting the following error in an Asp.Net Castle ActiveRecord app when trying to update an object: "a different object with the same identifier value was already associated with the session" I've looked up and down my code to see where else the object might have been created but I'm not seeing it. This is baffling as I have the ex...

Why Castle ActiveRecord's OnUpdate is called twice?

Hi all, I have override OnUpdate and do some logging with it. But unfortunately it is called twice. Why such thing happens? How it could be corrected? Thanks in Advance UPDATE: I have extended ActiveRecordBase as follow: public class ActiveRecordExtender<T> : ActiveRecordBase<T> { protected override void OnSave() { D...

Castle ActiveRecord Oracle blob query problem

Hello, I am using Castle ActiveRecord for .NET version 2.1. for access to an Oracle Express 2008 database. I have a table with a BLOB column mapped like this. [ActiveRecord("DOCUMENTS", Lazy=true)] public class DOCUMENTS : ActiveRecordBase<DOCUMENTS> { private long id_document; [PrimaryKey(SequenceName = "seq_D...

How to convert Castle Activerecord to pure NHibernate or Fluent NHibernate?

I'm going to refactor a growing project from using Castle Activerecord to pure NHibernate or Fluent NHibernate with Service/Repository pattern and POCO. What would be an easiest way to obtain hbm xml from existing Castle Activerecord model? Another question, is it possible to convert hbm to Fluent NH and vice versa? ...

Unable to create schema with Castle ActiveRecord

Hi all, I'm trying to get started with Castle ActiveRecord (following the "Getting started with ActiveRecord" screencast). I created two ActiveRecord classes, one of them named User. I added the relevant strings to the app.config file, and I initialize using: var config = ActiveRecordSectionHandler.Instance; ActiveRecordStarter.Initia...

CastleProject ActiveRecord and SQLite XP-only problem

Hi, I have written a stand-alone Windows Forms application in Visual Studio 2005 using C#, CastleProject ActiveRecord and SQLite as database (using the SQLite connector). The published application (the binaries from the bin directory) works perfectly on windows vista and windows 7 computers, however when copied to a Windows XP computer...

Example of how to use active record with asp.net mvc

I am looking for the best approach to using NHibernate and MVC.net. I have gone through http://www.codeproject.com/KB/architecture/NHibernateArchitecture.aspx Someone has pointed to the use of Castle project Active record. My aim is to eliminate the need for any nhibernate dependencies within my domain. I want a quick and easy do...

Read N consequent items by ActiveRecord

My project is C# and uses CastleProject ActiveRecord on MS SQL Server database. I need to retrieve N consequent items from the database, sorted by some criteria, started from some value. Example: I have a lot of messages in some table, where message has ID, time and text. I'd like to retrieve messages with position from 100 to 120, whe...

How to determine order number of an item in sorted table

(continued from http://stackoverflow.com/questions/3707200/read-n-consequent-items-by-activerecord) My project is C# and uses CastleProject ActiveRecord on MS SQL Server database. I need to understand the order number of an item from a database, if some sorting criteria applied. Example: I have a lot of messages in some table, where m...

Castle Active Record / SQL Lite / Testing - "Session Was Closed Error"

Hey, I've got a spec project setup that I'm trying to use a SQLite database with. Only I'm having a problem "Session was closed" even when the session appears to only just been created. First of all in my specs folder I have this configuration: <activeRecord isWeb="true" threadinfotype="Orange.TicketManager.Specs.Config.HybridWebThrea...

Validating HQL against the domain with Castle Active Record

Hi all, We use a lot of view model builders which pass HQL strings to the ActiveRecordMediator.Execute method to populate search objects for our views. Doing refactoring occassionally breaks these 'magic' hql strings (without us knowing) I was wondering if anyone has tried using nhibernate named queries to validate HQL in Castle Activ...

How to do a JOIN between two tables using Castle ActiveRecord

I'm trying to perform a join in ActiveRecord using DetachedCriteria. I can't seem to make it work. There is no relationship defined inside the transfer objects. In SQL I should be able to do this but it seems that ActiveRecord wants to force me to define the relationship. What is the deal? Can someone point me to some documentation? ...

What is isWeb attribute for in Castle ActiveRecord

The official documentations says: If ActiveRecord is running in a ASP.Net application, you must add this attribute with the value true So naturally I turned it on and immediately noticed that those background threads (using Quartz.net) that use ActiveRecord to access the Database crash because they try to access HttpContext when th...

How can you stop NHibernate (via ActiveRecord) adding this_. to a table name in a formula

I'm using Castle ActiveRecord which uses NHibernate underneath and I've added a property with a formula as follows to one of my entities: [Property(Formula = "CAST((select count(*) from [User] as u where u.Email = FriendEmail) as bit)")] public bool FriendRegistered { get; set; } The problem is that now any query for this entity fails...

Set Foreign Key name for HasAndBelongsToMany with Castle ActiveRecord

Is it possible to set the name of the foreign key constraints added for a HasAndBelongsToMany relationship? For BelongsTo there is a ForeignKey attribute, but there doesn not seem to be an equivilant for HABTM. ...

Castle Active Record Multiple Database Connections (Oracle and SQL)

Scenario: I have an application that pulls data from a SQL database as well as an Oracle database. I have NHibernate implemented for the SQL side and a co-worker already has a working implementation of the Oracle side (same object different project). I am currently defining a connection string in App.Config and calling this function in P...

Is there any Castle ActiveRecord generator from Visual Studio 2010 Modeling Project?

Hi all, Visual Studio 2010 includes a Modeling Project that lets to create UML diagrams like class diagram. We have plenty of class diagrams in VS 2010 Modeling Project and wish to generate Castle ActiveRecord classes from them. I have searched and found many tools like ActiveWriter, MyGeneration, Active-Record-Gen, The DarkSide, Gener...

Castle Component Validator "Value cannot be null. Parameter name: key" when using FriendlyNameKey

Hi... I'm having a little problem with Validator component from Castle ActiveRecord. I want to localize the messages of the validators attributes, if i use ErrorMessageKey (with the resources from the project) it works fine...but, if i add the FriendlyNameKey property (of the attribute) and try to validate my model it's throws an Argume...

disconnect to database

Hello there. I'm starting with Castle ActiveRecord. In my application I have a tool create a new data base file (I use SQLite). I create new data base by use ActiveRecordStarter.Initialize() and ActiveRecordStarter.CreateSchema(), then I add some data to this data base. After this I want to disconnect to this database and connect to an...

What is NHibernate session exactly?

Hi all, It's a long time I'm working with NHibernate session through frameworks like Castle ActiveRecord but never understood what is a session exactly and how should manipulate. Can anybody help? Is there any concise resource? Thanks in Advance ...