We are very interested in MVC ASP and have been developing on RAILS for over two years. We are looking into the Silverlight clients, so are giving ASP.NET another look, to server up Silverlight clients. But we were rather dissapointed at the lack of support
to Active Record in ASP. MVC Hopefully it won't be long in comming, because the MS Data Access model still seems a rather confused mess.
Anyone aware of when ASP MVC will be supporting Active Record behaviour ?
I doubt that the MVC framework will ever include any ActiveRecord behavior, because it's not really in the scope of MVC to define the model/data persistence architecture. MVC!=RAILS. If you want ActiveRecord you can use e.g
Castle ActiveRecord (which works flawlessly together with ASP.NET MVC, and it's created by the same people who brought us
MonoRail, a framework which is very similar to ASP.NET MVC but has been in development quite a bit longer). You may also have a look at
Linq to SQL, from Microsoft, or any of the other O/R mapping systems available for .NET.
You could also have a look at the Subsonic project
Well AFAIK an MCV framework without Active Record support is pretty daft. If what you imply is true of intended MS direction, then its MVC offering will dissapoint most of us. MS will always be playing catch up with RAILS, MonoRAILS .... and Hey SubSonic
also look really interesting. Surely enough evidence enough out there on what MS has to do to catch up.
Some Definitions (why do definition lists not work in the forum?):
MVC
An application design pattern focused on seperating presentation logic from business logic.
Active Record
An object persistence design pattern where each instance of an object represents one row in a table-like database, and properties are represented by columns
Active Record and MVC have absolutely nothing to do with each other. And in .Net, that is a good thing. In .Net, it is a good thing that you can decide to use any model you like, as some models of databases are more suited to certain situations that Active
Record. Since .Net maintains a separation of the two patterns, we can use whichever pattern is most appropriate. Most of the time, that pattern is Active Record, since Active Record is a very good pattern (and, it should be noted, was around long before rails
made it famous).
As others have noted, there are various Active Record patterns available for the .Net platform, my personal favorite being DLINQ (since LINQ in C# is so pretty), and the wonder of .Net is that you are free to chose whichever one you like, instead of being
told by one singular entity that their implementation of the pattern is superior.
I too use Rails, it is my second choice beyond .Net. But its single greatest flaw is its lack of flexibility. Conventions are a wonderful thing in programming, but I'm not willing to give up the flexibility I have in .Net to chose which design pattern to
implement based on the problem at hand simply to gain conventions that I frankly already have thanks to the power of the IDE.
To that end, I hope that the MVC team at Microsoft DOES NOT become involved in producing an ORM engine of any kind, Active Record based or not.
PS- I do not mean to sound too hard on Rails...it is indeed my second choice of web frameworks, as it's very well designed and well thought out, to a level that most others, which are frankly a bunch of hacks, are not. Rails 2.0 is a huge improvement, and
when paired with the bytecode and native threads in Ruby 2.0, I think it will make a strong case for production use. I just prefer .Net for flexibility.
The problem with this solution is the number of argument the action method maybe need to user the built in "mapping". So in this case an ActiveRecord solution would be better to have, only to reduce the number of argument, but not only.. I prefer Presentation
Model, and I want that model to be passed to the Action methods to work more model driven. I don't care if Microsoft is going to build a simple "UI-mapper", if I need a more sophisticated solution, I can use it, but the important part is that the MS ActiveRecord
solution is not tight couple to the MVC Framework. I should in an easy way decide to not use it or use it. It should be easy to change it also to another solution. The problem today with the Controller is that the mapping I mention at the top of this post
is added to the base Controller class, and I don't like that. I want it to be separated from the Controller. The reason is when I want to build my custom Controller class and inherit the Controller to reuse basic and common functionality. In this case the
mapping is tight couple into the controller and together with the code to execute a action method, and I don't want to rewrite the whole execution of action method to bypass the mapping...
The problem with this solution is the number of argument the action method maybe need to user the built in "mapping". So in this case an ActiveRecord solution would be better to have, only to reduce the number of argument, but not only..
I fail to see how this could have anything to do with ActiveRecord, but I agree that the mapping issue has to be solved. The MonoRail DataBinding approach (somewhat misleading name, it should be called AutoPopulate or something..) is a good solution.
Sorry, my bad. I was confusing it with a soluton that use an UI-mapper to mapp the UI controls against a class, and what I remember they call it an Active record. But when I read the other posts more deeply, I notice that you are talking about Active Record
pattern, http://martinfowler.com/eaaCatalog/activeRecord.html
In this case MS should not create an ActiveRecord solution, we have LINQ to SQL, ADO.Net Entity Framework etc.
JuliasW00
Member
7 Points
14 Posts
Where is Active Record ?
Jan 29, 2008 08:04 PM|LINK
We are very interested in MVC ASP and have been developing on RAILS for over two years. We are looking into the Silverlight clients, so are giving ASP.NET another look, to server up Silverlight clients. But we were rather dissapointed at the lack of support to Active Record in ASP. MVC Hopefully it won't be long in comming, because the MS Data Access model still seems a rather confused mess.
Anyone aware of when ASP MVC will be supporting Active Record behaviour ?
gunteman
All-Star
22406 Points
3305 Posts
Re: Where is Active Record ?
Jan 29, 2008 09:22 PM|LINK
I doubt that the MVC framework will ever include any ActiveRecord behavior, because it's not really in the scope of MVC to define the model/data persistence architecture. MVC!=RAILS. If you want ActiveRecord you can use e.g Castle ActiveRecord (which works flawlessly together with ASP.NET MVC, and it's created by the same people who brought us MonoRail, a framework which is very similar to ASP.NET MVC but has been in development quite a bit longer). You may also have a look at Linq to SQL, from Microsoft, or any of the other O/R mapping systems available for .NET.
You could also have a look at the Subsonic projectJuliasW00
Member
7 Points
14 Posts
Re: Where is Active Record ?
Jan 31, 2008 04:41 PM|LINK
Well AFAIK an MCV framework without Active Record support is pretty daft. If what you imply is true of intended MS direction, then its MVC offering will dissapoint most of us. MS will always be playing catch up with RAILS, MonoRAILS .... and Hey SubSonic also look really interesting. Surely enough evidence enough out there on what MS has to do to catch up.
Cheers
Jules
rjcox
Contributor
7064 Points
1444 Posts
Re: Where is Active Record ?
Jan 31, 2008 05:06 PM|LINK
Active record is available elsewhere in .NET: LINQ to SQL now, and (the more general) ADO.NET Entries coming.
There is no need for another implementation (we've already got multiple serialisztion frameworks, let us not encourage more duplication).
AbstractAppr...
Member
26 Points
26 Posts
Re: Where is Active Record ?
Jan 31, 2008 05:42 PM|LINK
Some Definitions (why do definition lists not work in the forum?):
MVC
An application design pattern focused on seperating presentation logic from business logic.
Active Record
An object persistence design pattern where each instance of an object represents one row in a table-like database, and properties are represented by columns
Active Record and MVC have absolutely nothing to do with each other. And in .Net, that is a good thing. In .Net, it is a good thing that you can decide to use any model you like, as some models of databases are more suited to certain situations that Active Record. Since .Net maintains a separation of the two patterns, we can use whichever pattern is most appropriate. Most of the time, that pattern is Active Record, since Active Record is a very good pattern (and, it should be noted, was around long before rails made it famous).
As others have noted, there are various Active Record patterns available for the .Net platform, my personal favorite being DLINQ (since LINQ in C# is so pretty), and the wonder of .Net is that you are free to chose whichever one you like, instead of being told by one singular entity that their implementation of the pattern is superior.
I too use Rails, it is my second choice beyond .Net. But its single greatest flaw is its lack of flexibility. Conventions are a wonderful thing in programming, but I'm not willing to give up the flexibility I have in .Net to chose which design pattern to implement based on the problem at hand simply to gain conventions that I frankly already have thanks to the power of the IDE.
To that end, I hope that the MVC team at Microsoft DOES NOT become involved in producing an ORM engine of any kind, Active Record based or not.
PS- I do not mean to sound too hard on Rails...it is indeed my second choice of web frameworks, as it's very well designed and well thought out, to a level that most others, which are frankly a bunch of hacks, are not. Rails 2.0 is a huge improvement, and when paired with the bytecode and native threads in Ruby 2.0, I think it will make a strong case for production use. I just prefer .Net for flexibility.
gunteman
All-Star
22406 Points
3305 Posts
Re: Where is Active Record ?
Jan 31, 2008 10:50 PM|LINK
Very well put, AbstractApproach! I agree intensely that ActiveRecord should not be tied to ASP.NET MVC in any way.
Fredrik N
All-Star
29674 Points
5334 Posts
MVP
Re: Where is Active Record ?
Feb 01, 2008 08:52 AM|LINK
There is a solution added to the Controller today where parameters will be mapped to arguments, for example:
Update(string name, string company, string phone .....)
The problem with this solution is the number of argument the action method maybe need to user the built in "mapping". So in this case an ActiveRecord solution would be better to have, only to reduce the number of argument, but not only.. I prefer Presentation Model, and I want that model to be passed to the Action methods to work more model driven. I don't care if Microsoft is going to build a simple "UI-mapper", if I need a more sophisticated solution, I can use it, but the important part is that the MS ActiveRecord solution is not tight couple to the MVC Framework. I should in an easy way decide to not use it or use it. It should be easy to change it also to another solution. The problem today with the Controller is that the mapping I mention at the top of this post is added to the base Controller class, and I don't like that. I want it to be separated from the Controller. The reason is when I want to build my custom Controller class and inherit the Controller to reuse basic and common functionality. In this case the mapping is tight couple into the controller and together with the code to execute a action method, and I don't want to rewrite the whole execution of action method to bypass the mapping...
MVP, ASPInsider, WCF RIA Services Insider
My Blog
gunteman
All-Star
22406 Points
3305 Posts
Re: Where is Active Record ?
Feb 01, 2008 04:56 PM|LINK
I fail to see how this could have anything to do with ActiveRecord, but I agree that the mapping issue has to be solved. The MonoRail DataBinding approach (somewhat misleading name, it should be called AutoPopulate or something..) is a good solution.
Fredrik N
All-Star
29674 Points
5334 Posts
MVP
Re: Where is Active Record ?
Feb 01, 2008 05:07 PM|LINK
Sorry, my bad. I was confusing it with a soluton that use an UI-mapper to mapp the UI controls against a class, and what I remember they call it an Active record. But when I read the other posts more deeply, I notice that you are talking about Active Record pattern, http://martinfowler.com/eaaCatalog/activeRecord.html
In this case MS should not create an ActiveRecord solution, we have LINQ to SQL, ADO.Net Entity Framework etc.
MVP, ASPInsider, WCF RIA Services Insider
My Blog
gunteman
All-Star
22406 Points
3305 Posts
Re: Where is Active Record ?
Feb 01, 2008 05:35 PM|LINK
Fair 'n squared :)
Here's an article showing the MonoRail approach. I think that is what you're after.
http://davidhayden.com/blog/dave/archive/2007/03/17/MonoRailSmartDispatcherControllerDataBindAttributeRock.aspx