Visual Studio lightswitch can be downloaded through msdn subscription. For more information, see http://www.microsoft.com/visualstudio/en-us/lightswitch.
So I immediately downloaded the package and tried it:
The installation process is very simple. When you mount isofiles and run setup.exe, the system prompts that more than 1 GB space is required. In fact, if you have installed Vs and Silverlight 4 sdks, you will not need so much space, the installation package of more than 500 mb is also caused by vs shell. I have not installed it in a clean system. I am not quite clear about the specific situation.In the future, Microsoft should generate a streamlined installation package for the existing vs environment.. The installation interface is as follows:
After the installation is complete, open vs. When creating a project, you can see that there is an additional project type. The language can be VB. NET and C #, such:
You may be familiar with creating a project and the initial interface:
You can create a table at the beginning. Note that this table is not a real table in the database. It can be called an abstract data table or an entity in the object framework. I created a data table named "people:
You can see that the ID field is available by default and the name cannot be modified, but you can add a description and select whether to display it on the screen. There is a problem here, even the ID data type cannot be modified, it can only be int32, and many times I prefer to use guid.In the official version, you can select different data types for the ID field (at least GUID is supported ).
You can add an emailaddress field as the data type, which is very convenient. However, you can extend the Data Type yourself, just like Sharepoint.
The age field is a calculated field, which can be opened through the "Edit Method" button provided in the Property Window.CodeOn the editing page, enter the following code:
Partial Void Age_compute ( Ref Int Result ){ // Set result to the desired field value If ( This . Birthday. hasvalue) Result = Datetime. Now. Year - This . Birthday. value. Year ;}
The Automatic Generation of code is very good. If you change the age data type, you can modify the result type synchronously.
View the attributes of the name, age, and email fields respectively. You can see:
The data type of a string (or string-based) can be searched. (If date is not understood, it cannot be searched, or can only be filtered ?); Each field can be converted to a calculated field. For string fields, you can provide a list selection. For data verification, different verification options are provided based on different data types, you can also set a custom Verification Mode. For Null String data types, you can select how to save null values.
In addition to defining your own data tables, you can also add external data sources:
You can add it from the database, Sharepoint, and WCF Ria service. The strange thing is that you can see ce 3.5 through other in the database selection, but I didn't try it, I only tried to import a table from SQL Server:
This process can also be seen as an operation for ing a table in the object framework (EF is actually used for EF ing). required cannot be modified and cannot be modified during data verification, other display names, such as field names, can be modified. This requirement is also required by EF ing.
It can be said that in lightswitch, table is the core of everything, and it is also the start of everything. It can be seen from the toolbar OPERATION button. This also shows that lightswitch is for data-centric (data-driven) lob applications.
Next, we will add two tables dinner and RSVP, such:
At this time, les also becomes the following figure:
Next, let's take a look at Solution Explorer:
The display of the entire solution completely shields the traditional method of listing code (although the solution actually contains 6 projects and N multi-code files ), only three main nodes are displayed: properties, data source, and operation interface. The data tables directly created in the data source are stored in the applicationdata directory. Each data table has one node, but multiple data tables cannot be edited at the same time (it may be more concentrated based on the work target, or it is more convenient to automatically generate code ). The external data sources introduced are separate columns.
By the way, when importing external data sources, if you select WCF Ria services, you can only select authenticationservice and securitydataservice, you will see other project names, such:
If you add an additional service, you have not found any more.In addition, it is very slow to open and close the Add reference window. It is estimated that it is an issue..
After preparing the data source, you must add an operation interface. It is also very easy to add. Open a data table and click the "screen" button on the toolbar, for example:
After the createnew, search, and details operation interfaces are added, we can press F5 to run ourProgramIn addition to the field calculated by age, no code is written. The running effect is as follows:
Note that there is a "customize screen" button in the upper-right corner of the main interface, which allows the end-user to customize its own operation interface, this is much more powerful than the display column that customizes the data grid. This benefits from the powerful XAML. It is estimated that the technology behind it is something similar to blend sketchflow. I will share with you more experience on the operation interface in subsequent blogs.
In addition, there is also a treasure that you must experience, that is, set the project properties of the entire application. Right-click "application1" on Solution Explorer and choose "properties ", you can see the property setting interface:
Here, several options are provided to determine the application program running mode. In general, the choice of Shell and theme makes your application different, in addition, I don't know if the setting of the culture will affect the display of text on the interface. Is the implementation of multiple languages here?
Extension: You can add and select different extension packages. In fact, it provides developers with the default extension of lightswitch. You can compile some of your lob construction ideas into lightswitch extension, let everyone use it. (This is purely a conjecture)
Screen navigation allows you to modify the navigation menu of the main interface.
Access Control: You can set the features of built-in Access Control. By default, form authentication and Windows authentication are provided.
Application Type, you can select the specific running status of the application, specifically:
Note that the first option is the Desktop client, which has only two layers. The Silverlight client and the SQL server data, that is, lightswitch provides a direct (or a package) for Silverlight) database access capability (EF in the middle ).
I will share more details about the experience of setting project properties later.
It is also worth noting that lightswitch actually reflects my idea last year:Use Silverlight 3 as the desktop application development platform (1 -- conception)
Finally, we will talk about how to locate lightswitch:
Here is an article on infoq.Article: Lightswitch-a professional development tool that Microsoft will launch to address problems. The questions mentioned here are true, especially similar to access functions.
However, in my opinion, lightswitch is different from access in terms of running environment, development environment, and development language, different deployment models (especially when lightswitch is in browser mode, footprint is very small). I believe that development efficiency and interoperability capabilities cannot be the same.
In addition, if lightswitch is used by professional developers, I think professional developers also need such tools. Some people mentioned that they can develop a prototype system or concept to verify the POC, however, in my own practice, I will use it to develop formal projects and products in the future. Because we mainly develop professional data analysis products, but occasionally develop small data-centric applications such as MIS or lob for our partners. At this time, we have lightswitch, I don't have to build a lob development framework myself. lightswitch has already completed many basic things for us. We only need to consider the data model and operation interface problems. Since lightswitch is easy to use, I can also assign this task to some intern students who have a certain foundation. Another example is that I used to develop a lob-based small business to implement a three-layer architecture development framework that provides basic data access modes and permission management functions, we have developed a set of guidelines to help everyone follow the same architecture to develop various functional modules. Now we can say that lightswitch has internalized such a development framework into an IDE for everyone, and allows you to customize and expand.