This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi I've got a new application being developed and am going to be using LS as the ORM. Are there any examples of Convention that would be great to follow for LS to hit its' sweet spot eg
This would be a normal Webby CRUD application... ie 95% read :-) Cheers Dave |
|
|
Help Topics > LightSpeed > Conventions is a good place to start. The only things on your list I would pick up on are "use GUIDs for ID" and "get DB to create its own GUID." The former is a matter of taste but GUIDs are not necessarily the most performant PKs, and are ugly to look at in URLs. (E.g. imagine the URL for viewing a particular Widget. With integer IDs you'd have example.com/widgets/1 or example.com/viewwidget.aspx?id=1. With GUID IDs you'd have something a bit ugh-ier.) I'm not saying don't use GUIDs, just suggesting you take a look at the alternative. The latter isn't problematic per se but you need to be sure you are using it in the right way. Even though the database is generating GUID IDs, you cannot use the IdentityColumn identity method and have LightSpeed pick them up. You must let LightSpeed generate its own GUIDs, using the Guid identity method, and overwrite the database default. (This is for various reasons: first, identity columns defeat batching and should be shunned; and second, we don't support GUID identity columns.) One convention you're probably aware of but is worth noting anyway is that foreign key columns should always be named XxxId where Xxx is the name of the association in LightSpeed. E.g. a FavouriteWidget association should be backed by a FavouriteWidgetId column. If you use the designer to create your database schema then it will follow this convention for you. |
|