castle-activerecord

Castle ActiveRecord Seeding Primary Key Value

I am wondering how to 'seed' an auto incrementing primary key value using Castle AR? For Example wanting the Orders table primary keys to start out as 10000. Is this something that is 1. possible 2. a good solution for creating order numbers? Maybe there is a way to have consecutive auto incrementing field on the DB that is NOT the pk...

Table Prefix Using Castle Active Record

Is there anyway to add a prefix to table names at configuration time using Castle Active Record? [ActiveRecord("Address")] public class Address : ActiveRecord<Address> {} I'd like the actual table created/referenced to be "PRODAddress" or "DEBUGAddress". Is there anything built-in like that I am not seeing? Thank you, [EDIT] I've ...

Large OR Expression in Castle.ActiveRecord

Hello. I am triyng to a do psuedo-fuzzy logic query in active record. How do I express: field1 like 'A' or field2 like 'A' or field3 like 'A' or field1 like 'B' or field2 like 'B' or field3 like 'B' using the ICriteria objects...where the 'likes' need to be InsensitiveLikeExpressions? ...

How do I run an HqlBasedQuery that returns an unmapped list of objects using nHibernate?

I want to run a query against two tables (which happen to be mapped in ActiveRecord). The query returns a result list that cannot be mapped to an ActiveRecord object (as it is custom aggregate information). For instance Dim query_str as string = "Select distinct d.ID, (select count(1) as exp from Sales_Leads where date_created <= :tod...

Are there any gotchas when using Castle ActiveRecord/NHibernate with WCF?

The kind of flexibility that Activerecord gives to our DB design, we are looking at it for our DAL and build model around it. We will be creating a WCF service on top of all this. Are there any gotchas or compat issues when using NHibernate based Castle Activerecord? Specially when it comes to the DataContractSerializer that WCF uses. Si...

nHibernate (w/ Castle ActiveRecord) with C# interfaces (esp for DTO's)

Any using nHibernate with a Domain object & DTO object implemented from a common interface? I'm trying to separate all of my nHibernate attributes into the Domain object, leaving my DTO's and interface clean. The problem comes with nHibernate throwing errors when it tries to associate the interfaces with the concrete classes. NHibernat...

How can i run castle activerecord in medium trust hosting?

I have followed the guidelines to generate the proxy and yet i get the following security exception [SecurityException: That assembly does not allow partially trusted callers.] Castle.ActiveRecord.Framework.Internal.ActiveRecordModelBuilder..cctor() +0 How can i correct this? ...

How do I return a limited set of columns in a Castle ActiveRecord query?

and have it map to a strongly typed object? Suppose I have a entity Blog with Id,Name,Posted,IsUglyFace,YerMom but I just only want/need Name and Posted columns. I tried to do something like: IList blogs = repository.SimpleQuery("select Name, Posted from Blog"); This dumps out a ton more SQL and gives back an error, could not map to...

How do I get back a strongly typed collection that queries multiple entities with Castle's ActiveRecord?

I'm trying to get a specific set of data while joining 4 different entities together to do so. What I've done is setup a DTO to try to get this working: public class LatestThread { private readonly string comment; private readonly DateTime posted; private readonly string userName; private readonly int reputation; private readonly ...

How to do a 'ExecuteNonQuery' in Castle Active Record

I have the following code to perform a database level operation through our active record ORM layer. public static void Vacuum() { Execute( delegate(ISession session, object instance) { ISQLQuery query = session.CreateSQLQuery(@" VACUUM billableaddresses; ") query.List(); return null; ...

How to use XMLSerializer with a Castle ActiveRecord containing an IList<T> member

I am trying to use the XMLSerializer with a castle active record class which looks like the following: [ActiveRecord("Model")] public class DataModel : ActiveRecordBase { private IList<Document> documents; [XmlArray("Documents")] public virtual IList<Document> Documents { get { return documents; } set ...

Find the Top 10 results from a table using Castle ActiveRecord

Hi, I'm trying to get say the top 10 scores for the users of my application. I'm usually using something along the lines of User.SlicedFindAll(0, 10, NHibernate.Expression.Expression.Eq("IsActive", true), NHibernate.Expression.Order.Desc("Score") which is usually used for pagination purposes. However, I don't want to add any const...

Castle ActiveRecord - Command line Assemblies vs. VB.Net Assemblies Problem

Ok, so here is the deal. I have this project called Import.exe. It will look for a file, parse it and use Castle AR to import. This runs great at the command line. Now that same Import.exe needs to be ran from and VB.NET web program after a file Upload. I am using System.Debug.Process.Start to call the exe. The file uploads fine, the p...

Cascading with Castle ActiveRecord HasAndBelongsToMany's

I'm having a lot of trouble cascading deletes through a HasAndBelongsToMany relationship using Castle ActiveRecord/NHibernate. I have Photos which have and belong to many Tags. They are joined by a table called PhotoHasTag which just has a photoId and tagId. When I delete a Photo, I'd like all associated PhotoHasTag entries to be delete...

Aggregate query with Castle ActiveRecord

I'm trying to perform a simple aggregate query that returns the aggregate's result plus an extra column. This post -> http://stackoverflow.com/questions/308203/custom-query-with-castle-activerecord had a good example about how to achieve this, but I can't seem to get it to work. It seems that ActiveRecordMediator.ExecuteQuery returns an ...

Castle Active Record: SQL Express doesn't work. SQL Developer does.

I've been trying to troubleshoot a Castle ActiveRecord exception for days now. Whenever I attempt to access the database I get an exception with an InnerException value of "An attempt to attach an auto-named database for file database.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located o...

Errors: How to save a many-to-many relationship in Castle Active Record?

I've been trying for hours to get many-to-many relationship to save with Castle ActiveRecord. What am I doing wrong? I can't find anything in the documentation or on google. There is data in the database. Courses have a many to many relationship with Books. Test code. Database.Course c = new Database.Course(); c.Number = "CS 433"; c.N...

The state of LINQ to NHibernate ActiveRecord

Hi, Does anyone know if the LINQ to NHibernate ActiveRecord is ready for production? I'm about to start a project that has some tight modelling deadlines. ActiveRecord looks like a winner as opposed to my previous experiences with LINQ to SQL. LINQ to SQLs db first is nice, but somewhat cumbersome after a while. What makes LINQ to SQL ...

Castle Project ActiveRecord - can it use stored procedures with SQLServer 2005?

I am new to Castle Project ActiveRecord. I have starting getting my hands dirty and I just seen that It can generate for you the schema, add data, update data to the schema. There are advantages of using stored procedures in SQL Server 2005, one of them being they are precompiled. Is there a way of telling Active Records to use a parti...

[Active Record] How to get a list of objects with more then one initialized collection using Eager Loading and Detached Criteria?

I have a class with two many-to-many associations. After reading the AR docs I realised that I'm allowed to get only one collection at a time using eager loading. So how is it possible to get a list of objects with both initialized collections for each object using eager loading and DetachedCriteria? So far... DetachedCriteria dc = De...