The current system that I am working on makes use of Castle Activerecord to provide ORM (Object Relational Mapping) between the Domain objects and the database. This is all well and good and at most times actually works well!
The problem comes about with Castle Activerecords support for asynchronous execution, well, more specifically th...
Let's say I have many-to-many relationship (using the ActiveRecord attribute HasAndBelongsToMany) between Posts and Tags (domain object names changed to protect the innocent), and I wanted a method like FindAllPostByTags(IList<Tag> tags) that returns all Posts that have all (not just some of) the Tags in the parameter. Any way I could ac...
Has anyone tried the ActiveRecord Intro Sample with C# 3.5?
I somehow have the feeling that the sample is completely wrong or just out of date. The XML configuration is just plain wrong:
<add key="connection.connection_string" value="xxx" />
should be :
<add key="hibernate.connection.connection_string" value="xxx" />
(if I understa...
Is it possible to have a HasMany relationship of a basic type such as String, on an ActiveRecord class, without the need for creating another entity such as (TodoListItem) to hold the value.
[ActiveRecord]
public class TodoList
{
[PrimaryKey]
public int Id
{
get { return _id; }
set { _id = value; }
}
[HasMany(typeof(...
I believe there is a discussion on this very topic somewhere on the net but I lost the url and I am unable to find it via googling.
What I might try right now would be:
ISessionFactoryHolder factoryHolder = ActiveRecordMediator<EntityClass>.GetSessionFactoryHolder();
ISession session = factoryHolder.CreateSession(typeof(EntityClass));
...
Is there any simple way to generate a default crud (given an entity) with activerecord (castle implementation)
or something similar for NET?
There is something like this for RoR ( it think its called activescaffold)
Thanks
...
I'm trying to verify if a schema matches the objects I'm initializing.
Is there a way to get the TableName of a class other than simply reflecting the class name?
I am using some class with explicit TableNames
Edit: using Joe's solution I added the case where you don't specify the table name, it could probably use a constraint
public...
I'm using Castle ActiveRecord, but this question applies to NHibernate, too, since a solution that works with NHibernate should work for ActiveRecord. Anyway, what I have is an underlying table structure like this:
TableA -hasMany-> TableB
I have corresponding objects EntityA and EntityB. EntityA has an IList of EntityB objects. Thi...
I'm using Castle ActiveRecord for persistence, and I'm trying to write a base class for my persistence tests which will do the following:
Open a transaction for each test case and roll it back at the end of the test case, so that I get a clean DB for each test case without me having to rebuild the schema for each test case.
Provide the...
My SQL table looks like this:
CREATE TABLE Page (
Id int primary key,
ParentId int, -- refers to Page.Id
Title varchar(255),
Content ntext
)
and maps to the following class in my ActiveRecord model:
[ActiveRecord]
public class Page {
[PrimaryKey]
public int Id { get; set; }
[BelongsTo("Parent")]
publ...
I would like to separate my application into three tiers to use a service layer. I would also like to use the same domain model in both the UI tier, and the business layer tier because I control both ends.
This makes sense, but I would also like to use Castles Active Record for the Data Access layer. Because of this I can not longer ref...
I'm trying to figure out how to execute a custom query with Castle ActiveRecord.
I was able to run simple query that returns my entity, but what I really need is the query like that below (with custom field set):
select count(1) as cnt, data from workstationevent where serverdatetime >= :minDate and serverdatetime < :maxDate and userI...
If I have an existing database, I want to be able to automatically code generate the corresponding Castle ActiveRecord C# classes based on the db schema. My primary intent is to avoid manually creating each class. What are my options for code gen tools with templates that can already specifically do this for Castle ActiveRecord?
(Note:...
The default behavior of NHibernate is the write all changes to objects to the database when Session.Flush() is called. It does this whether you want it to or not.
How do we prevent writing bad data to the database when we need to do things like validate business rules or input?
For instance ..
Customer Name is not null.
User opens ...
Hi,
I'm trying to do a simple "Select Count(*) from PRODUCTS where date > xxx" with Castle on NHibernate.
If I was directly using NHibernate, I could reuse this question answers but unfortunately I see no easy way to access the Current NHibernate session from Castle Records.
I obviously don't want to retrieve all my objects and do a C...
Rather than the demos can you suggest any open source projects using castle activerecord for code study?
...
I'm doing this system Stacked and I am creating the search function. And in that process it occurs to me that maybe AR/nHibernate Expression.Like (and siblings) might maybe not be 100% "safe" in that you can create stuff like;
"\r\ndrop database xxx;---" and similar things...?
I would expect them to be safe, but I am not sure...
...
My web application (MonoRail, Windsor, ActiveRecord) has a Startable import service and one or more Startable import readers. When, for example, a file is dropped in a directory, a reader parses the file, passes the data to the service, which updates and/or creates objects through repositories. The problem I have is that these Startable ...
When using Castle ActiveRecord, is it possible to determine during runtime which connection string to use?
As I understand it, ActiveRecord has to be initialized only once during the application's lifetime and this means that database connection strings have to be configured prior to initialization.
However, is it still possible to det...
ScalarQuery<int> query = new ScalarQuery<int>(typeof(Role),
"select count(role.RoleId) from Role as role");
return query.Execute();
It fails with the invalidcast exception but succeeds when count is replaced with max.
...