Danh mục

Beginning SQL Server Modeling- P5

Số trang: 20      Loại file: pdf      Dung lượng: 1.08 MB      Lượt xem: 10      Lượt tải: 0    
Hoai.2512

Hỗ trợ phí lưu trữ khi tải xuống: 20,000 VND Tải xuống file đầy đủ (20 trang) 0
Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Tham khảo tài liệu beginning sql server modeling- p5, công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
Beginning SQL Server Modeling- P5CHAPTER 4Introduction to Quadrant In Chapter 3, you saw how to create a domain-specific language (DSL) for a very simple domain using Intellipad, the M-aware text editor. In this chapter, you’ll look at Quadrant, a modeling tool that addresses a wide range of tasks, including creating, maintaining, and editing models and data in the Repository or in other SQL database tables, as well as writing and editing M code. Quadrant is a powerful tool in terms of its functionality, and it has an extensive feature set. I could begin with a walkthrough each of the features in its menu tree, but that may not be the most interesting or productive way of getting the first-time user up to speed. A tool with an extensive feature set can be a bit overwhelming for the new user, so this chapter will approach its subject at a somewhat higher level. The intenthere is to give you an overview of Quadrant without immersing you in too many of the details. Appendix D shows the Quadrant menu tree, so feel free to refer to that any time you would like tosee where a particular feature fits.My Car: Creating a Simple Model in QuadrantYou’ll start putting Quadrant through its paces by creating a simple systems model of a car. As you know,you can analyze many complex systems (like planes, trains, and automobiles) as a composition ofdifferent levels of subsystems and components. In addition, the subsystems themselves can be furtheranalyzed into lower level subsystems. This is a partitioning design pattern usually referred to as thecomposite pattern. To open Quadrant, click on the Windows Start button, then All Programs, then Microsoft SQL ServerModeling CTP  Quadrant, as shown in Figure 4-1.Figure 4-1. Opening Quadrant from the Windows Start button  All Programs menu 81 Download from Wow! eBook CHAPTER 4  INTRODUCTION TO QUADRANT Building the Car Model in Quadrant The initial Quadrant window, after opening, appears as shown in Figure 4-2, with much of the same look and feel as Intellipad. The lower-right corner of the status bar shows the current database name and zoom level. Figure 4-2. The empty Quadrant window after opening To build the code for the car model, you’ll start by opening a text pane for writing the M code for the model. Click File  New, and then select M File, as shown in Figure 4-3. Figure 4-3. Opening a new M file Figure 4-4 shows the M code (in its entirety) for the composition-based car model. Note that the double slashes (//) at the start of any line denotes a comment; comments are ignored by the M compiler, as they are with other programming languages. Block (multi-line) comments can also be embedded in the code by starting the first line of the comment with a slash and asterisk (/*) and ending the last line of the comment with the opposite (*/), as shown on lines 16 and 17 in Figure 4-4.82 Download from Wow! eBook CHAPTER 4  INTRODUCTION TO QUADRANTFigure 4-4. M code for a simple car model Let’s walk through the code line by line: Line 1: module Car.Model—All M code must be contained within a named module, which is the top-level namespace in the M language. It helps to give a meaningful name to the module that more or less conveys its intent. Line 3: export CarComponent, CarComponents—This makes the CarComponent and CarComponents entities visible and available to other modules. These are the only two declarations in this particular module: the type CarComponent and the extent (or table, in SQL-speak) CarComponents, which is a collection of the CarComponent entities. You could also import declarations from other modules, but this isn’t necessary in this particular example, since the module stands by itself. Line 6: type CarComponent—Here you are declaring that the type definition for CarComponent follows inside the braces. A CarComponent type is defined with the following named structure: • Id: An Integer64 (64-bit integer) that is set by the AutoNumber() function. AutoNumber() is normally used for defini ...

Tài liệu được xem nhiều: