Home   Free Applications   Code Snippets   Fun Stuff 
 
 You are here: Home > Free Applications > Templates
Register   Login  

 
Site Navigation


Print Print this page
Email E-mail this page
Bookmark Add to Favorites

 
File Name: ORMapper.Templates.2.5.zip
File Size: 23,017 bytes
Downloaded: 1852 times
Posted by pwelter34 on Friday, March 18, 2005 (EST)
Latest Updates ...
* Improved ManyToMany table detection.
* Added Resync method to generated default methods.
* Added RetrieveScalar method to generated default methods.
* Removed the Last Updated date time.

Latest Updates …

  • Improved ManyToMany table detection.  A ManyToMany table no longer needs to have 2 primary keys to be detected.  The rule now reads as…  if Columns.Count = ForeignKey.Count = 2 then ManyToMany
  • Added Resync method to generated default methods.  The generated entity classes now have a Resync method to refresh the data of an instance. 
  • Added RetrieveScalar method to generated default methods.  The RetrieveScalar method returns the first instance of an entity from a where clause.  This method is a shortcut to a common pattern where you want the first instance from a collection of instances.
  • Removed the Last Updated date time.  The Last Updated date time was removed because it created needless new versions of the file in version control if the date time was the only change. 

 

Click here to download this file
Average Rating:

Comments:

Templates rock!
By jensenkd on Saturday, March 19, 2005 (EST)

Paul,

Your templates rock!

I'm wondering what best practices are when binding a collection of custom objects to a datagrid are.

I have a List of 'Contact' objects.  The Contact object contains an 'User' object as Owner of the contact.

How can I expose the properties of the User object to the datagrid?  I could create read-only properties on the Contact object that refer to the User Object.  Is this the best way to do it?

Keep up the great work!

Kevin

Reply to this Comment

Template Column Example
By pwelter34 on Saturday, March 19, 2005 (EST)

Kevin,

The easiest way to display a property of a child object is to create Template Column.  Example ...

<asp:TemplateColumn SortExpression="UserID" HeaderText="User Name">
 <ItemTemplate>
  <asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.UserObject.Name") %>'>
  </asp:Label>
 </ItemTemplate>
</asp:TemplateColumn>

In the above example, DataItem is an instance of Contact, UserObject is a property of Contact.  UserObject is assumed to have been created by the template because there is a foreign key from Contact table to User table. Finally, Name is a property of User.

Hope that helps,
~Paul

 

Reply to this Comment

WOW
By jensenkd on Saturday, March 19, 2005 (EST)

I can't believe I didn't know you could call inner classes that way.

I feel so dumb.

Thank you Peter!

Reply to this Comment

Many-Many mapping?
By martigno on Friday, March 25, 2005 (EST)

Paul,

First, thanks for your work on the templates, they rock!

My question is about the many to many mapping capability.  I'm using a SQL 2000 db and have three tables (very similar to your example of role->user->userrole.  The userrole table has two “foriegn key relationships” defined in it but when I gen the mapping file, I don't get the many to many mapping I thought I would get.

Is there something else I need to be defining on the tables to get the many-many mapping to be picked up?

Thanks in advance,
Jeff

Reply to this Comment

Many-Many Mappings?
By martigno on Friday, March 25, 2005 (EST)

Just found it.  The templete requires that the intermediate template (userrole) have only two columns.  It did pick up the many-many relationship then.

Thanks,
Jeff

Reply to this Comment

Can't see relations
By dugrless on Wednesday, March 30, 2005 (EST)
I love these templates, but I can't seem to get them to show my MySql relationships. I'm using MySql 4.1.10 and the lastest MySqlSchemaProvider from over at the CodeSmith forums (http://www.ericjsmith.net/codesmith/forum/default.aspx?f=9&m=4357&p=1&ord=d). Any help would be greatly appreciated!

Reply to this Comment

New MySqlSchemaProvider
By dugrless on Wednesday, April 06, 2005 (EST)
For anyone else using these templates with MySql, I've just uploaded a new version of MySqlSchemaProvider over on the CodeSmith forums (http://www.ericjsmith.net/codesmith/forum/default.aspx?f=10&m=2900&p=1&ord=d). I redesigned the provider specifically to work with these templates, so it now correctly exposes foreign keys (in InnoDB tables at least) as well as auto_number identity columns. Have fun!

Reply to this Comment

eats disaster spreads across the globe.
By wbondarmunw on Thursday, May 01, 2008 (EST)
All greetings... I faith that chose the decent leg of it for asking your inconceivable, if not, sorry. I do not awfully many times go to the forums. And my, my inconceivable is what is: How do you deliberate on how moment the tough nut to crack of guerdon increases, and whether it is practical broad shock, the deed data that already incident, namely: Rising grub charges has transformed subsistence into an ecumenical gin excess ofnmental issue. Riots make erupted in Egypt, Haiti and Bangladesh closed soaring grub tolls. People fought one another remaining bags of rice in West Africa. The causes and the solutions to the grub calamity are complex. Iif not knotty and you pull someone's leg your theory on this, suit rejoin, I am unundoubtedlyably interested to listen to your conception. See you later! P.S. Sorry for my english.

Reply to this Comment



Top
 
CNET News.com


Tech news and business reports by CNET News.com. Focused on information technology, core topics include computers, hardware, software, networking, and Internet media.

  • Microsoft adding to its Labs collection
    Startup Labs will be an effort under Ray Ozzie, joining other efforts including Live Labs, adCenter Labs and Office Labs.

  • Security Bites 113: The security of Chrome
    Billy Hoffman of HP Web Security talks about Google's new browser, how it handles Javascript and what it means for Web 2.0 security.

  • Are Demo and TechCrunch50 fragmenting their audiences?
    With both events scheduled to start Monday, many press, as well as venture capitalists and others are having to choose which one to attend.

  • A user guide to following DemoFall and TechCrunch50
    More than 100 products are going to be introduced during the week of September 8. Will they be any good?

  • What's McCain doing in front of my junior high?
    Speculation has it that it was a goof-up that had the Republican nominee standing in front of Walter Reed Middle School during his acceptance speech. In any case, the image brings back memories for CNET News' Ina Fried.


    Copyright 1995-2008 CNET Networks, Inc. All rights reserved. Last Refreshed 9/5/2008 3:40:03 PM
  •