European Windows 2012 Hosting BLOG

BLOG about Windows 2012 Hosting and SQL 2012 Hosting - Dedicated to European Windows Hosting Customer

European Visual Studio 2012 Hosting - Amsterdam :: Features Visual Studio 2012 for Developers

clock March 26, 2013 10:49 by author Scott

Developer Testing in Visual Studio 2012 has been improved a lot and it is allowing them to concentrate more on the code they are writing in the application. In addition to the testing framework that comes with Visual Studio 2012, you can easily add third-party testing frameworks in the IDE. This post discusses the new unit and integration testing features for developer in Visual Studio 2012.

To open the new Test Explorer window, Select the Test Menu then choose windows and click Test Explorer

The look and fell of Test Explorer in VS 2012 is different in number of ways. You do not have too many different windows to say same information in new IDE, instead you have one widow that focus on unit and integration testing results.

When you select a test case in Test Explorer then you can see the detailed information about the test in below pane. The green bar in test explorer gives you quick view on the out-come.

Integrating Third Party Testing Frameworks

One of the important feature for developers for testing in this release is, it enables you to quickly integrate third-party testing frame-works in VS 2012. So If your team uses N-Unit or XUnit.net or some other testing framework then you can simply install Visual Studio extension.

To open the Extension tools manager, Go to Tools and click Extensions and Updates

You can search the framework that you need and download as shown below

In Visual Studio 2012 Regard less of which Testing Framework you use, it is fast and scales  up to thousands of test cases.

Developer testing is also very easy to use, If you want to Run or Debug the test that is in your editor then you can right-click on the code and select either run tests or debug tests.

You can also Filter the test cases by entering the search term in Test Explorer. You can also group tests with different properties, You can group the tests either by Test Outcome or Duration.

If you often require to run unit and integration tests in your solution then with single click in Visual Studio 2012 you can accomplish with Run test after build feature.

Now your test will run as part of every build you do.

With a single-click you can analyze and understand various code-metrics about your solution.

The Code Metrics Results window will appear as below information like number of line of code , Class Cohesion and Depth of inheritance

As it in previous visual studio versions, you can use Code Analysis Tool to quickly find common coding and design mistakes in your code

Another new feature in Visual Studio 2012 is Code Clone Analysis, using this feature you can scan your entire solution for duplicate code

Code Clone Analysis is smart enough to identify the duplicate code and groups the results with Exact match and medium match.

You can also use code clone feature that matches selected code in editor as shown below

Code Coverage Analysis

Code Coverage Analysis tool helps you to know how well your tests exercise your code? Code Coverage Analysis has significantly improved in Visual Studio 2012. To Analyze the code coverage of all the tests in your solution simply click Run drop down in Test Explorer

You can browse and explore the Code Coverage Results after completing the run



European SQL 2012 Hosting - Amsterdam :: Importing Access Database into SQL Server 2012

clock March 14, 2013 06:51 by author Scott

In this article, we make a database in Microsoft Access and that database is used in SQL Server. 

So let's take a look at a practical example of how to import a Microsoft Access database table into SQL Server 2012. The example is developed in SQL Server 2012 using the SQL Server Management Studio.  There are some simple steps to do that as described here.

Creating a Empty Database in SQL Server

Now Press F8 to open the Object Browser in SQL Server Management Studio and expend it.

Database -> right-click-> select New database

This would open the "New database" window:

Now enter a database name to create a database.

Now click on the OK button to create the database. The new database will be shown in the Object Explorer:

Creating a Table in Access Database

Now open the Microsoft Access database and create a database.  The Access database looks as in the following:

Importing Access database in SQL Server

Now right-click on the Test database and select the Import Data option.

database Name -> Tasks -> Import data

Now click on Import data. The import and export wizard will be opened.

Now select a Data Source. And browse the file from the system.

Now click on the Next Button and enter the computer name or server name and select a database.

Server Name: MCNDESKTOP08\MYMSSQLSERVER

Database name: Test

Now click on the Next Button.

Now click on the Next Button.

Now again click on the Next Button.

Now click on the Finish Button.

And finally click on the Close button.

All of your Access data is nicely imported into a SQL Server 2008 database. Now refresh the test database and expand it to see the imported table. 

 

 



European Visual Studio LightSwitch Hosting - Amsterdam :: Masked password textbox in LightSwitch

clock March 11, 2013 06:39 by author Scott

In this article you will see how to create a masked password textbox. A masked control is used to save time and reduce the complaints and errors. They enhance the function of the textbox control, which can validate the input. By default the property masked is set to none. A password textbox is used for authorization of an any application. It is very useful to provide security for any application.

1. Open Your VS LightSwitch and Create a New Table

2. Create a Table called Customer

3. Right Click on Screens à Add screen

4. Select New Data Screen

5. Expand Password à select textbox and custom control

6. Go to password properties à Click change

7. Select password control à OK

8. Click write code->Select CreateNewCustomer_InitializeDataWorkSpace->Write the following code

using System;
using System.Linq;
using System.IO;
using System.IO.IsolatedStorage;
using System.Collections.Generic;
using Microsoft.LightSwitch;
using Microsoft.LightSwitch.Framework.Client;
using Microsoft.LightSwitch.Presentation;
using Microsoft.LightSwitch.Presentation.Extensions;
namespace LightSwitchApplication
{
    public partial class CreateNewCustomer
    {
        partial void CreateNewCustomer_InitializeDataWorkspace(List<IDataService> saveChangesTo)
        {
            // Write your code here.
            this.CustomerProperty = new Customer();
             this.FindControl("Password").ControlAvailable += pwdAvailable;
        }
        private void pwdAvailable(object sender, ControlAvailableEventArgs e)
        {
            ((System.Windows.Controls.Control)e.Control).LostFocus += PasswordLostFocus;
        }
        private void PasswordLostFocus(object sender, System.Windows.RoutedEventArgs e)
        {
             this.CustomerProperty.Password = ((System.Windows.Controls.PasswordBox)sender).Password;
        }
        partial void CreateNewCustomer_Saved()
        {
            // Write your code here.
            this.Close(false);
            Application.Current.ShowDefaultScreen(this.CustomerProperty);
        }
    }
}

9. Run Application (Press F5)




European Visual Studio LightSwitch Hosting - Amsterdam :: Getting the Most Out of Screens in Visual Studio LightSwitch

clock March 5, 2013 05:55 by author Scott

One of the biggest benefits of building applications with Visual Studio LightSwitch is that it generates the user interface for you, including labels, data-bound fields, commands, and controls. You can rearrange the positions of controls on the screen, and you can determine a number of properties for setting up the appropriate layout. If you're an experienced developer coming from a different development environment, you might need to set up additional requirements such as displaying text messages, implementing a home screen, or interacting with controls at runtime. This article shows a number of handy tips and tricks that you can use to create even more powerful and interesting screens.

Adding Labels and Descriptive Text

LightSwitch automatically adds label and text box controls to display data-bound information coming from the data source for both single entities and entity collections. This is a tremendous benefit because it saves the developer from having to select and add the appropriate controls. However, in LightSwitch every label or text box control is data-bound. Unlike in other development environments, such as Microsoft Access or Visual Studio 2010, you can't show a text message inside an unbound control.

For instance, you might want to show warning messages, advice, or welcome text in your controls. To accomplish this goal in LightSwitch, you use local properties, which are basically data items associated to the selected screen and representing a piece of information that isn't related to the bound data source. Think of a local property as a variable of a given type.

Let's try an example. Suppose you want to display a warning message inside a screen. Follow these steps:

1. Open the screen designer for the screen and click Add Data Item. This action opens the Add Data Item dialog.

2. Select the Local Property item.

3. Specify the data type in the Type combo box (see Figure below) and a name for the property. For this example, use a String type, enter WarningMessage as the property name, and then click OK. At this point, the new data item appears with the list of other data items and methods.

Make sure that the Is Required check box is deselected when you use local properties to display descriptive messages; otherwise, the validation mechanism will throw an exception. In fact, data validation automatically runs against local properties.

4. Drag the property from the list of data items onto the designer's surface and release it under the Screen Command Bar element. Since the property will only be used to display some text, you can replace the default Text Box with a Label.



5. Go to the Properties window, where you can fine-tune the appearance of your label.

6. Change the value of the Label Position property from Left-aligned to None. This change ensures that the name of the label will not be shown.

7. Change the value of the Font Style property from Normal to Warning. As Figure below shows, you can select from a number of font styles. When you select Warning, your text message will be displayed in red and boldfaced (assuming that you're using the default LightSwitch theme).

So far you've prepared a label to display text, but the dialog offers no way to assign text to the label at design time. The only way to perform this assignment is by writing code, so click the Write Code button in the upper-right corner of the screen designer. You can write the label assignment in a couple of different method hooks:

- Created. Write the assignment inside Created when your text is a message that doesn't take information from the screen's data source. This is exactly our case.

- InitializeDataWorkspace. If you need to display some text that's constructed with information coming from the screen's data source, write the assignment inside InitializeDataWorkspace.

Listing 1 shows how to perform the assignment. (In your code, replace ScreenName with the name of the screen you're creating.)

Listing 1—Assigning the content of an informative label.

Private Sub ScreenName_Created()
    Me.WarningMessage = "Warning: the application is going to handle your information."
End Sub

This is nothing but a variable assignment. If you run the application, you'll see how the text message appears, as represented in Figure below.



About HostForLIFE.eu

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.


Tag cloud

Sign in