Facing new challenges everyday

Data Persistence on ASP.NET MVC Applications with EntityFramework

February 27th, 2009

There’s no doubt, ASP.NET is an amazing technology, very productive and easy to use, but it isn’t perfect, his architecture doesn’t help enough when you need add unit tests in your project and you can’t see a clean separation of concerns, some of its urls used to access pages isn’t so intuitive, if you need pass some data over browser address bar it will only read by accessing the old QueryString object.

As completly opposite we have ASP.NET MVC, some of its urls are very intuitive, you don’t need use something like QueryString object to read parameters passed via GET method, you can see a clear separation between model, view and controller layers, all ASP.NET MVC applications can be easily tested using the most famous unit tests frameworks.

In this article I’ll give a small introduction to web development with ASP.NET MVC and data persistence using ADO.NET EntityFramework, a simple contacts application will show how to accomplish this.
(more…)

DZoneGoogle BookmarksFacebookEvernoteLinkedInDeliciousShare

ASP.NET Basics with Visual Studio Web Developer 2008

January 8th, 2009

ASP.NET is one of the key technologies behind .NET Framework, you can easily create web applications to collect data entered by user by placing some input controls in your page, once the data is entered and the page is submited, you can read data on server side by accessing specific properties in your controls.

This article will give an idea about how to create a simple ASP.NET project, it will have a page that contains some textboxes and a button, this button will have an event attached to it, we will add some code in this event to store user entered data into an SQLite database using its ADO.NET provider that can be downloaded here.

I’m assuming that you already have installed Visual Studio Web Developer Express 2008 in your computer, if not, you must download both from this site.

Now you must start Visual Studio Web Developer Express 2008 and then go to File->New Web Site… menu like we have in the image below:

new_project_menu
(more…)

DZoneGoogle BookmarksFacebookEvernoteLinkedInDeliciousShare

ASP.NET MVC, good or bad?

March 15th, 2008

I have been listening some screencasts about ASP.NET MVC, at first moment we can see few features found on the other web frameworks like Grails and RoR, the controllers are very easy to write and all controllers actions can be bind easily on your view code by using helper methods.

The default view engine of ASP.NET MVC is terrible, remembers the way that we wrote some ASP and PHP pages in the past, if you need more control over page rendering you must place some conditional statements there, take a look on the code block below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<form action="/App/InsertCustomer">
  <% if (ViewData.ErrorMessage != null) { %>
    The following error occurred while inserting the customer data:
    <br />
    <%= ViewData.ErrorMessage %>
    <br />
  <% } %>

  First name: <input type="text" name="firstName"
      value="<%= ViewData.FirstName %>" /><br />
  Last name: <input type="text" name="lastName"
      value="<%= ViewData.LastName %>"  /><br />

    <input type="submit" value="Insert" />
</form>

Note the presence of ASP tags <%= somecode %>, this kind of web page code can be very easy to understand on small pages, but if your pages start to be bigger and bigger you will have some problems with code readability, I don’t like this kind of view coding, it can turn into a nightmare.

But, in other hand, you can put all this mix of markup and C#/VB code into an ASP.NET user control, separating small pieces of reusable code into .ascx files, with this approach you can reduce the amount of non markup code into your page and all page rendering logic will be a little more easier to understand.

DZoneGoogle BookmarksFacebookEvernoteLinkedInDeliciousShare

ASP.NET Atlas, first impressions – Part 2

October 1st, 2007

Well, after some investigation I found something very similar to ICEFaces approach, ASP.NET Atlas guesses which portion of page must be updated, the number of updatePanels on the page doesn’t matter.
(more…)

DZoneGoogle BookmarksFacebookEvernoteLinkedInDeliciousShare

ASP.NET Atlas, first impressions

October 1st, 2007

I’ve been spending some moments evaluating the news features of ASP.NET, at first look ASP.NET Atlas seems promising, but at this moment I couldn’t find anything similar to reRender feature that we have in Ajax4JSF, this is can be a serious problem, because how can we specify which portion of such page must be updated? Well, lemme try another solution for this later.

In my example my page code is something like we have below:

(more…)

DZoneGoogle BookmarksFacebookEvernoteLinkedInDeliciousShare

Visitors Around the World

Polls

How Is My Site?

View Results

Loading ... Loading ...

Categories

Meta

Links

hosted by easy2use.net