20
Copyright © 2006-2011. Iron Speed Inc. All rights reserved. www.ironspeed.com Best Practices for Database Schema Design Moderator: Jill Giampedraglia Presenter: Kirill Dmitriev We will start momentarily… Audio: Dial-in or use Voice over IP

Building a CRM Application

Embed Size (px)

DESCRIPTION

Learn How Schema Design Affects Application Generation by Iron Speed Designer and What is CRM Application?Building CRM Application

Citation preview

Page 1: Building a CRM Application

Copyright © 2006-2011. Iron Speed Inc. All rights reserved. www.ironspeed.com

Best Practices for Database Schema Design

Moderator: Jill GiampedragliaPresenter: Kirill Dmitriev

We will start momentarily…

Audio: Dial-in or use Voice over IP

Page 2: Building a CRM Application

2

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Etiquette

Ask questions at any time via Question and Answer facility Moderator will queue them up and … … I will read aloud and answer so everyone can hear … in the order received This allows everyone to hear the question and is much faster We expect many questions during this webinar!

Listening via computer (VOIP)? Turn up your computer’s volume! ... or put on a headset if you can’t hear … or dial in via landline telephone if you still can’t hear

Page 3: Building a CRM Application

3

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

What is Covered in this Course

Best Practices for Database Schema Design How Schema Design Affects Application Generation by Iron Speed Designer

How to Modify Schema in Database and in Iron Speed Designer

Page 4: Building a CRM Application

4

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

What does Iron Speed Designer Do?

ASPX pages C# and Visual Basic code-behind files Data access layer Stored procedures

Iron Speed Designer builds Web applications…

… straight from your database.

Page 5: Building a CRM Application

5

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

To get most of Iron Speed Designer prepare your database first!

Iron Speed Designer uses database schema to create pagesPages layout and functionality are driven by schemaApplication performance depends on your schemaProperly designed schema is easy extendableTo create web application with Iron Speed Designer no knowledge of code, ASPX or other .NET concepts required but knowledge of database schemas, foreign keys, and SQL is helpful

Page 6: Building a CRM Application

6

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Prepare Your Database The better your database is structured… … the more Iron Speed Designer can do You’ll get more Web pages You’ll get more sophisticated master-detail Web pages It’s easier to extend your application It’s easier to maintain your data

Page 7: Building a CRM Application

7

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

No repeating information: Use index tablesLess fields in table – more efficient

Normalize Schema

Page 8: Building a CRM Application

8

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Create Child Tables for 1-to-Many Relationships Child tables are used to create

Master-detail (parent-child) pages Child table examples

Orders.CustomerID Customers.CustomerID (one customer may have many orders)

OrderDetails.OrderID Orders.OrderID (one order may have many line items)

DBAs call this ‘normalizing your database’

Page 9: Building a CRM Application

9

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Create Separate Lookup Tables Lookup tables are used to create

Dropdown lists for data entry Display Foreign Key As

Lookup table examples Order.ShipperID Shipper.ShipperID

(choose order shipping method: FedEx, UPS, USPS) Displays “Shipped Via FedEx”

(instead of “Shipped Via 3”)

Page 10: Building a CRM Application

10

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Index! Index all Foreign keys, Primary keys and any fields you

search by or filter byFull text index is not supported.

Page 11: Building a CRM Application

11

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Naming conventionsUse meaningful names: they are used by Iron Speed

Designer to create labelsUse Camel Case! Iron Speed Designer can parse names

based on capitalization: ContactID -> Contact; UserName -> User Name

File name: use Companion field to specify a file name for File upload. See Designer\ConfigurationOptions.xsl

Singular and Plural: helps to create proper names for pages: CategoriesTable instead of CategoryTable

Page 12: Building a CRM Application

12

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Fields Data TypesUsing correct data type helps Designer to generate

proper controls If your string field is supposed to hold not more then 20

symbols limit its length to 20 (nvarchar(20)) If your field can have only two values, use bit typeUse image type for images rather than binaryUse money rather than decimal for currency

Page 13: Building a CRM Application

13

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Create Database Views for Complex Queries Create Database views for

Multi-table joins Complex queries: distinct, not, nested queries

Create via Microsoft Enterprise Manager or similar tool Designer treats database views just like database tables

Database view examples Current quarter sales (query filters based on time) Paid invoices (query filters based on status field)

Iron Speed Designer is not a query construction tool !

Page 14: Building a CRM Application

14

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Make Database Views Updatable if Possible Designer uses updatable database views to create

Add Record page Edit Record page Edit Table pages

Create updatable views in your database Cannot make an updatable view in Designer View must have primary key declared in database Update ‘flows’ through the view to underlying tables

Iron Speed Designer is not a query construction tool !

Page 15: Building a CRM Application

15

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Declare Primary Keys in your Database Primary keys are used to create

Show Record pages Edit Record pages Edit Table pages

Primary key relationship examples Orders.OrderID Shipper.ShipperID

Not permitted to modify your database? Create a Virtual Primary Key in Iron Speed Designer

Page 16: Building a CRM Application

16

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Create Virtual Primary Keys in DesignerUse VPKs if you can’t add a primary key in your databaseUsed mostly with database viewsDesigner uses VPKs to create Show Record, Edit Record & Edit Table pages from database viewsGo to: Application Wizard’s Keys step OR Databases New Virtual Primary Key…

Page 17: Building a CRM Application

17

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Declare Foreign Keys in your Database

Foreign keys are used to create Master-detail (parent-child) pages Every Designer-built page can be a master-detail page! Pages with data from multiple tables (multi-table joins) Display Foreign Key As

Foreign key relationship examples OrderDetails.OrderID Orders.OrderID Orders.ShipperID Shipper.ShipperID

Not permitted to modify your database? Create a Virtual Foreign Key in Iron Speed Designer

Throw me a frickin' bone here!  I'm the boss!  Need the info! – Dr. Evil

Page 18: Building a CRM Application

18

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Create Virtual Foreign Keys in DesignerUse VFKs if you can’t add a foreign key in your databaseUsed to create Master-Detail pages & Display Foreign Key AsGo to: Application Wizard’s Keys step OR Databases New Virtual Foreign Key…

Page 19: Building a CRM Application

19

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Create an Application: Application WizardGo to: Tools Application Wizard… ORFiles New Application…

Page 20: Building a CRM Application

20

Copyright © 2006-2011. Iron Speed® Inc. All rights reserved. www.ironspeed.com

Questions?