Select * from [MonoRail].[Customers]
I just listened to the latest Hansleminutes, talking about MonoRail with Aaron and Jacob from Eleutian. Scott says that "Hansleminutes is the podcast that doesn't waste your time", but this is pushing it. In about 20 minutes, they covered: (MonoRail, MonoRail views, Front Controller, Windsor Integration, Windsor, Testability, Mocking).
The most amusing thing about the guys from Eleutian is that they literally does stuff with code that is just out there. The part about cookies was new to the people who wrote the code, for instance. Particulary interesting to hear the questions that Scott asked (since I already knows the answers :-) ). One question that Scott asked and didn't get an answer was:
The answer to Scott question is simple. You don't. You wouldn't do it in any real application anyway, and you wouldn't do it in MonoRail. You would have a data layer that doesn't include "select * from customers" in the UI, to start with.
Here is the really easy way to handle it:
- Create a new class "CustomerControllers" in the Controllers directory. Inherit from Controller.
- Add this method:
public void Index()
{
PropertyBag["customers"] = Customer.FindAll();
} - Create new directory under Views, called "Customers".
- In this directory, create file "index.brail", in this file, put:
<html xmlns="http://www.w3.org/1999/xhtml">
<head />
<body>
<h2>Customers grid</h2>
<?brail
component GridComponentWithAutoGenerateColumns, {"source":customers}
?>
</body>
</html>
- Point your browser to:
http://localhost/northwind/customers/index.rails
Comments
So where is this MR view components library?
GridComponent and
GridComponentWithAutoGenerateColumns is here:
https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/SampleApplications/Exesto/Rhino.Components
You usually don't need so much external components, but the common ones are already in MR.
You can put my name there, I dont mind being labeled ignorant about the capabilities of MonoRail :-D
This is a great component, I am wandering if there are more gem like this out there. Why don't you people put together something like this in the code base so we all can use?
Comment preview