castle-activerecord

Castle ActiveRecord Mapping problem

As the result of yesterday's discussion , I have decided to use Castle ActiveRecord for my ORM task. I have added attributes to the class according to the starting guide. After fixing some obvious errors, I was greeted with this: *Could not find configuration for CLASS_XXX or its root type Castle.ActiveRecord.ActiveRecordBase this is us...

Automatic type conversion with Castle ActiveRecord properties.

I have a Castle ActiveRecord class with a DateTime property. I am importing data from a text file, and would love to be able to do something like this: string date_started = "09/25/2009"; MyClass myclass = new MyClass; myclass.date_started = date_started; On the final assignment, behind the scenes, it would ideally check the type of d...

Why is NHibernate lazy loading bound to the session?

Using Castle ActiveRecord, I stumbled into a problem when lazy-loading. The following works (obviously) using (new SessionScope()) { User singleUser = User.FindFirst(...) UserGroup groups = singleUser.Groups; // Lazy-loading groups. } Since I need to modify the session filters in a certain context (using interceptors), I crea...

How to get reference to SqlConnection (or Connection string) in Castle ActiveRecord?

how can I get reference to current SqlConnection or Sqlconnection in config? I found http://svn.castleproject.org:8080/svn/castle/trunk/ActiveRecord/Castle.ActiveRecord.Tests/DifferentDatabaseScopeTestCase.cs and code private string GetSqlConnection() { IConfigurationSource config = GetConfigSource(); ...

Castle - ActiveRecord - Inheritage

I'm trying to avoid creating the same properties in all ActiveRecord classes, so I am coding this: Have a base class where I have my common properties: Id, Version, LastUpdate, etc... public class IdentityBase<T> : ActiveRecordValidationBase<T> where T : class Then my "child" class would have his own properties and should inherit fro...

Partial lazy loading

I've one object User which can have multiple Posts. Example: Load the user with lazy loading on the Posts IList<User> users = User.LoadAll() Then I want to read only "half" of the users[2].Posts[3] (retrieve only the attributes that I want and not all of them from that post object), is this possible to make? (Note, I do not want to u...

C# Castle ActiveRecord: How to elegantly (XML) serialize ActiveRecord objects?

Hello, I'm having a difficult time finding information on how to elegantly serialize ActiveRecord objects. We would like to use XML as the format because we need to output our objects in such a way that another program will be able to feasibly parse them. XML-Serialization is usually very easy and straightforward to implement, but the ...

Castle Active Record can not execute query (cuz tablename is = to a keyword)

i am trying to do the "getting started" from castle active record, now i got into this problem could not execute query exception select count(*) as col_0_0_ from User user0_ where 1=1 //it's SQL Server 2008 question: can i somehow make castle put the table name into [ ] like [User] ...

Castle Active Recrod - How to use a composite key

i read that in order to map a lass using Castle ActiveRecord the class must have a primary key (surrogate or composite) now, suppose i have a table which i only want to use it for reading and the table doesn't have surrogate key and natural composite key neither is there any way to be able to still have some manually Guid (or other id)...

how to convert the result in var to DataTable without Loop

How can i convert result in var to datatable without loop? Following is my code:- var result = PhysicianLookUp.Find(Where.PhysicianLookUp.DateTimeStamp.Ge(DateTimeStamp)); ...

ActiveRecord Query (Castle, Performance)

I've 3 tables: Parts: Name: internal name, Active: bool Languages: list of languages (English, French, German, ....) PartsTranslations: RealName and Id's of the other 2 tables. I would like to get a list of Parts telling me the internal name, active status and how many translations are missing (total lang subtract translations made)...

Sample Application(s) using Castle ActiveRecord?

I have been trying to track down some sample applications that are using Castle ActiveRecord. Do you know of any good sample applications? ...

Can ActiveRecord HasMany/Belongs To use a non-PrimaryKey Column for the relation?

I'd like to have a parent-child hierarchy AND I'd like to have the concept of a "series-id" on the parent. So the parent (if you updated it) would expire the old unique key.. keep the series id and insert a second row. I'd like the children to "hang" off that series id rather than the unique id. Do you know if it's possible for Belong...

NHibernate EventListeners - getting the value of a property of the entity being saved

I'm implementing a custom EventListener to save auditing information in NHibernate. I'm currently extending DefaultSaveOrUpdateEventListener, overriding PerformSaveOrUpdate, going through the properties of each entity and saving them elsewhere. This works with simple properties, but fails when cascade-saving a one-to-many relationship....

Why is my Castle ActiveRecord HasMany /Any mapping causing FK Constraints?

I have three classes-- User, Team, and ProjectBid. Both User and Team inherit from a IProjectBidder interface. I want to map them in ActiveRecord something like this: class Team: ModelBase<Team>, IProjectBidder { [HasMany(typeof(ProjectBid), Table = "ProjectBid", ColumnKey = "BidderID", Lazy = true)] public IList<P...

db localization with ASP.NET MVC and Castle.ActiveRecord

I'm trying Castle.AR in an ASP.NET MVC 1 app. I want to store localized content on db. I'm thinking of creating a single table with int stringId, string locale, string text, and all other tables with int fields instead of strings. [ActiveRecord] public class LocalString : ActiveRecordBase<LocalString> { [PrimaryKey] public int ...

Refine: Castle ActiveRecord SessionScope implementation for WCF with PerSession InstanceContext

Hi Guys to facilitate lazy loading on our WCF Services that use AR I created a "Session Scope PerRequest" solution for WCF. [edit] Ok so I put the question on the end :) so bear with me and start reading at the end. :) [/edit] If you want to use ActiveRecord in a website or webservice you have to tell it via the configuration it is run...

NHibernate HasAndBelongsToMany polymorphic association not being respected

Class structure looks like the following: abstract ItemBase - Discriminator [Type] = 0 [PrimaryKey GuidComb] Id ... shared properties Item : ItemBase - [Type] = 1 [HasAndBelongsToMany, Inverse = true, RelationType = Set] -> Documents ... other properties ItemHistory : ItemBase - [Type] = 2 [HasAndBelongsT...

ASP.NET MVC - Castle ActiveRecord - Show SQL queries

I'm using ASP.NET MVC with Castle ActiveRecord as my persistance layer. I want to know if it's possible to show the SQL queries being executed on my MySQL server. I know it's possible in a Web application using the "show_sql" property in the Castle XML configuration file, but I don't know how to do it using a Web application, since I d...

Caste ActiveRecord - LINQ optimised query

I use Castle ActiveRecord as my persistance layer. I got this functions that must return the first 20 users from the database. IList<User> users = new List<User>(); var userQuery = from u in User.FindAll() orderby u.CreationDate select u; return userQuery.Take(20).ToList(); In my database, I currentl...