Presentation is loading. Please wait.

Presentation is loading. Please wait.

Generating the.Net Business and Data Layers Andrew Novick Visual Basic Pro User Group October 2, 2003.

Similar presentations


Presentation on theme: "Generating the.Net Business and Data Layers Andrew Novick Visual Basic Pro User Group October 2, 2003."— Presentation transcript:

1 Generating the.Net Business and Data Layers Andrew Novick Visual Basic Pro User Group October 2, 2003

2 October 2, 2003 Page 2© Copyright 2003 Andrew Novick All rights reserved Agenda  The n-Tier Model  DeKlarit Paradigm Building the Model Generating the Code Using The Code  Demo of DeKlarit

3 October 2, 2003 Page 3© Copyright 2003 Andrew Novick All rights reserved Novick Software  Consulting Company of Andrew Novick Project Management Business Applications Design Programming Coaching Training  Technologies: SQL Server, VB, VB.Net, ASP, ASP.Net, and XML 

4 October 2, 2003 Page 4© Copyright 2003 Andrew Novick All rights reserved The n-Tier Model * * One possible configuration

5 October 2, 2003 Page 5© Copyright 2003 Andrew Novick All rights reserved DeKlarit  Modeling and code generation tool for the business and data layer of an n-Tier application.  Current Version 2.2  Price: $899  Languages: C# & VB.Net  Databases: SQL Server & Oracle  Business Frameworks  Add-ins Create Windows and Web Forms

6 October 2, 2003 Page 6© Copyright 2003 Andrew Novick All rights reserved Alternatives  Commercial Products  Freeware  Shareware  Write Your Own

7 October 2, 2003 Page 7© Copyright 2003 Andrew Novick All rights reserved Commercial Products  DeKlarit ($899)  Lockwood Tech’s ProcBlaster ($399)  IronSpeed Designer ($495…$3,500)  VBeXpress.Net ($450)  RapTeir (Free…$299)  AlachiSoft TierDeveloper ($495-$995)  LLBLGenPro (Free…$195)  ORM.Net ($495)

8 October 2, 2003 Page 8© Copyright 2003 Andrew Novick All rights reserved Free/OpenSource  LLBGEN (there is a paid pro version)  Olymeyrs  OJB.Net (Pre-Alpha Port of a Java tool)

9 October 2, 2003 Page 9© Copyright 2003 Andrew Novick All rights reserved Write Your Own  Writing Code To Write Your Data Services Layer Presented to VB Pro, December 2001 Based on VBPJ Article: Automate Writing Stored Procedures June 2001 Available at  Implementing CRUD Operations Using Stored Procedures: Part 1 on 10/7/03www.DatabaseJournal.com

10 October 2, 2003 Page 10© Copyright 2003 Andrew Novick All rights reserved DeKlarit Paradigm Modeling Code Generation Application Coding

11 October 2, 2003 Page 11© Copyright 2003 Andrew Novick All rights reserved Concepts  Business Framework Business Components  Attributes  Domains  Rules  Formulas  Code Generation

12 October 2, 2003 Page 12© Copyright 2003 Andrew Novick All rights reserved The Business Framework  An information model of a business that represents it’s behavior and structure.  A Model Consisting of A database schema DataAdapters to encapsulate business logic DataSets that will be used by UI layer programmers.

13 October 2, 2003 Page 13© Copyright 2003 Andrew Novick All rights reserved Business Component  Similar to an Object, Entity, or Structure  May have repeating groups (de-normalized)  Contains multiple attributes

14 October 2, 2003 Page 14© Copyright 2003 Andrew Novick All rights reserved Attributes  Main elements of the Business Component Structure  Primary Element identifies the Business Component  Secondary Elements have data for the Business Component

15 October 2, 2003 Page 15© Copyright 2003 Andrew Novick All rights reserved Primary Elements- Primary keys  Identify the Business Component instance  Must be unique  May not change  Must have a value from when the instance is created

16 October 2, 2003 Page 16© Copyright 2003 Andrew Novick All rights reserved Universal Relation Assumption (URA)  One thing (attribute) has the same name everywhere.  When an attribute appears in two Business Components they are assumed to be related.

17 October 2, 2003 Page 17© Copyright 2003 Andrew Novick All rights reserved URA – This won’t work Name used in both tables. Self-reference in UnitsDefinition ( UnitsCD, DerivedFromUnitCD ).

18 October 2, 2003 Page 18© Copyright 2003 Andrew Novick All rights reserved URA - Subtypes  URA doesn’t always work Multiple relationships to the same component Self-references  Subtypes allow you to circumvent this restriction.

19 October 2, 2003 Page 19© Copyright 2003 Andrew Novick All rights reserved Domains  Abstract data types that allow attributes to have consistent data types.  UI makes them hard to find.

20 October 2, 2003 Page 20© Copyright 2003 Andrew Novick All rights reserved Data Types Supported  Characters Char(length). Fixed length character string. VarChar(length). Variable length character string. Length is the maximum length. Text.  Numeric(length [, decimals])  DateTime  Date  Blob  Boolean  GUID

21 October 2, 2003 Page 21© Copyright 2003 Andrew Novick All rights reserved Subtypes – Multiple Relationships The Problem

22 October 2, 2003 Page 22© Copyright 2003 Andrew Novick All rights reserved Subtypes – Multiple Relationships The Solution

23 October 2, 2003 Page 23© Copyright 2003 Andrew Novick All rights reserved Hierarchical Business Component * Source DeKlarit 2.2 Help

24 October 2, 2003 Page 24© Copyright 2003 Andrew Novick All rights reserved DataProviders  Extract data from the Business Framework  Read-only  Attributes come from existing Business Components  Essentially a Query or View

25 October 2, 2003 Page 25© Copyright 2003 Andrew Novick All rights reserved DataProvider – Example

26 October 2, 2003 Page 26© Copyright 2003 Andrew Novick All rights reserved DataProvider Features  Parameters  Conditions  Ordering  Distinct

27 October 2, 2003 Page 27© Copyright 2003 Andrew Novick All rights reserved Business Rules  Rules are declarative.  Written in DeKlarit’s own syntax: [IF ];

28 October 2, 2003 Page 28© Copyright 2003 Andrew Novick All rights reserved Available Rules  Error  Assign  Default  Static Method Call  Add and Subtract  Serial

29 October 2, 2003 Page 29© Copyright 2003 Andrew Novick All rights reserved Error Rule error( ExceptionName [, ] ) if ;

30 October 2, 2003 Page 30© Copyright 2003 Andrew Novick All rights reserved Error Rule Example error( NoCashException, "Not enough available cash to buy the stock") if AccountAvailableCash < 0 and TradeBuySell = -1; UI Would have this code: try accountDataAdapter1.Update(accountDataSet1) catch (NoCashException e) Label1.Text = e.Message end try

31 October 2, 2003 Page 31© Copyright 2003 Andrew Novick All rights reserved Assign Rule = [ if ];

32 October 2, 2003 Page 32© Copyright 2003 Andrew Novick All rights reserved Assign Rule Example TradeCommission = 9.99 if insert and TradeAmount < 10000; TradeCommission = 7.99 if and TradeAmount < ; TradeCommission = 5.99 if insert and TradeAmount >= ;

33 October 2, 2003 Page 33© Copyright 2003 Andrew Novick All rights reserved Issues with Assign Rules  They overlap with formulas and could be replaced by formulas.  Not recalculated as formulas are

34 October 2, 2003 Page 34© Copyright 2003 Andrew Novick All rights reserved Default Rule Default(, ); Default(TradeCommission, 9.99);

35 October 2, 2003 Page 35© Copyright 2003 Andrew Novick All rights reserved Default = Assignment Attribute> = if insert and.IsNull();

36 October 2, 2003 Page 36© Copyright 2003 Andrew Novick All rights reserved Static Method Call Rule if ; MyNamespace.MyClass.MyStaticMethod(…) if insert;

37 October 2, 2003 Page 37© Copyright 2003 Andrew Novick All rights reserved Add and Subtract Rule  add(, );  subtract(, );  Equivalent to assignment statements

38 October 2, 2003 Page 38© Copyright 2003 Andrew Novick All rights reserved Serial Rule  Numbers an attribute serial(,, ); serial(InvoiceLineNumber, InvoiceLastLineNumber, 1);

39 October 2, 2003 Page 39© Copyright 2003 Andrew Novick All rights reserved Formulas  Equation for calculating an attribute  Types Horizontal Vertical  Built-in Methods

40 October 2, 2003 Page 40© Copyright 2003 Andrew Novick All rights reserved Horizontal Formulas Formula = f( Att1, …, Attn);  The function may reference attributes in the table and static methods, including CLR methods such as System.Datetime.Now()  Usuall arithmentic operators  Conditionals

41 October 2, 2003 Page 41© Copyright 2003 Andrew Novick All rights reserved Horizontal Formula Example TradeCurrentValue = TradeQty * StockLastPrice * TradeBuySell * -1;

42 October 2, 2003 Page 42© Copyright 2003 Andrew Novick All rights reserved Conditionals in Horizontal Formulas TradeNetAmount = TradeAmount – TradeCommission if TradeBuySell = 1; (TradeAmount + TradeCommission) * -1 Otherwise;

43 October 2, 2003 Page 43© Copyright 2003 Andrew Novick All rights reserved Vertical Formulas  Aggregates a value from another level ::= [Where ]; AccountStockValue = SUM(TradeCurrentValue);

44 October 2, 2003 Page 44© Copyright 2003 Andrew Novick All rights reserved Vertical Functions  SUM( )  COUNT( )  MAX( [, ])  MIN( [, ])  FIND( )

45 October 2, 2003 Page 45© Copyright 2003 Andrew Novick All rights reserved Max and Min StockHighestTradedPriceAccount = MAX(TradePrice);  Optional parameter for retrieving an attributed associated with the Min or Max StockHighestTradedPriceAccountID = MAX(TradePrice, AccountId);

46 October 2, 2003 Page 46© Copyright 2003 Andrew Novick All rights reserved DeKlarit Project  Business Components  Data Providers  Tables  Domains

47 October 2, 2003 Page 47© Copyright 2003 Andrew Novick All rights reserved Database Changes  DeKlarit does more than other object generators: In includes a database conversion tool

48 October 2, 2003 Page 48© Copyright 2003 Andrew Novick All rights reserved Code Generation  When built, generates a Business Framework project  DataSet for each component  DataAdapter for each component

49 October 2, 2003 Page 49© Copyright 2003 Andrew Novick All rights reserved The FreeDB Schema

50 October 2, 2003 Page 50© Copyright 2003 Andrew Novick All rights reserved Add-In: WinForms Application  Press a button and Deklarit generates a simple data entry application for the Windows environment.

51 October 2, 2003 Page 51© Copyright 2003 Andrew Novick All rights reserved Add-In: Web Forms Application  Press a button and DeKlarit generates a simple data entry application for ASP.Net

52 October 2, 2003 Page 52© Copyright 2003 Andrew Novick All rights reserved Using the Business Framework in ASP.Net  The framework can be used in any.Net environment including ASP.Net

53 October 2, 2003 Page 53© Copyright 2003 Andrew Novick All rights reserved Software Supported  Databases SQL Server Oracle  Visual Studio

54 October 2, 2003 Page 54© Copyright 2003 Andrew Novick All rights reserved Issues with DeKlarit  Nonstandard modeling approach Business Rules Universal Relation Assumption  Not really n-Tier Produces a combined Business/Data Tier  No really Object Oriented Produces a data centric application  Limited support ( or newsgroup)

55 October 2, 2003 Page 55© Copyright 2003 Andrew Novick All rights reserved Minor Issues with DeKlarit  C# orientation (examples, help, etc)  Mangled names in generated code  Rough edges running Reverse engineering Wizard and a few other UI features.  Poor English in the help and in the error messages.

56 October 2, 2003 Page 56© Copyright 2003 Andrew Novick All rights reserved Great things about DeKlarit  Limited knowledge required to start  Help is integrated with Visual Studio  Code generated for you.  Database change scripts written and executed for you!

57 October 2, 2003 Page 57© Copyright 2003 Andrew Novick All rights reserved Technical Support  (Responded within 30 minutes)  Newsgroups and limited documents on their web site.  No phone support.

58 October 2, 2003 Page 58© Copyright 2003 Andrew Novick All rights reserved DeKlarit Be the first!

59 October 2, 2003 Page 59© Copyright 2003 Andrew Novick All rights reserved  Apress Curlingstone an Imprint of Wrox  Download code from the book at  Andrew Novick Consulting - Project Management – Design - Programming - Training SQL Server 2000 XML Distilled

60 October 2, 2003 Page 60© Copyright 2003 Andrew Novick All rights reserved T-SQL UDF of the Week  Free newsletter about SQL Server User-Defined Functions  A CREATE FUNCTION script in every issue  Additional information on UDFs  Find it at

61 October 2, 2003 Page 61© Copyright 2003 Andrew Novick All rights reserved T-SQL User-Defined Functions The Book Coming November 2003

62 October 2, 2003 Page 62© Copyright 2003 Andrew Novick All rights reserved Novick Software  Consulting Company of Andrew Novick Project Management Business Applications Design Programming Coaching Training  Technologies: SQL Server, VB, VB.Net, ASP, ASP.Net, and XML  Home of the T-SQL User-Defined Function of the Week

63 October 2, 2003 Page 63© Copyright 2003 Andrew Novick All rights reserved Thanks for coming! VB Pro Users Group


Download ppt "Generating the.Net Business and Data Layers Andrew Novick Visual Basic Pro User Group October 2, 2003."

Similar presentations


Ads by Google