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 www.NovickSoftware.com 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 www.NovickSoftware.com 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  http://www.NovickSoftware.com http://www.NovickSoftware.com

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

5 October 2, 2003 Page 5© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 www.NovickSoftware.com Alternatives  Commercial Products  Freeware  Shareware  Write Your Own

7 October 2, 2003 Page 7© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com 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 http://www.NovickSoftware.com/Presentations http://www.NovickSoftware.com/Presentations  Implementing CRUD Operations Using Stored Procedures: Part 1 on www.DatabaseJournal.com 10/7/03www.DatabaseJournal.com

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

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

12 October 2, 2003 Page 12© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com Subtypes – Multiple Relationships The Problem

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

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

24 October 2, 2003 Page 24© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 www.NovickSoftware.com DataProvider – Example

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

27 October 2, 2003 Page 27© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com Error Rule error( ExceptionName [, ] ) if ;

30 October 2, 2003 Page 30© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 www.NovickSoftware.com Assign Rule = [ if ];

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

33 October 2, 2003 Page 33© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 www.NovickSoftware.com Default Rule Default(, ); Default(TradeCommission, 9.99);

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

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

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

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

39 October 2, 2003 Page 39© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com Horizontal Formula Example TradeCurrentValue = TradeQty * StockLastPrice * TradeBuySell * -1;

42 October 2, 2003 Page 42© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com Vertical Functions  SUM( )  COUNT( )  MAX( [, ])  MIN( [, ])  FIND( )

45 October 2, 2003 Page 45© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 www.NovickSoftware.com DeKlarit Project  Business Components  Data Providers  Tables  Domains

47 October 2, 2003 Page 47© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com The FreeDB Schema

50 October 2, 2003 Page 50© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com Software Supported  Databases SQL Server Oracle  Visual Studio 2002 2003

54 October 2, 2003 Page 54© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 (e-mail or newsgroup)

55 October 2, 2003 Page 55© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 www.NovickSoftware.com 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 www.NovickSoftware.com Technical Support  E-Mail (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 www.NovickSoftware.com DeKlarit Be the first!

59 October 2, 2003 Page 59© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com  Apress Curlingstone an Imprint of Wrox  Download code from the book at www.Curlingstone.com  Andrew Novick anovick@NovickSofware.com 978-440-8126 www.NovickSoftware.com Consulting - Project Management – Design - Programming - Training SQL Server 2000 XML Distilled

60 October 2, 2003 Page 60© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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 http://www.NovickSoftware.com/UDFofWeek/UDFofWeek.htm http://www.NovickSoftware.com/UDFofWeek/UDFofWeek.htm

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

62 October 2, 2003 Page 62© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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  http://www.NovickSoftware.com Home of the T-SQL User-Defined Function of the Week http://www.NovickSoftware.com

63 October 2, 2003 Page 63© Copyright 2003 Andrew Novick All rights reserved www.NovickSoftware.com 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