Windows 2012 Hosting - MVC 6 and SQL 2014 BLOG

Tutorial and Articles about Windows Hosting, SQL Hosting, MVC Hosting, and Silverlight Hosting

Visual Studio 2010 Hosting - ASPHostPortal :: How to Create a UML Model Diagram in Visual Studio 2010

clock June 29, 2011 05:45 by author Jervis

This post discusses about how to use UML models and diagrams in Visual Studio 2010 ultimate edition. Models are very useful to describe the requirements and design of the system. Models help you to visualize how system works and clarifies the user needs and finds the architecture of the system.

1. Launch the Visual Studio 2010 and create a new project by selecting the modeling from templates window as shown below



2. In this empty project , you will find an empty .uml file which is an xml document which holds all the UML elements

3.Open the UML model viewer from View –> Otherwindows, right click on the root node and add one or more items to this model. In this example I am adding an actor to the model say Visitor and add few more actors customer and product as shown below. Actor just represent the classes of people, organisations or represent software devices which interact with system or sub systems. You can add the description to each actor in properties window.







4. We can also add use cases here, In this example I am adding Browses as an usecase. Now we can add diagrams to this model let us add an usecase diagram as shown below



5.It is blank diagram when you create but you can add the actors and usecase that we created earlier to this diagram as shown below. Drag the visitor and customer actors on the left hand side and product on right hand side, in-between add the Browses usecase. Now go to the toolbox and the associations , I am using basic association where visitor browses the product. Now I am adding a subsystem between customer and product named Ordering subsystem which contains a new usecase named buys. Let us put an association between customer and product like customer buys product. You can also add the comments to the diagram which you have created.



6.Notice that all elements which you added to the diagram are automatically appear in model explorer. There is no difference between adding the items to the explorer first and drag to the diagram and adding directly to the diagram.

7. Let us add an activity diagram to the model , Activity diagram basically shows business process or software process as a flow of work through series of actions. It is like a flow chart. Add a initial node and an action name it like visit home page and put a decision node under this and called view feature product. Add few more actions as shown below. Add a final activity node as well, use the connector to connect these actions.



8. Now look at the sequence diagram named browsing products. Sequence diagram shows the interactions which represents the sequence of messages between classes or components, systems or actors. Time flows down the diagram and you can see the message flow from start to end.



9.The typical items in sequence diagram are life lines and messages. In sequence diagram we need say where we begin, usually you can represent asynchronous message when you do not know when it is going to start. Sequence diagrams are very useful to explain the technical steps to non-technical user.

10.Now let us try to add the component diagram to the model. Component diagram basically shows the parts of the design and software system. It helps you to visualise the high-level system and service behavior. In this example the components are web servers. One is a public web server and other one say an internal server for operations. Components are going to have interfaces. Types of interfaces are provider interface and required interface. This is just an high-level view of component diagram which tells how our servers going to talk each other. You can add life line to the component diagram , which automatically adds to the sequence diagram.



This post is to give just an overview of creating UML diagrams. More useful links to learn more about UML in VS 2010 are

http://msdn.microsoft.com/en-us/vstudio/ff655021.aspx

http://msdn.microsoft.com/en-us/architecture/ff476944.aspx

Hope you enjoy the post!!

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET MVC 3 Hosting - ASPHostPortal :: How to FIx "This resource cannot be found" and User.Identity.Name is blank Error

clock June 21, 2011 06:46 by author Jervis

ASP.NET MVC 3 Tools refresh recently was released and it includes a new Intranet Visual Studio project template.  This template is basically an ASP.NET MVC 3 template with Windows Authentication enabled (the Internet Application template uses forms based authentication).



I was recently playing with this template and it worked fine in development and even using the IIS 7.x Express Web Server.  However, when I deployed to a real Windows Server 2008 R2 application I saw this "The resource cannot be found" error:



So what is going on?  Notice (from the screenshot above) that we are being redirected to .../Account/Login.  This is a clue that the login/authentication is failing. The controller for login is throwing the error.

If you explicitly actually type in /Home/About you will actually get a rendered page below.  Notice in the top right corner all you see is an exclamation point.  The @User.Identity.Name code in the _Layout.cshtml is blank/NULL and causing the error (shown below that is why you only see "Welcome !"). 



Why is Windows Authentication not working?  It looks to me that this is a bug in the ASP.NET MVC 3 Intranet template....I stumbled upon this by chance, by going through the "known issues" section in the 
ASP.NET MVC 3 release notes.  It mentions that we should add this line (<add key="enableSimpleMembership" value="false" />) to the web.config if we are upgrading from an ASP.NET MVC 2 application.  This has NOTHING to do BTW with Windows Authentication and I tried adding that key in web.config by chance and it properly authenticated me.

After adding the key (and restarting the application pool), ASP.NET MVC 3 properly is able to grab the identity of the user via Windows Authentication.  Basically the appsettings section of the web.config should look like this now:

  <appSettings>
    <add key="webpages:Version" value="1.0.0.0" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="enableSimpleMembership" value="false" />
  </appSettings> 

If you receive a "This Resource Cannot be Found" error or the User.Identity.Name is blank or IsAuthenticated is false for an ASP.NET MVC application ensure:

- Windows Authentication is turned on in web.config (IIS 6 and 7)
- You are using the Integrated pipeline mode in the application pool (IIS 6 and 7)
- All the wildcard mappings and ISAPI settings are properly set up (IIS 6)
- Add the key: <add key="enableSimpleMembership" value="false" /> to the appSettings section
- If you have Kerebos/NTLM etc authentication, make sure it is configured correctly in IIS

I hope this article helped anyone who is going through this annoying issue.

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET MVC 3 Hosting - ASPHostPortal :: Creating Session-less Controller in MVC3

clock June 17, 2011 06:56 by author Jervis

So, how to manage the controller’s session state? Simply we can decorate the controller class with “SessionState” attribute. [SessionState()] attribute accepts SessionStateBehaviour enumeration.

SessionStateBehaviour enumeration has the following constants.

- SessionStateBehavior.Default - ASP.NET default logic is used to determine the session state behavior for the request.

- SessionStateBehavior.Required – Full read-write session state behavior is enabled for the request.

- SessionStateBehavior.ReadOnly – Read only session state is enabled for the request.

- SessionStateBehavior.Disabled – Session state is not enabled for processing the request.



We decorated controller class with [SessionState(SessionStateBehaviour.Disabled)] to disable the session. Important point to remember when we are disabling session of the controller, we should n’t use TempData[] Dictionary to store any values with action method controller, it uses session to store it’s values. If you use TempData[] Dictionary when session is disabled on controller it will throw an exception “The SessionStateTempDataProvider class requires session state to be enabled“.

Note: In earlier release of MVC3 (Beta) [SessionState()] attribute was refereed as  [ControllerSessionState()]

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



Silverlight 4 Hosting - ASPHostPortal :: How to Edit Silverlight page data using Domain Service

clock June 16, 2011 06:02 by author Jervis

This post requires to create a Silverlight Business Application in Visual Studio 2010.

1. Open the Mainpage.xaml , Add the following XAML code to see the Save changes and Reject changes button

   1: <Button Content="Save Changes" Click="SaveButton_Click"
         Margin="5" 
   2:        x:Name="SaveButton"></Button>
   3: <Button Content="Reject Changes" Click="RejectButton_Click"
               Margin="5"
   4:         x:Name="RejectButton"></Button>
   5: <TextBlock x:Name="ChangeText" VerticalAlignment="Center"
      Width="Auto"></TextBlock>

2. Add the code for button click event handlers as shown below

   1: private void SaveButton_Click(object sender, RoutedEventArgs e)
   2:  {
   3:   awDept.SubmitChanges(OnSubmitCompleted, null);
   4:  }
   5: 
   6:  private void RejectButton_Click(object sender, RoutedEventArgs e)
   7:  {
   8:    awDept.RejectChanges();
   9:    CheckChanges();
  10:  }
  11: private void CheckChanges()
  12:  {
  13:   EntityChangeSet changeSet = awDept.EntityContainer.GetChanges();
  14:   ChangeText.Text = changeSet.ToString();
  15:   bool hasChanges = awDept.HasChanges;
  16:   SaveButton.IsEnabled = hasChanges;
  17:   RejectButton.IsEnabled = hasChanges;
  18:  }
  19: 
  20: private void OnSubmitCompleted(SubmitOperation so)
  21:  {
  22:    if (so.HasError)
  23:     {
  24:         MessageBox.Show(string.Format("Submit Failed: {0}", so.Error.Message));
  25:         so.MarkErrorAsHandled();
  26:      }
  27:             CheckChanges();
  28:  }

  29: private void departmentDataGrid_RowEditEnded(object sender,
          DataGridRowEditEndedEventArgs e)
  30: {
  31:          CheckChanges();
  32: }

3. Open the Metadata file in server project and add the editable attribute to the Id and modified date as shown below

   1: internal sealed class DepartmentMetadata
   2:         {
   3: 
   4:             // Metadata classes are not meant to be instantiated.
   5:             private DepartmentMetadata()
   6:             {
   7:             }
   8: 
   9:             [Editable(false)]
  10:             public short DepartmentID { get; set; }
  11: 
  12:             public string GroupName { get; set; }
  13:             [Editable(false)]
  14:             public DateTime ModifiedDate { get; set; }
  15: 
  16:             public string Name { get; set; }
  17:         }

4. When you run the application you should be able to see the below screen



Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET MVC 3 Hosting - ASPHostPortal :: How to Use BCrypt with ASP.NET MVC 3 and C#

clock June 14, 2011 12:33 by author Jervis

Today we will talk about how to use BCrypt with ASP.NET MVC 3 and C#. First, Open up Visual Studio 2010 and make sure you have the ASP.NET MVC 3 package installed. Create a new project: File -> New Project -> ASP.NET MVC 3 Web Application and call it MvcBCrypt. For the project template select Empty. Make sure for the View Engine you pick Razor.



Right-click on the Controllers folder and select Add -> Controller

Name the new Controller HomeController.



When the code shows up right-click on the Index() and choose Add View. Use the default settings (see below) and then click Add.



Modify the code in the Index.cshtml file to look like this:

@{
    ViewBag.Title = "Home Page";
}   

<p>Password: @ViewBag.Password</p>
<p>Hashed Password: @ViewBag.HashedPassword</p>
<p>(Use a wrong password) Is the password correct?:
@ViewBag.HashedPasswordChecked1</p>

<p>(Use the correct password) Is the password correct?: @ViewBag.HashedPasswordC

Its time to bring in the
BCrypt code now. Go to this link and copy the source code. Create a new folder in your project called Utility and create a new class file in there called BCrypt.cs.



Note: Yes, there are better places to put this new BCrypt class file but for simplicity its just going to live in a Utility folder for this demonstration.

Make sure to paste in the code and save the file. When you do this make sure to fix the namespace and remove the following:

[assembly: System.Reflection.AssemblyVersion("0.3")]

Go back to the HomeController file and modify it like so:

using MvcBCrypt.Utility;

Add the new code to test out the BCrypt class:

public ActionResult Index()
{
    string password = "myPassword1";
    string wrongPassword = "wrongPasswOrd1";   

    string hashedPassword = BCrypt.HashPassword(password, BCrypt.GenerateSalt(12));
    bool doesItMatch1 = BCrypt.CheckPassword(wrongPassword, hashedPassword);
    bool doesItMatch2 = BCrypt.CheckPassword(password, hashedPassword);   

    ViewBag.Password = password;
    ViewBag.HashedPassword = hashedPassword;
    ViewBag.HashedPasswordChecked1 = doesItMatch1;
    ViewBag.HashedPasswordChecked2 = doesItMatch2;   

    return View();
}

Save and run the project.



Note: Using the new Library Package Manager I did see another BCrypt library out there so you might want to experiment with that one as well.



ASP.NET MVC 3 Hosting - ASPHostPortal :: How to Use Controllers Scaffolding in ASP.NET MVC 3

clock June 7, 2011 08:06 by author Jervis

ASP.NET MVC 3 Tools Update introduces support for controllers scaffolding with views and data access code. Right now I am building one very simple web site for free tech events and as I am building it on ASP.NET MVC 3 I have good testing polygon right here. In this posting I will show you how controller scaffolding works and what is the end result.

You can see this image below. This is my solution.



If you have built something like this before then you should also be able to see one interesting output that I have to generate – namely event schedule. Cool, this is something I can blog about later.

Adding controller for events management

Under admin section I want to be able to manage the events. So, let’s add new controller for events. This is new Add Controller dialog and I have selected template that is based on Entity Framework (yes, I am using EF in this project).

Also notice that there is dropdown for data context class. This dropdown is filled automatically and it provides you with Entity Framework models you have in your projects.

Controller with data access methods

Image on right shows what was generated when I hit Add button. There is controller class with all methods to manage events and… this is all buggy because event, when lower cased, is keyword of C#. Here’s the example:

01.[HttpPost]
02.public ActionResult Create(Event event)
03.{
04.    if (ModelState.IsValid)
05.    {
06.        db.events.AddObject(event);
07.        db.SaveChanges();
08.        return RedirectToAction("Index"); 
09.    }
10.   
11.    return View(event);
12.}




I suppose I doesn’t compile without renaming some variables. :)

After fixing the variable names and removing comments generated by default I have controller class that looks like this.

01.public class AdminEventsController : Controller
02.{
03.    private EventsEntities db = new EventsEntities();
04.   
05.    public ViewResult Index()
06.    {
07.        return View(db.events.ToList());
08.    }
09.   
10.    public ViewResult Details(int id)
11.    {
12.        Event evt = db.events.Single(e => e.Id == id);
13.        return View(evt);
14.    }
15.   
16.    public ActionResult Create()
17.    {
18.        return View();
19.    }
20.   
21.    [HttpPost]
22.    public ActionResult Create(Event evt)
23.    {
24.        if (ModelState.IsValid)
25.        {
26.            db.events.AddObject(evt);
27.            db.SaveChanges();
28.            return RedirectToAction("Index"); 
29.        }
30.   
31.        return View(evt);
32.    }
33.   
34.    public ActionResult Edit(int id)
35.    {
36.        Event evt = db.events.Single(e => e.Id == id);
37.        return View(evt);
38.    }
39.   
40.    [HttpPost]
41.    public ActionResult Edit(Event evt)
42.    {
43.        if (ModelState.IsValid)
44.        {
45.            db.events.Attach(evt);
46.            db.ObjectStateManager.ChangeObjectState(evt,
47.               EntityState.Modified);
48.            db.SaveChanges();
49.            return RedirectToAction("Index");
50.        }
51.        return View(evt);
52.    }
53.   
54.    public ActionResult Delete(int id)
55.    {
56.        Event evt = db.events.Single(e => e.Id == id);
57.        return View(evt);
58.    }
59.   
60.    [HttpPost, ActionName("Delete")]
61.    public ActionResult DeleteConfirmed(int id)
62.    {           
63.        Event evt = db.events.Single(e => e.Id == id);
64.        db.events.DeleteObject(evt);
65.        db.SaveChanges();
66.        return RedirectToAction("Index");
67.    }
68.   
69.    protected override void Dispose(bool disposing)
70.    {
71.        db.Dispose();
72.        base.Dispose(disposing);
73.    }
74.}

As you can see then most of dirty work is already done for you. All you have to do is some little tweaking of methods so they better fit your needs.


Views

With controller we also got views for controller actions. Views are generated like they were before. Here is the example of list view of events that is generated by default.



So, nothing special for views has happened but they are generated and work well.

Conclusion

ASP.NET MVC 3 Tools Update offers controllers scaffolding feature that helps to generate CRUD methods for controllers and appropriate views. It is very cool that Entity Framework models are supported and ASP.NET MVC is able to generate working code that you can use right after generating it. Although this code usually needs some tweaking and modifications it is still useful because it saves you some time.

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

-
DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



Visual Studio LightSwitch Hosting - ASPHostPortal :: SQL Server Meets Microsoft Visual Studio LightSwitch

clock June 6, 2011 06:36 by author Jervis

Introduction

Developing a tool for building applications with little to no programming skills has been the goal of multiple companies over the last twenty some odd years. You would think that after all this time someone would have come up with a way to automatically generate computer programs to do just about anything. While there are some products on the market that come close, there really isn't a tool that completely writes a program for you.


Microsoft Visual Studio LightSwitch takes another shot at the no-programming-experience-needed goal with the target of building applications to run both natively and over the web. It's the culmination of several years' worth of research and development effort on the part of Microsoft aimed specifically at the relatively simple line-of-business application market. The target user of the product is someone with little-to-no programming experience but a good understanding of the business process needing to be automated.

Database Centric

LightSwitch at the core is all about building data-centric applications. When you first fire up the program and create a new project you'll be asked to either create a new data table or connect to an external data source. All the plumbing necessary to make the database connections is done for you behind the scenes. To connect to password protected data sources will require a one-time username and password and, after that, it will be automatic.

One of the new things that LightSwitch brings to the table is the idea of real-world data types like phone numbers and email addresses. In a typical business language like Visual Basic this would typically require some additional logic to take a string input field, validate that the input data looked something like a phone number (no letters, right number of digits, etc) and then save the result to a string field. Fields can also have default values or partial values such as a default domain for an e-mail address. When you create a table from scratch, LightSwitch actually fires up a copy of Microsoft SQL Express with a file-attached data source.



To talk to external SQL databases LightSwitch uses EDM. This provides direct access to all the popular SQL database engines including Microsoft SQL Server, Oracle and more. LightSwitch also uses the recently released Windows Communication Foundation (WCF) Rich Internet Application (RIA) services to communicate between the application and any external data source, including Cloud SQL Azure.

Out-of-the-box (OOTB) support for SharePoint as an external data source makes LightSwitch a great candidate for apps to manipulate any SharePoint table. The development environment provides a simple relationship builder tool to establish links between different tables. You don't have to be a programmer or a database expert to use the tool.

Simplified User Interface Construction

In doing the research for this product, Microsoft identified a number of common elements that tend to repeat themselves with typical business applications. For user interaction this typically involves a set number of screens for inputting, searching, editing and displaying data of some type. LightSwitch provides all of these patterns as options when you select Add New Screen.



LightSwitch uses a XAML-based syntax for both the screen layout and data schema definitions. It is not, however, the same XAML you would get when building a Silverlight application using the full Visual Studio experience. LightSwitch goes to great lengths to take care of the more mundane code needed to do most of the common tasks that every application must do. For example, every grid in a LightSwitch native app comes with the ability to directly export to Excel without the need to write any code.

Customizing user screens happens while the application is actually running. When you run an application, you'll see an icon in the upper right corner titled "Customize Screen." Clicking this icon brings up a Customization Mode window with a multitude of options, allowing you to change the layout of your screen. The tool uses a template system with a set of default templates for displaying typical data layouts and includes the ability to extend the templates should the need arise.



When you're ready to publish your app, simply follow the instructions provided from the publish option on the Build menu. That's pretty much all there is to it.

Final Notes

If you are a current MSDN subscriber, you'll be happy to know that when LightSwitch ships it will be integrated into the Visual Studio Pro and Ultimate product lines so you'll have the option when creating a new project to build a LightSwitch solution. The product will also be available as a stand-alone offering for anyone that's not a current Visual Studio or MSDN customer. Thanks for reading.

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

-
DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



About ASPHostPortal.com

We’re a company that works differently to most. Value is what we output and help our customers achieve, not how much money we put in the bank. It’s not because we are altruistic. It’s based on an even simpler principle. "Do good things, and good things will come to you".

Success for us is something that is continually experienced, not something that is reached. For us it is all about the experience – more than the journey. Life is a continual experience. We see the Internet as being an incredible amplifier to the experience of life for all of us. It can help humanity come together to explode in knowledge exploration and discussion. It is continual enlightenment of new ideas, experiences, and passions


Author Link


Corporate Address (Location)

ASPHostPortal
170 W 56th Street, Suite 121
New York, NY 10019
United States

Sign in