I have improved the Inequality test in the model template, as requested by JimR. This was another case where it worked well for me, only because I followed the convention that primary keys are named ID, and foreign keys are named SingularOfTable_ID. I know that I should really push the Inequality test into the template, but for now, I have corrected it in the DbFieldInfo class.
Today, I updated the ActiveRecord Code Generator a bit. I checked in changes to use primary and foreign key details from INFORMATION_SCHEMA. The original code used naming conventions to decide what various fields were used for - ID = Primary Key, Field_ID = Foreign Key to table Fields. If you want to use naming conventions, let me know and I can add a setting in App.Config to allow this (along with any "real" key constraints).
Comments
I beleive that I have one remaining issue to get the generated classes that I need. I am not getting the "HasMany" properties generated. I suspect this is due to my naming scheme not matching yours. I am going to research and attempt to get it to work for me. Of course, I will continue to share what ever I find.
Working with your generator and the code it produces has taught me more about ActiveRecord than the getting started tuitorial on the Castle site did. Thanks.
I hope I am not being too much of a pest.
BTW, I used to live in Oklahoma. I have been gone for several years, but miss it. I do not qualify to be an okie, but both of my children do. :)
If you would submit a SQL script that creates several tables and their relations, I could test my templates against them.
Good Luck, and Happy Hibernating!