castle-activerecord

C# Mapping struct in ActiveRecord

Hi here. i am making a little application to help me balance my checkbook. i am using Castle ActiveRecord to map the object properties to the database. now here is the problem. as i am making a money program i made a struct Currency The struct: public struct Currency { private long amount; private CurrencyType currencyType; ...

Active Record or NHibernate generating invalid Sql for paging on SqlQuery

When applying Paging (using SetFirstResult and SetMaxResults) to an ActiveRecord SqlQuery, with nHibernate 2.1.1 GA and ActiveRecord 2.0.1 the following sql is generated: SELECT TOP 40 FROM (, ROW_NUMBER() OVER(ORDER BY account.Name, account.State) as __hibernate_sort_row select account.Name <rest o...

NHibernate Criteria against an <ANY> Mapping

I have a Project model that has a property of type IProjectWorker, this could either be a single User or a Team. In Castle ActiveRecord it's defined like this: [Any(typeof(int), MetaType = typeof(string), TypeColumn = "WorkerType", IdColumn = "WorkerID", Cascade = CascadeEnum.None)] [Any.MetaValue("USER", typeof(User))] [Any.MetaValue(...

Session Management in Castle Active Record

How do I manage session if I am using Castle Active Record over nHibernate. Basically I can manage the life cycle of ISession on my own if I am using nHibernate directly. But when I am using Castle AR it does not give me a way to manage the life cycle of the session. I want to use single Session per thread. I am using Castle AR in a W...

Passing my own ConnectionString in Castle Active Record

How can I inject my own ConnectionString if using Castle Active Record? ...

Castle Project Active Record or Fluent NHibernate

We've been looking at using an ORM at work. Currently we are trying to way up the pro's and con's of fluent nhibernate against castle active record. We are unsure of the flexibility of each as our database isn't very conventional. It lacks foreign keys and identities on the primary keys (A little confusing but the next value is stored ...

Mapping a property of a class to another Table's column in nHibernate?

For some reason in a legacy database I am working with does not have any relationship defined. I have TableA mapped to ClassA. Now in ClassA I need to add PropertyB which has a corresponding column in TableB. How can we add this without adding a Relation? I am using Castle Active Record over nHibernate. ...

How can i use Castle.ActiveRecord in WCF service ?

I have a Silverlight application, a WCF service with a class library with ActiveRecord entities I need to load a list of entities from the class library in the WCF service and send it to the Silverlight application How do I initialise ActiveRecordStarter in service and establish connection to DB? How do I provide ar:sessionScope? How ...

ActiveRecord SessionScope using WCF Service

the question is how to automatically create new ActiveRecord SessionScope when using WCF Service. in web application there is httpModule described in web.config like but how to use it in WCF service ? ...

What is the overhead of Castle Active Record?

What is the overhead of using Castle Active Record over using nHibernate directly in terms of performance? Is it significant or it does not matter? ...

Lazy loading BelongsTo relation with Castle Active Record?

I have the following mapping for a Relation in Castle AR [BelongsTo("EVENT_ID", Lazy = FetchWhen.OnInvoke)] public EventType PayEvent { get { return m_PayEvent; } set { m_PayEvent = value; } } But the Relatio...

Polymorphic class creating in Castle Project ActiveRecord

I am using ActiveRecord in order to store my classes in the database. I have classes hierarchy, say it Man and Woman inherited from class Human. Human database table contains field Sex which is 0 for man and 1 for woman. I'd like to be able to load class Human with regards to Sex field, that is, if Sex is 0, loading of class Human shoul...

HasMany: Empty list instead of null

I am using CastleProject ActiveRecord. I have the following property in my class: [HasMany(typeof(Order), Table = "Orders", ColumnKey = "OrderId")] internal IList<Order> Orders { get; set; } In case Orders table does not contain any orders, Orders property is null. Can I somehow point ActiveRecord that it should create empty list ...

How to use native Sql for Insert and Update in Castle Active Record?

How to use native Sql for Insert and Update in Castle Active Record? There are sample for using Select query here http://www.castleproject.org/activerecord/documentation/trunk/usersguide/nativesql.html But I can't find any sample for Update and Insert. Update: Basically I am looking for a support for Update/Insert query like this. <...

How to Generate Castle ActiveRecord C# Classes for an Existing Database

What is the best way to generate C# classes for use with Castle ActiveRecord and NHibernate given an existing database structure? Can you recommend any of the class generation tools or is it just less hassle to write the classes by hand? ...

Castle ActiveRecord DetachedCriteria Performance For One To Many Criteria, or just use SubQuery.In

When querying into child collections should I be wary of performance and duplicate results which result from the use of CreateAlias("ChildCollectionName", "alias") would you think it would be better to just perform subqueries on Child Collections to get a big list of "parentId"s and then do an In clause on the parent. For Example clas...

HQLBasedQuery to ProjectionQuery Castle ActiveRecord/NHibernate

Hi, I'm trying to query using Castle and return a strong-typed array or IList for later use in data binding, so from i read a ProjectionQuery would be my best choice, but how would i transform this to a projection query: HqlBasedQuery hql = new HqlBasedQuery(typeof(TrackingRule), Query...

Does Castle ActiveRecord supports SQL formula?

Does Castle ActiveRecord supports SQL formula as supported by nHibernate? E.g. In nHibernate we can do something like this. <property name="CountOfPosts" formula="(select count(*) from Posts where Posts.Id = Id)"/> Is this supported in Castle Active Record? ...

Is it ok to have a reference there?

Hello I am building a new project with Castle ActiveRecord and have a little technical question. I build my projects workspace and added 5 projects. ViewModel for interfaces and application logic Model for the basic model classes Test for unit testing Client for my WPF client data for my datasource Then i added some references to C...

Is it possible to have a varchar(max) column for an ActiveRecord object type?

I really want to have a column of inifinite length for one of the properties of my ActiveRecord object of type string, but I don't know how to set it. When I set the length to -1 (the number for MAX in SQL server) I get an error. Can anyone help? EDIT: I meant to say Castle ActiveRecord. ...