Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 13th, 2008, 08:56 AM
Registered User
 
Join Date: Feb 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to crab
Default using Flixon to regenerate the Store

Hey-

Just started looking at regenerating the store code using Flixon. Want to beef it up quite a bit, adding a many to many Department-Product relationship, product attributes, suppliers, payments, shipping, etc. I've got all the tables and relationships built.

I see in the readme:
- Tables should not have prefixes
- Columns should not have prefixes
- Primary and Foreign keys should end with "ID"

are prefixes things like "tbh"? I'd think not. What type of prefixes are you talking about? things like "bInStock" and "dtReleased"?

Also, if the keys do not end in ID, does Flixon miss the relationship? I often use 'Code' as the foreign key suffix for relations to lookup tables rather than child tables, like 'orders' to 'order items'.

Where it would be 'OrderItemItemID' and 'OrderID' in the 'orders and OrderItems' tables, I would have 'ItemStatusCode' to relate the 'item' table to the 'ItemStatus' table. Just makes it more readable for me. I know a lot of this is totally obvious to many of you, but I know the audience is a broad one.

Do y'all think that creating a single provider for all store related entities is the way to go?

Maybe I'm biting off more than I can chew for a first time endeavor.
Let's back up a bit; if one wanted to simply add a field or 2 to a table, what would the steps be to integrate the new generated code back into the tbh framework? I see where the files go, but what are the gotchas?

Thanks;
Crab

 
Old April 14th, 2008, 03:06 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 143
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

AFAIK, the prefixes are stuff like 'tbl_' for tables, 'vw_' for views and 'sp_' for procedures (the last one in itself is a bad practise. If you absolutely must prefix, use usp for procedures), and stuff like fltAccountBalance, bitReceiveNewsLetter etc. I have only superficially played around with the flixon generator, but I'd think that "tbh" should be fine. If not, you can always alter the templates it uses.

The dicsuccion between ID and CODE is a different subject. My guess is Flixon uses the "ID" suffix to determine where a relationship exists, purely to be able to create the proper lookups in the generated code. You most likely can also change this to use "Code" rather than ID, but I'd strongly advise you not to. ID is short for Identifier. Code, on the other hand, could mean a lot of things. An ID used in a database schema, by definition, is a meaningless code, whose only "function" it is to uniquely identify an entity. A "code", could have meaning in it. I know, semantics, but still ;)

If I remember correctly, if you want to add a few columns with Flixon, and you know for a fact that the rest of the generated code is equal to the code you currently have, I'd say the best option you have it just to completely replace the existing files. However, if you're like me, and you built custom hacks everywhere into your code, you're most likely better off creating fake copies of your tables and generating the code based on those. You then have to merge the generated code with the existing code.

I wish I could help out more, but my knowledge of Flixon is rather limited atm. Hope this helped a bit anyway. If you want, I can have another go at the flixon stuff, and see if I was talking crap in this post.

Cheers.

Peter

http://entropia-online.blogspot.com/
 
Old April 14th, 2008, 10:19 AM
Registered User
 
Join Date: Feb 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to crab
Default



Is Jimi still on vacation? I noticed he was taking some sick amount of time off. Is he the main guy to talk to about Flixon?

As for the ID - Code debate, I agree with you on the 'autogeneratedness' of 'ID' fields, that's exactly why I like to use 'Code' fields for values from a limited scope 'lookup' type of table. It's a discussion I often have with peers.

Basically, using 'Code' for lookup values allow the storage of simple values right in the table, saving a join for the often dozens of queries a system would need.


Crab

 
Old April 21st, 2008, 07:13 AM
Registered User
 
Join Date: Apr 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi. The first two points in the read me are just suggestions. If you have prefixes on your table or column names then the entities and properties will have a prefix infront of them aswell. You could modify the templates to fix this for you or you could do a find and replace afterwards.

The final note about primary/foreign keys ending with ID is abit more important because an additional property is added in the bll entity class when a property (column in the database) is a foreign key. If you open the /Table/BLL_Class template in the template builder and look for this line:

<% if (table.Columns[i].IsForeignKey) { %>
  ...
<% } %>

This is where the extra property is generated. In the ... part you should find a few instances of:

<%= table.Columns[i].ColumnNameLower.Substring(0, table.Columns[i].ColumnNameLower.Length - 2) %>

The -2 at the end simply knocks of the ID at the end of your column name to use as the name for the property. If you consistently use Code for your primary/foreign keys suffixes then you could change this to -4. If you are using both suffixes then you might want to wrap an if statement around to check if the column ends with Code.

Hope this helps.

 
Old April 21st, 2008, 10:15 AM
Registered User
 
Join Date: Feb 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to crab
Default

Excellent explanation of the foreign key handling, thanks. I have not looked at the template code.

Have you tried making any changes to the existing modules, i.e. adding a field to the newsletters table and regenerating the code using Flixon? I'll admit I have not looked at all the code as thoroughly as I should yet, but if you have any gotchas I could look out for that would be great.

Thanks








Similar Threads
Thread Thread Starter Forum Replies Last Post
Store procedure help... RinoDM SQL Server 2000 7 August 11th, 2008 07:09 PM
Store procedure help ??? RinoDM SQL Server 2000 8 May 1st, 2008 03:03 PM
Flixon Site Generator jimibt BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 February 14th, 2008 11:33 AM
flixon generator against sql server 2000 forumuser BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 11 February 4th, 2008 01:07 PM
Store Procedures joeshea Classic ASP Databases 1 July 20th, 2006 01:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.