(Transfer from http://www.microsoft.com/china/)
St. Franciska
Anders Hejlsberg
February 13, 2002, Tuesday
Host: Ms., gentlemen, please welcome the best engineers: Anders Hejlsberg
(applause)
Anders Hejlsberg: Thank you. Before I started today's topic, I would like to take everyone to review history, from early calculations to what state we have now. I believe that if we look back and look at the computer and distributed application, you will see that there will be changes every ten years. Back in the 1970s, you know, almost all calculations are running on a server, she is placed in the back room, then the front desk has a fool interrupt with the appropriate protocol with it.
In the 1980s, you will find that the focus of the application will begin to transfer to the client, and the file server is just a classification storage of the file. Many calculations are not implemented on the server, but is implemented on the client.
Now in the 1990s, the era of the Internet, the focus of the application is transferred to the server side. The Internet is like an old IBM's 3270 terminal, just you will connect multiple websites instead of a server behind the room. Of course, HTML is a richer agreement.
Now, people have begun to talk about it. Perhaps it is now turning to another era, tending to the client, in this point-to-point calculation era. But in fact, we believe it is now an era of final imbalance. We will calculate the server side and place it on the client. We will still do a lot to be on the server side, first we are now, we will also use technology revolution, such as handwritten identification technology and speech recognition technology, put applications on the client.
In other words, we will have two best computing worlds. This is also a reason, we believe that there will be a richer agreement, a framework, allow us to have both intelligent applications, which is XML and Web services.
One thing about XML web services, of course, is a natural transfer, let us see .NET: Is it information that can be accessed when you are. But no matter who you ask, it is a set of distributed computing, a distributed application, a set of connected applications. And we believe that XML and Web services will become a connection architecture for these distributed applications. Of course, as this has changed, a set of tools will be brought.
Let us see, where are we now. It is some of the historic tools, the application of text mode, to the application of the graphics interface, to some tools to lead the Internet. There are also today we have to talk about a set of tools. NET frameworks with Visual Studio.net.
When we release Visual Studio 6.0, it is already three and a half years ago, we know that we have created a set of excellent tools to create good applications, but we know we can do in development tools. Have better.
For example, we realize that creating a distributed application to connect this is very complicated. If we let's see technologies that create distributed applications and connect-distributed applications, and we have reused technology: DCOM, CORBA, IIOP, RMI. We know that is a set of strings, but it is very difficult to develop maintain. We know that we can do better.
We also know that we have a lot of difficult programming models, which is difficult to integrate with a lot of difficult programming languages. You know, we have Visual Basic and C , ASP, etc. We know our object-oriented system, COM, in many ways are not rich enough to create applications today people want to create. COM cannot support some key object-oriented concepts, such as inheritance and polymorphism, and we know that COM is too complicated. COM is a very low-level binary standard. You have to do a lot of finishing work, such as concern, with increasing REFS, Release, Guids, and more. At the same time, we have seen some Internet jumping development with the W3C Alliance, and we know that there will be a set of new applications will be based on this.
But look at all the facts in front of you, we can't just revolutionize COM, DNA can have revolutionary innovation. We know that we need to create a new platform.
This platform is the .NET framework. She is a built-in support XML web service, unified all of our programming models, and greatly streamlined development, providing a powerful, lasting, secure enforcement environment, supporting multiple programming languages, and ultimately allow us to put the original input energy The code written is integrated.
Now, how to build this framework, and let me look at this framework for you before I know how to introduce.
She began at the bottom of the operating system, on the operating system, we called him "CommON Language Runtime. This is a set of components, can't see in the usual work. She provides all core services such as class library load, editing, accident processing, garbage collection, security, and so on. So it is a black box that allows you to execute code in the .NET world.
In the general runtime, it is a set of libraries, starting at the base class library, which provides a set of most common functions such as file input and output, string processing, such as access TCPIP, etc.
On this, we have ADO.NET, this is the next generation of ADO versions that support XML Web services, our XML stack begins with a low-end XML Parser, through a XML file model compatible with W3C DOM Work, and also support X-path in a group of other XML standards.
There are two frames on the class library. We have the framework of the server and the framework of the client. At the server side, we have an ASP.NET, our application server, Web Forms, which is a programming model in the ASP.NET. She supports Web services and mobile Internet tools and allows you to create a UI for mobile devices.
At the client, we have Windows Forms, you can use it as a innovation that puts the Visual Basic form with MFC. You can use the two characteristics of the most optimized in the Windows Form World.
Again, we can see the common language specification, it is a standard, all languages must support a minimum functional collection so that all languages can be running on .NET universal runtime.
And we provide four languages that support this generic language specification: Visual Basic, C , C # and J #. But the industry's partners are being created, you know, we have more than 20 languages support universal operations Time.
Final, of course, support all feature features Visual Studio.net.
So now I will find out how we create this development tool and what kind of power has produced this frame.
When I talk about it, let's take a look at why we have so many complex programming models, do the reason, in fact, it is a historical process, let us see how we write Windows applications. Let us go back to 10 or even 15 years, write a Windows application, actually only one way. You will start your C. You may: include Windows. H. You will open the book, you will write Win Cross with the Windows Message Processor. Those are very complex and there is no productivity. Then, as time goes, we see some different programming models. For example, Visual Basic has created a rapid development method that uses a form to design the program, in this way, you know, you can drag and drop "Control" from a tool-board version to a form. Then you can write some time processors so that the code is placed in the background.
But C has left another road, using MSC and ATL. Here we use some different examples, such as sub coplassing. Of course, this makes you bigger and better means, but he certainly doesn't have Visual Basic. easy.
Recently, with the development of the Internet, we see a new set of new programming modes, around the HTML page executed on the server, and the ASP programming model.
Then you will imagine, we will continue, and there will be a new programming model to write the web service, write mobile UI with a new programming model, but there is an unfortunate fact. One is the programming model you don't have to choose will determine that you select the programming language.
For example, if you think of MSC, if you are a VB programmaker, and some MSC or ATL you want to use. She is not just a simple possibility. Conversely, the VB form can only be obtained from Visual Basic. If you want to write some code behind the HTML page, you can only use the description language.
When another problem, each different programming model has a different solution for general issues. E.g,
In different programming models, there is different ways for the input and output of the file.
The matter now, the .NET framework is to unify these programming models, providing a consistent API, no matter what you use, no matter what programming model you use.
Now, another goal of the following .NET framework is greatly simplified programming. Here, the .NET framework provides a lot of ways, I can't have a number of ways, but I put some important in this slide.
First, I think the .NET framework is to improve the abstraction layer. If you come to COM today, he is a very low-level binary standard. I don't know if you have made C and COM programming, it is terrible. You know, you have to deal with the H results and GUIDS and increase the REFS and Release, there is a rich opportunity everywhere to have bugs. I am talking about, COM is coming today, not enough. She does not support the core of the object-oriented concept.
The .NET framework is you staying away from these troubles, it is just completely automatically dealing with these things, allowing you to free from debris and concentrate on the rules of operation.
Another problem is how the .NET framework is unified programming system. In the .NET framework, everything can be seen as an object. Even an int can also be seen as an object, or a float. There is no variable; all are objects. So there is no two bits of variables and objects in Visual Basic. There will be a string binding throughout the platform, and all character data is Uni-Code.
Finally, this platform provides an object-oriented programming or software component programming. For example, attributes, methods, events are structures in the .NET framework. So he is not like if you use C to write an Active X control, you have to use some macro to define properties, and events, etc., all support are built into the development language of the .NET framework. The other is: the way these APIs are organized. In the past, people used Win32API, actually a huge flat API. There is no organization at all. Our best way to these 30,000 entrances is to sort by alphabets, but please see in the .NET framework, all everything is logically organized and named. So if you see some things about entering output, you can look at System IO, then you will find the "file" class library, so it can take you to the place you want.
Another way to see if we simplify programming, look at how we used to write code, now how to write code. Here is some of my favorite, some examples, calling the Windows API to generate Windows. You first call Creat.Windows.ex and give it to at least 12 parameters. Then you need to update the window to display the status on the screen.
Compare what you did, put it in the .NET framework. You generate a form. You use capen, then you are displayed.
Now, many of you are doing a VB programmer. "We have been doing this for several years. Is there any new pattern?" I think there are several new places, compare today's VB programming methods. First of all, today's VB, in order to make you easily get the APIS. Some people have to make the API to COM APIS. This is why VB has some lag. Typically, when a new API comes out, they first generated by C, and then the VB staff will pack it into an easy-to-use API.
The second question, of course, once these APIs are packaged, you can't really say the same language as others, because others can't use some documents on a low-level API, some things are not able to pack, so you must not Don't throw it out, or those you like.
But I think maybe the most important thing we - Microsoft will edit these API. He will not be some low-level official articles. We will move the abstraction layer to make the new API easy to use, and programmers only need to pay attention to what they have to do, that is, do not need to fully understand that all APIs can write the easiest application.
I think another important thing is that the .NET framework provides a powerful persistent performance environment. In the .NET framework, all objects are automatically executed with garbage collection and memory management.
Now, in fact, in COM and .NET framework, memory management is completely different. There is also automatic memory management in COM. But it is handled with a method called Reference Counting, and uses this method to count the number of Reference of each object. If you have not encountered a problem, he works very well so far. This is a problem with cyclic Reference. If you have two objects, you have a Reference point to the other party, and these objects are always live for memory management, but there is no other referen they and you have generated some memory island, never be collected.
The .NET framework uses a different technique to achieve memory management, called marker (Mark) and sweep (SWEEP), I don't plan to work too much about how he works, but the most fundamentally solved the question of Reference Counting.
Another key to providing a powerful execution environment is accidental. You are already familiar with "On Error Go To" in VB, which is indeed provided some small amount of structured error handling. But some error handling will be more complex. When an error occurs in the .NET framework, each unexpected processing will have an error description information. You can get an error message stack, and you can accurately know what is wrong, and where is wrong. Perhaps the most important error handling in the .NET framework is mandatory. If you look at it, the traditional Windows API works, how all languages work, such as C, C , etc., error handling is always a casual thing. An API may return an error code or a result code to explain that this API is still working, but unless you write some code to detect the results of these faults, you know, otherwise anything will happen. In fact, your application will be chaotic, then three or four API calls will start because an empty pointer or you have no idea how to end.
Not just unexpected processing. If an accident occurs, if your app does not process this accident, then your application will turn off. They will be cleared, and remind you that you have a rich time to unlock the existing conditions, but we will never fall into chaos, which will reduce many BUGS.
Type security is another reason that brings power. There will be no unsafe type table in the .NET framework. You don't have a type of pointer to another type, and the execution engine will simply reject her. It is impossible to initialize the variable. You can't index, beyond the number of years, etc.
A key function is our zero shock installation function. At this time, it is actually one of the features I like. In the .NET framework, there is absolutely no need to register for operation. You can generate a subdirectory and drag the app to where, run him, you can delete the directory when you run, no matter what you are running, you will leave traces.
(Cheer, applaud)
This is not to say that your application cannot share information. We also support another model, when we installed a global assembly cache, as we say, then apply the class library.
Another key, I think, in the .NET framework is Side-by Side execution, which allows you to run different version code on your machine on your machine. You can have an app version 1.0, the app version 2.0
And you can run them in parallel. You can even run objects from these applications in the same process.
This means that you no longer have any DLL HELL questions, when you install a new version of the DLL, your application will terminate during it because it is.
Instead, it is, in the .NET framework, your app will continue to run according to the version. So, just like what I said, you can have some database supported library version 1.0, 1.1 and 2.0, a variety of applications can continue to use different versions, so by default, you have installed new in the machine. Application, your application will not be interrupted.
So the .NET framework is a multilingual platform. From the initial design of our design, we know that we want to support multiple languages on this platform. For us the most important thing is not to let people learn a language, but let them use the programming language experience they already know, and the code already written.
Another key, the language supported in the .NET framework is first-class. I mentioned some early facts, the API can't be used for today's VB if he did not pack it into a COM object in the first time. This is definitely not a problem in the .NET framework. Any API is published in the .NET framework, can be used immediately by VB or any programming language implemented on this platform.
In fact, our integration capacity is far more than what we are seeing now. For example, you can write a class in a language, inherited from another language, and exemplify from the third language. This integration ability can be so deep. Of course, it also means you can highly integrate these developments. You actually only need an integrated development environment, a debugger to use these multilingual.
Now we offer 5 languages: VB, C , C #, J # with Java Script or J Script. But in the industry, academia, there are many other languages, as well as being developed, including some languages such as: COBO, Fortran and APL .
Now, I have mentioned that the .NET framework allows you to be highly integrated. Because all your languages are created on this public basis, it is called the .NET framework. You can see that the integration capability between the .NET framework is stronger than any of our previously seen.
In fact, there is not much difference in the language that writes a Visual Basic or C # or J Script or any other platform support on this platform.
But in the real world, only the interoperability of the language is not enough. Of course, there are many code not written for .NET framework, we also hope to be fully utilized, so the .NET framework provides interoperability between the DLL, the code in the DLL, through a called P call, come Implement interoperability between DLL and COM or OLE auto objects. In fact, any code you write in the .NET framework can be seen as a COM object outside the framework, and vice versa, any COM object, you can automatically enter the .NET framework, is considered a class. where is it.
Then, we have provided XML and SOAP, we provide the best, most flexible way to integrate in a heterogeneous system.
So there are many interoperability, simple built-in, because we believe in Moore Laws - at least in my thoughts, Moore's law has been far away from us. How will we use Gigaherz's CPU and 512 Megabytes's memory? The memory of 64K or 640K before, you may feel difficult each time, you may spend six months to write a program to use all machine capacity. You have stayed away from that era. But today, you will not be like this, I mean, the customer expects more and more capacity, as if you can't use the capacity, we have to find the way to use the previously written code.
So, I will transfer the topic to talk about some web services. About the Web Service revolution, I think we are in the middle, Visual Studio.Net and .NET framework will play an important role.
Before we made a demo, I would like to explain a few slides to explain the web service I think. In fact, it is simply like it can think it is a peanut shell. If HTML is to communicate with the machine, XML and SOAP is about the communication mechanism of machines and machines. More accurate, it is an identical structure.
Now let me talk about how traditional distributed calculations use DCOM, CORBA, RMI, etc. to connect applications. Then what is the better technology provided by Web Service to write these distributed applications.
I think there are three key factors. First, XML Web Service takes advantage of web. They have the same architecture as creating HTML applications. Everything passed on the network is through the HTTP protocol. All the same. The only change is that the web service replaces the pass HTML, and you pass the XML on the basis of HTTP.
Of course, this gives us a good opportunity to use the previous web application, so that the original web application will only need to simply add a few lines of code, or a page code on the website. The second thing is that Web Service can really integrate with heterogeneous systems. Any type of application structure must support integration of heterogeneous system environments. You don't need to require both ends of the application to run on the same OS. You even use the same middleware that don't need to apply both ends. With web service, one end of your application may be on the .NET framework, the other end of the app may be running on the Apache Server, running Perl Script, but outputs XML data format.
The last thing, I think Web Service allows you to create a real scalable application. Again, let's take a look at the traditional distributed application technology. They have used the so-called technology such as: DCOM, CORBA, and so on, they really make this world look like an object-oriented. She is exactly some objects running on this machine, and some objects run on another machine. However, this architecture only has communication internally, on a machine, or in a local internal network, it can be implemented very well. But when you start to expand your app, such as your client in San Francisco, and your server in New York, you will have a problem. Because in this old technology, it is basically, trying to hide a fact, your application is not enough to distribute, when the distributed distance is distributed to an unlimited network, there is a problem. When you ask a call, you need to wait for a long time, you have to keep the call status, but this trick will hurt the reliability, because you can't fail over. And you can't do some rap, communicate when you are calling When an object, the other party returns to leave. "Oh, thank you" "Hey, you can welcome" and so on. When you are in a machine, everything will be fine, but when you want to talk to the East Coast, you really need to understand the situation of the other party, the speed will have problems.
Now, compare XML Web Service, there is a good evidence that exists, it can be extended to any place you can't reach. Because we have seen a good extension in HTML today. As I said, we changed only the things that were passed, it was HTML, now is XML. But all the architects are the same. We know how to expand, we know that it can expand.
So what is the basis of web service? Of course, it originated from the only communication provided by the Internet, on this communication mechanism, we store commonly used data structures provided by XML, XML can be used to pass any data.
Now, we have a lot of change above XML, we have XSD to describe the type. We have SOPA to describe interaction or web service calls. We have WSDL, Web Service Description Language to describe Web Service. We have discovery protocols.
On this, we have a yellow page of Web Service, and the registered service is called UDDI.
Now, the most critical is that we have a simple open standard and have a wide range of industry support. These are not the standards that Microsoft has settled, these standards are our industry partners and cooperation with standards organizations such as W3C.
So how is a web service work? Let me give examples, assume that I am a web service consumers, I want to use Web Service. First, I will find I want Web service. I have to go to the Web Service world. I can have several ways. I or go to UDDI to find it, or go to a specific business area. These specific areas support specific Schema, and the data is sorted in various ways. But usually, I will get a connection, a web service description language file, tell me about the web service I found. Or I can also find the Web Service I have to find, saying that I already know their URL, And get a Disco document or a discovery document, which is basically a directory, all of the Web Service is on this address.
Another situation is, I finally found a WSDL file or a web service description language, or I found a connection, this connection allows me to find the WSDL file. Through this file, I can know how to communicate with the Web Service, the last step is to use the XML-based SOAP protocol to talk to this service.
Now, the top three steps in the slide are designed when designing, if you like, there is no steps happening at runtime. Only the last step is running. But all three steps fully support Visual Studio. I can find UDDI registration from Visual Studio. I can get discovery files or a WSDL file, and Visual Studio automatically generates the Web Service's proxy service. To make it only need to simply call a method, bring some parameters, and then all the infrastructure is automatically handled.
This is what is Web Service. Now let's take a look, what did .NET brought? If you come to see how you develop applications, some concepts have always been common during your development process. Your application tends to process data. And tend to structured these data. Your app completes some services, for example, the application's feature, there is a policy to call how the application is called.
Now let's take a look at the standards already existing on the Web, or exist, or will appear. The data can be described as XML. Schemas can be described as XSD. Service can be described as WSD, and the call can be implemented using the SOAP protocol.
But when you write the code, you really don't know how XML and XSD, etc. You know more about data, with your object. You can see it as the class of these objects for your schema. For your service, it is your application method, or the function of your application, that is, call is like calling these methods.
However, the value of the .NET framework is to provide you with the two-way mapping of these concepts. These concepts are the concept that you already know as a programmer, with the concept of today's existing on the Internet.
So the .NET framework can be, for example, any object, automatically convert to XML, vice versa, it can turn the XML back into object. In addition, it can generate a class, generate an XSD structure of Schema, which can also convert an XSD's schema to classes.
So basically, .NET framework allows you to use your programming terminology, framework yourself back to process mapping with the Internet structure.
In order to be clearer, this made me give you a demonstration, what is the web service? For example, I write a class handling class, which has a method of submitting an order. And submit orders will bring a number of objects to purchase orders. In order to turn this into a web service, I don't actually need to modify any part of the code. I only need to give this code home, a web method's attribute, it tells the system, please release this method to the internet. Now, I may actually want more code, such as controlling this XML can span the wired network, so I can add some properties to my purchase order, to specify that when this object is converted into XML, put it in XML Namespaces. For every domain of my object, I can specify whether I let him map to the XML property or to the XML element.
But here is that I can write some code like this, I can use another language to write him, for example, here I use C # to write Web Service, I can use VB's code to use VB. Call him. When I made a new purchase order, I will give him something to me, then send the bill to Bill, and do it today, then submit the order.
Take a look, what happens when I do this, the .NET framework will change this call into SOAP format XML, pass the SOAP envelope, and pass it into the web server through the network to the web server. In the web server side, that is, recreate this object, complete the work, send back the result that has been converted to XML, then turn it into an object, then return to my client. All of this is automatic.
In fact, let's take a small demonstration.
Now you can see some of the unbelievable features of this platform. I will do something about .NET in 15 minutes. First, I will create some web services. Then I will test this Web Service with my browser. Then I will add some data access logic to this Web Service. Finally, I want to create a rich client, a customer front desk for Web Service. Finally, I want to implement this rich client application.
let us begin. Just let you look at it, there is absolutely no magic or string here, I will use my favorite editor, Visual Notepad, then try to write a few lines of code as much as possible. Now I launched my writing board, then write a web service program.
Now let's start writing Web services. I like to use C #, then I called this class "My Service"
Now, I wrote a head, tell ASP.NET, this file includes a web service. The remaining file is simple like a usual C # file. Here I can say, use system.web.servcie and then I can write my class: publice.class.my.service. Then I generate a method, this method is to add two integers, then return to me. This is actually all my web services.
Now, what I need to do is, I need to tell the system, please use this method as a web service.
Published, in order to do this, I have said it when I just said, just simply add a web method to this method.
Now we have stored it and called Demo.asmx. Now let us start the browser. However, let me try, click on this web service. So I am going to localhost / demo / demo.asmx and then just need to return, see what happens.
First of all, when I click on the web page, ASP.NET will first look at this first time, I click this web page, it is compiled into IL. What happened now, first, the class I wrote, automatically by ASP .NET compiled. The second thing, ASP.NET notes I am accessible from a browser side, which is accessible from a client client. Then she will automatically generate a test page for this Web Service. Now let's take a look at the test page. There is Add method here, I just need to call this add method directly, click to gently click, then the test page will let me enter two parameters, X and Y. so let me enter 32 and 10, then we call this Method, this is this method. The result of her calculation is 42, and he is then automatically passed as XML later. So the Web Service is like a simple peanut shell.
Let me return to this test page now. You will notice this test page that is automatically popped not only ASP.NET. And he will do some analysis on my web service. Let's see if he abides by all the Internet. Then he found out that I didn't put the web service in an XML namespace, if I was a habit of developers, I should do this. Next, it will suggest that I should fix my code. Then I said, I just need a copy to paste a little correct. So I just grabbed him, then returned to my web service. Then I pasted so that this Web Service was placed in a namespace.
Now, reality is a simple mathematical operation through the Internet. In most cases, people may take some data over the Internet. But when I think people how people come in their application to create data logic, I will find that she seems to be from two different schools. One mode is that you will treat your data as an object. You will have a customer object, a order object, and more. You get an object from the database, then you give your object to generate an instance, then you put the data there, then you are on it.
Another mode, you just simply store this data in his form. You know, today, it is a recordset. It is called a dataset in ADO.NET. But basically, you will think it is a basket of data.
Here I want to demonstrate how we support both models. Let us first look at the way to create data as an object. Then, in fact, in my web service, I will create a database connection, and then I call it Web Service. Then I use it as an object.
Next, first, I will paste something, save me to write all the code, a class called contact, including a name, address, and phone number. Then I generate a web service. It can return a list of contacts, I just paste it.
Now, of course, in the real world, you will not just use these objects. They will generate a database. I just want to show that the web service can return a structured data and can operate him. Here you see me through my calling method, you can return an object of a contact's array.
Let us try, and save it. Then we go back to our test page, we just refreshed the test page. Then you see two things happened. First of all, ASP.NET found that my web service file has been modified, so he recompiled. She has a new test page. In the new test page, the error message originally prompted at the bottom is not, because I fix the lost namespace, I have a connection now, this connection is an additional method I wrote. Get Contacts method. Then I tried to click on this connection, because there is no parameters, it just let me simply click the call button. Here you can see that the result is already a good XML. Please note that I am absolutely nothing, it converts the contact's object into an XML, here he is an array of contacts, in this In the array, each contact has name, address, phone number. All of this is done automatically.
Some people have arrambled with me. They want this contact's database, and each contact should not pass through the XML element, it is best to use the XML attribute to pass.
Now, let's go back, then add some instructions here to control the form of XML. In order to do this, I first use: system.xml.serialization and add some properties on my object's domain, in fact, we convert XML domain into properties, not an element. Do this on the name, then we do other, we only need to copy, then paste, then transfer this object's address domain to the adder property, then convert the phone domain to ID attributes.
Then we have stored. Let's go back to the test page, then we refreshed our Web Service's result, which will call the Web Service. The new format has appeared. At this time, you found that XML's format is miraculously from the use attribute, converted into an element. So you can see this tool gives you superior control capabilities.
Now, another way to deliver data, or how to apply operational data, just generate and return a complete recordset, which basically reflects the result of a SQL query, and we can of course implement in Web Service. In fact, just need to go back, let my home some logic here. First, I will add a few using the clause and then enter the data namespace. Then we caught some ways to come in and paste it here. This is a small method called "get data" that uses a query string. Then she produces a connection. She generates an adapter for this connection. Then she generates a new dataset and then fill him with the result of the execution.
Then we have stored. Then return to our web service. We will refresh this test page again. You find that he has compiled again. We see the "Get Data" method, then we call him. Then, of course, it requires us to fill in the query string. Then we knock into the string. We write: SAY SELECT * from Customers, then we will act.
Now, we see a query result of an XML format returned by SQL query. In fact, if you look down here, you will see the items for each table, such as the customer ID and the name, etc. However, there is a description at the beginning of this XML, describing the format of these data. So this data includes not only the actual record, but he also includes a description that describes the meaning of these records. To allow client applications how to display these data.
Then let's try to create a client application to call this web service. So we close all the windows, then we start Visual Studio. Let us generate a project. We will generate a Visual Basic's Windows Form Application. Then we call him client. Then our Windows form designer appears here, then we tried to do a client application to call our web service. And display the data in the grid. So we grab the data grid and put it on our form. We are catching a button. Put it on the small surface of our form, try to make more. All right. Now, in order to call this web service, first we add a reference. I mentioned before I mentioned. Visual Studio automates these steps, such as entering the web service's description file and provides a proxy for Web Service. So we only need to simply click right click and say "Add Web Reference" in this, we just click on our web service. Localhost / demo / demo.asmx here, let's take a look. The service is done. We just add a reference and enter them.
Now we can write some of the codes of the background. Here we write: "Dim S as new local host." Because I didn't change the namespace, the namespace I referenced, still the namespace of this machine. Now you can see the statements that are completed on the web service. You can see the My Service object, stored on the namespace of this unit. This is the service I just wrote. So I just define him as an object.
Now I can quote my web service. Then I do is "Data Grid One.Data Source". So get my data grid from the Web Service through my Get Data method. Now you can see my task is done. She knows where to take a contact, where a get Data is. In fact, she knows that when I click on the data, it will let me enter a query string, so I entered the Select * from customer, and then I will take the first table, from the first table from the data set. Not like a recordset, he proposed a plurality of tables. We just choose the first return.
So two lines of code call this Web Service. Let's try it, run this application. When you click this button. This result is returned as an XML format and puts the data in the data grid.
Now, of course, your job is not only a rich customer application, but you have to implement this rich customer application. We can make you easily implement these applications on the .NET framework. In fact, you can develop your rich client applications through a connection on a web page, I will demonstrate how to do this.
First, I am in my project. Go to my properties. Then I change my build output path and is the root path of the website. So when I created, Visual Studio dragged an EXE into the root path of the web server I created.
So we create, then we will return to Visual Notepad, we will write some HTML pages, connect to rich client applications. So we start HTML pages. We call it H1. It is easy for us to call him. Then we say "click" and then we generate a h reference to client.exe, he sit in the root of the web server, so click here, run this smart client application. We turn it off, then we exit it, we call him HTML.
Let us start the browser now, then click on this page, we go to localhost / demo / start.html.
Here, you see a web page, I have written, connect to my client application. So when I click here, all of this happens at the same machine. But when I click here, I am actually applied to my local machine. Download the cache in the Internet to run him. At this time, the application is running, I can click this button. Then he can talk to the Web Service.
Now you will ask: "Well, what is the security?" In fact, the application is running in a sandbox, he protects your web service instead of other web from the same URL. He is not able to generate files on disk, and so on, where is there a complete border. To display this feature, I close it, then go back to Visual Studio and then try to add more buttons in my application. Then I will write an event processor to try to do something bad. We don't plan to do it too bad, so we just generate a file under the root of this server. So we just have to say system.io.file.create and then we try to generate a log.txt in the root directory.
We build, then generate a new EXE under the root of our web service. Let's come back, start our web page. We connect again, he downloads a new executable. You can see that we have a new copy because we have two buttons. I still call this Web Service. But when I tried to generate a file in the root directory, I got a warning for security. You see, he said that the app is trying to do. . . . Wait, this is not allowed by the security policy.
Now, interesting things are, I can continue to run because it is processed by accident. Just every time when the app is trying to do something bad, he will stop.
So in the following 15 minutes, let's take a quick review, .net provides the functionality of the server, client, and so on.
In fact, the core principle of .NET is the client, server, and server-side policies. Just as the .NET framework provides the core structure for development applications, the purpose is this direction, and Visual Studio.Net is the same, providing complete development experience.
On the client, for example, Visual Studio.net allows you to generate a variety of different client applications, such as Windows, forms, just like you just see, web forms, or mobile Internet tools to generate front-end mobile devices Applications.
At the server side, we offer a fast application development for server-side. As you have used by the client application development: grab the control from the tool version, drag and drop them on the form, now the server can do such a thing, such as grabbing a time log, or Message queue, put in a business logic designer, then create your business logic with visualization.
We have a considerable amount of data access capabilities in Visual Studio. We integrate data designers, query creators, and so on to improve support to .NET Enterprise Server.
And, of course, you have also seen Visual Studio.net support Web Service, from the entire life cycle of Web Service, from discovery, call, build, registration, and implementation.
Now, I have to look at Visual Studio.net, I will introduce Rob Copelan to the product manager of Visual Basic.net.
Rob Copeland: Good morning. You have seen a lot of good things this morning. You have seen some applications created with Visual Studio.net and .NET Framework. And Anders already takes you roughly browsing the powerful features of the framework and how to use these rich features to create applications. I will take a few minutes today that Visual Studio.net is simple to develop those applications.
I will start the development environment and generate a new project. So I click on the new project. Then she allows me to choose what kind of project I want to generate.
Now, I said, I want to generate a web service, then return some information about the book. So I click on ASP.NET Web Service. Then I think, I will call the book's service, then I click Okay.
Visual Studio will now connect to the web server, generate an app's root directory, put that file there, then I need to generate this web service, I open the design view.
Now this design view is a new feature of Visual Studio.net. She can make me easily call those components I are developing and tears. She is very similar to us usually using a form, dragging a component, setting his attribute, handling his event, does not need to write all of the pipeline code. I can concentrate on my business logic, I want the code automatically implemented by the Web Service.
Now, Anders gives you how to generate data from the Web Service with XML format, return data. I will demonstrate a similar process, I will use some rich tools in the Visual Studio development environment.
I will introduce a new feature of Visual Studio.net called service browser. This service browser is a good way to get resources from the server side, then programmed on this basis. In this example, there are two things. When I have a data connection, I can access SQL Servers. And other types of databases, I now have a list of service, now I have only one, that is my own machine, but I can add other things inside.
What I want to do is, when some people call my web service, I can take data from SQL Server and return the result.
So if I start this node, I will see a database perspective. And connecting and stored procedures. If I expand this table, this has a table of books. This is a table I want to use the web service. I can drag the way and drag to the design interface. Visual Studio.NETE automatically generates components that are the data I needed from SQL Server.
In this example, he generates two components: a connection, he allows me to connect to SQL Server and execute the command there, it is called a data adapter. A data adapter is used to do these things, he takes the data from SQL Server, then put it in the form I want, and then put it in a data excitation. Anders just mentioned this concept.
Now, as I said, this is very like a form in many ways, except that it is really a class I work. But it is similar to the form, that is, I click this component and then come to the Properties window and set the properties. So, for example, maybe I don't want my web service called Service 1. He only needs to come to the property window to change his name. I call him book service.
By default, the data adapter I generated will return all data. I really don't want so many records. I want someone to tell me what information about the book.
So I returned to the property window, I can click the configuration data adapter to connect, and then he will take me to a wizard, bring me to do this. She asked me what the adapter I want. There is only one here, so I will choose this default. Now she asks me how I update my data and how to take data from my SQL Server. According to the default mode, I select SQL statement, but I will choose to generate a stored process so that I can rely on SQL Server, and I can get better performance and scalability. And Visual Studio.net automatically generates stored procedures. When I click "Next", we can see the grinder's selection statement, to imagine us let us use it, but he will return all records, but I am really not like this. So, I can quickly click the query generator, open him, ISBN is what I want, the customer will take ISBN to query, then I will return data based on the ISBN. So I went to the standard domain to write "equals @ ISBN" so that it will ask me isbn, or let me ask an ISBN number, then just return a book.
I click Okey. Now I will give me a name to the store process. He will automatically generate these, so I call him to choose a book. If it is inserted, I can also call the insertion of his book. Then I followed.
Visual Studio.net is connected to SQL Server and automatically generates a stored procedure for me.
So now I have a very easy way to connect to my SQL Server and take a book.
Now, another great thing is that when I use the attribute window, the name of the data form taken from SQL Server will be set to the name of each column in the database. And many times my DBA name is not what I want in object mode. So I can no longer manage the mapping attribute issues for each table, and provide a dialog box, let me name these forms in accordance with the function so that I can have more intuitive object patterns.
So here I see all the book names they name is uppercase letters, and my object mode never uses uppercase letters, so I can change them into normal case. Here, find prices they give him a name is Mny in front to show that this is the money, I guess, but for me, I want him to call the price, so I tap the confirmation key.
Now I set all the configurations in the way I want, so I can more easily interact with SQL Server.
I haven't written any code yet. Visual Studio.net handles all of these attribute settings, and help me make sure all of these mappings can be performed.
Now, when I want to do something, I returned to my server side browser, and I just mentioned the RAD rapid development function of the server in his last slide. Here is a function of a Visual Studio.NET tape that allows you to develop server-side programs. The server-side browser is one of the functions, but we also generated a series of formation to make the usual server-side tasks easier.
In the example here, how many people I want to use Performance Counters are visiting my web service, so that I can see if it has the ability I need, see if I need to add a few machines or Change some settings.
So I will expand my server, here I can see a table of events, as well as message queues and performance counters are running on this machine.
If I expand the performance counter, God, this is a huge list. The .NET frame has added a lot of things. If I browse, I will find a lot of performance counters related to SQL Server. But all of this is not what I want.
So Visual Studio.net can easily generate a new performance counter I want. I can click right click and then say "Generate new categories". I will call it books, then generate a specified counter in that category, in this example, I call it a query counter, and how many people query my web service. Then I click confirmation. Visual Studio can generate performance counters on this computer. And you can generate a counter on another machine on this network as long as I have the right to manage the machine.
Now I can see that he has generated this category, this is a query counter. In order to use it in my application, I only need simple drag and drag him to the interface, and then I have a component, I can easily use the properties window, for example, in order to change the read-only attribute True to leave, so that I can write him, in fact, I can do many other things here. But the true benefits here are here you don't have to write code at all, and you can set their default status. You can visualize these, then you can concentrate on the web service you want to write.
Code on the code.
Now, I have set all the components, I will double-click this interface, which will bring me to the back code, this way is like I use the code after using the form. Here you can see what I did basically made with Anders. I will generate a public function. So I said public.function.ge.info.for and I want to return a book, and I want to be sent to me the ISBN number, and they can play a string, and this feature will return some of my forgot What is placed here.
Let me go back to steel, the last thing I want to do. As Anders talking, I also talk about some, the data set is actually the data returned when I execute the query. And the data set is separated from the data and sent back in XML format. In this example, I need a high-speed data adapter to generate the data set I can use for me.
So I just need to click the right click "Generate Data Set", I will tell her that I want to call the book. Now here is a list of tables, I can use it in my data set.
The best place is that in the dataset, it not only includes a table, which includes multiple tables and contains the relationship between these tables. In this example, I have only one table. I will tell him to continue and add a designer so that I can easily use it in Web Service.
Now, we have a data set, called a book information.
I will turn back to my code, now I can do this, and say that I want to return to book information from this data.
So now I have a public function, and all what I need to do is to call the SQL Server adapter, call SQL Server, return data. The first thing I need to do is to tell the SQL data adapter ISBN number. If you remember, I have told you, I want to be a query of a parameter. So I came in, and I told him that I have to choose a command, this has a parameter property, let me say what parameters I want to have. I want to specify ISBN, I want to set it into ISBN that is passed from the customer query. So created the stored procedure to facilitate I can call.
So the next step I should do is, I need to be a SQL data adapter and fill in a way. This will fill in a data set, which is called a book information on my web service.
I want him to launch my performance counter, he is there, all what I need to do is "Performance Counter One.Increment By" and now I have done it. I just want to return to my data set, and that is called a book. Now I have a full-featured Web Service, and I am now using a lot of Visual Studio features and add a lot of value, but only use very little code. If I press FY, Visual Studio can automatically start a browser and bring me to my web service, showing me the same page that I just showed to everyone, which allowed me to test this page.
But he didn't show it, because I forgot to put a web method, it was a property, telling Visual Studio, this is a public function, which is released as a web method to the website.
Now when I press F5, he will click on Web Service, it can get my information. I can continue, he will continue to ask me an ISBN number. Very fortunate, I just put on the paste board, so I don't need to remember him, and enter it. I clicked call, he called Web Service Web Servcie to connect to SQL Server. And, as I saw it for you, I took a similar thing. I got an XML. So I can easily use the server-side resources, SQL Server's resources, performance counters, and a full set of features that are provided with a complete set of served browsers.
Now, I got my Web Service, Anders showed how to use Visual Studio commonly rich client applications. I will use Visual Studio.net to generate a rich web client with this Web Service.
I will skip this section, I add an existing project, I have already made it, he is under http: // localhost / bookapplication. If I open him, I will get a simple page. He is not very nice. I have no chance to use a designer to design, or do any modified things, but he has a text box, let me enter the ISBN number. And it has some labels, showing the author and book name.
Now what I need to do, Anders has already shown us, he tells Visual Studio.Net I want to use a web service. I came to the solution browser, find the web reference node, and then I choose "Add" A web reference "he is already in my drop-down list, so I chose him.
Now, from here, I can also detect my web service, and see how it works, as I work on the browser, but this is what I just say "Add a web reference" Visual Studio will automatically generate me What I need to call the Web Service needs. I am like calling him like an object, so I have a programming mode I am very familiar.
I will double-click on this button on the form, behind this, I want to generate a variable called WS. And it is localhost.bookservice. I need to generate a variable to include the number of returned values, data, so I will say Dim Data As. Now it is localhost, and the book information is my data set.
Now, in order to call Web Service, I only need to simply say data = ws.getinfofor. Now I will remove the data from the text box, the text box on the web, TextBox1.txt, and call the web service. He will use Returns the data and populates the data set. Then put the author label data I got on the label. I will set the data to the text box.
Now, as I said earlier, the data can contain multiple forms, so in this example, I called him Data.books because it is a form. I will say Sub Zero because it only has the first line, and SUB ZERO is the first. Now I can apply the statement to complete, find the field I want to use from SQL Server data, in this example, we used the author last time, so we used the title field, Data.book.subzero.title.
Now in the last thing, I need to tell Visual Studio, I want to run this project, when I press F5. But the advantage of another Visual Studio is that he has rich debugging. So let me look at it, very fast.
Let us make our web servcie and my web application cannot work properly, and I need to find something problem. I can set breakpoints in the code behind my web page. I can return to my web service. Then set a breakpoint in the Web Service. Then I can return to the server browser and return to the stored procedure. This is to generate for me. Open the selected stored procedure where you set a breakpoint.
Now, when I press F5, Visual Studio will automatically start the browser, take me to my web application, or I just generated the web page. Here I can continue, paste my legal ISBN number, type it, and then I click "Take" The code I wrote after I was in the button, but I will execute, but because I set a breakpoint. So this code can be on additional machines. I can still enter the development environment of Visual Studio. I can use all the rich debugging features provided by all Visual Studio.
I can press F8 and then go step by step.
Now the next call is to populate the code in the data adapter, which can also be placed on another machine, but I can go to the Web Service, which gives a call. This is what I click on the breakpoint. I can take a closer look at how ISBN number is incorporated.
I am here.
Now, the next step is to fill my data adapter, call the stored procedure on the SQL Server. So when I came into the coming, I actually entered the SQL Server and entered the stored procedure, once again, I used a rich debugger. I can look at what kind of value, use the rich Visual Studio interface to experience great debugging experience.
I can continue to press F8 and just simply continue. Then I will press F5, he will take me back to the browser. Complete him, remove the data from SQL Server. Fill these fields.
(applause.)
So I have a set of features that make me easily generate applications and debug him.
And another thing I want to demonstrate, is a feature that makes me very excited, he is in Visual Studio's business designer version. He is a Microsoft Application Test Center. I just demonstrated how to generate these applications, and debug him, now I want to demonstrate how he is easy to test the application.
I have a performance counter here. I will continue to use the performance counters I just added. In fact, I need to update him. So I started him again. Remove those default values. The category of the book, as well as the query counter, you will notice that when I put it here, he will show two, because I have called him twice so far, so my performance counter has been working. But what do many people call these applications? I will come, start the interface in my application test. He can help me generate tests, from my web service so that I can see what performance he has.
I can click the right button on the test to generate a test. And I can generate an empty test, or choose to record a test. What I want to do is to record a test he will enter VB Script, which is very suitable for me, then I start to record.
The application test center launches the browser. He began to record what I did. So I entered it. Select my web application, I just run, paste an ISBN number, choose to take it. He will go out to click on Web Service and retrieve the data, put it on the page.
If I returned to my performance counter. We saw him bounted 3 because my Web Service was recorded. But if I returned to the application test center, I chose to stop the record. Select the next one to give him a test name. I called his book test and select the end. Now I have a book test in my list. If I think, I can look at the description language he generated for me. I can click right click and see where a set of properties is. Where can I set up how many browsers I have to connect to here. How many users do I want to test at the same time, how long I want to test. I just leave these into default values. And click to run, he will start these applications and will display me, what will happen.
If I returns to the performance counter, I suddenly have a lot of things in it, because now we can see up to 400, 500. So it constantly click on the web service again. So I returned to the application test center to get a graphical interface, you can know how many requests per second, how many errors, etc.
So it can easily test me, and let me take a look at its ability. .
(applause.)
Finally, I am very happy to give you this morning, how Visual Studio.net is easy to generate .NET applications, how Debug, and how to test. Thank you all.
(applause.)
Anders Hejlsberg: Thank you, ROB.
So today you have seen many customers in the .NET framework, and application applications on the .NET framework and Visual Studio.NET. I hope that ROB and I have demonstrated how he is easy to create your app, how to easily use Web Service, there are many information already there, you can use it. More than 150 books, with impurities, training, more than 20 languages have been used on the .NET framework, we have more than 65 integrated partners, a set of components suppliers. More than 25 ASP.NET application host companies allow you to release your ASP.NET app with Web Service.
So write .NET application from now on. All this is ready for you. On behalf of Bill and I am, with our entire Visual Studio development team, I really thank you for coming here to come here to participate in our wonderful conference, I hope you can find a lot of fun in using a tool, just like we have done As.
Thank you.