ActiveRecord

ActiveRecord, NHibernate and SQL Stored Procedures

I love ActiveRecord and NHibernate as ORMs. They do exactly as it says on the tin. I love the fact that I can develop an application in a DDD (Domain Driven Development) fashion and almost forget about the fact that I need a relational database. I also love the fact that I don't have to write lengthy Stored Procedures to get data back....but there is always an application out there where this has to change. I currently working on a new project that requires a lot of reporting and data warehousing, so it has come to the point where I will require...

NHibernate & foreign key constraints

When I allow NHibernate to generate the schema for my object graph I get an issue with foreign key constraints on collections. I'm I can't be the only person that has come across this problem!? I'll try and outline it for you. Ps. At the end of this post I do have a solution! I have an abstract base class that has a simple IList<string> public abstract class VariationBase : DomainBase {     public IList<string> OtherVariations { get; set; } } Then I have a number of other classes that inherit from VariationBase (The idea being that each class could have a title variation for example). When NHibernate...

ActiveRecord & the ASP.NET MVC Framework

I have a simple ActiveRecord class: [ActiveRecord] public class Employee {     [PrimaryKey(PrimaryKeyType.GuidComb)]     public Guid? Id { get; set; }       [Property]     public string FirstName { get; set; }         [Property]     public string LastName { get; set; } } I then create a create/edit form on my UI. To update the database is easy with the ASP.NET MVC Framework and ActiveRecord: In my controller: public void Update(Guid? Id) {     var emp = DomainFactory.Get<Employee>(Id);     BindingHelperExtensions.UpdateFrom(emp, Request.Form);     emp.Save();       //Render View } Ok now I want to add a Department Object to the Employee: [BelongsTo(Cascade = CascadeEnum.SaveUpdate)] public Department Department { get; set; } On my form page I create a select dropdown with a list of Departments. The...

ActiveRecord & NHibernate.Linq

I've been doing a lot of work with Castle's ActiveRecord. In order to get my data back from the database I have been doing queries like: var activities = Repository.FindAll<Activity>(Expression.Eq("Status", StatusEnum.Published) This works great, except for having to use a string for the property I want to set my expression for. How about this: var mostPopularActivities = Repository.SlicedFindAll<Activity>(new[] { "Categories" }, 0, 5, new[] { new Order("ViewCount", false) }, Expression.Eq("Categories.Id", category.Id), Expression.Eq("Status", StatusEnum.Published)); Anybody understand this? Now it's getting really complex. What we are saying is "Get me all the activities and join categories, and get me rows 0 - 5 (top 5), and...

WP Theme &Icons by N.Design Studio adapted by timheuer and ruined by rodj!