Labels

Showing posts with label Scott G. Show all posts
Showing posts with label Scott G. Show all posts

Monday, December 17, 2007

ASP.NET Dynamic Data Support - Scott G

ASP.NET Dynamic Data Support

http://weblogs.asp.net/scottgu/archive/2007/12/14/new-asp-net-dynamic-data-support.aspx

This is one of the cool new feature - "ASP.NET Dynamic Data Support". In a nutshell this enables us to really quickly build data driven web-sites that work against a LINQ to SQL (and in the future LINQ to Entities) object model - and optionally allows you to-do this Without Having To Build Any Pages Manually.

Below steps are required to work with this:

· Create a ‘Dynamic Data WebSite’ [A new template came in picture after you install ASP.NET 3.5 Extensions CTP release]


· Add a new LINQ to SQL data model to your project (right-click->add new item->LINQ to SQL Classes item).

Object Relational Mapper:

· LINQ to SQL is an O/RM (object relational mapper) that ships in .NET 3.5, and which allows you to model a relational database using .NET classes.

· You can then query the database using LINQ, as well as update/insert/delete data from it.

· LINQ to SQL fully supports transactions, views, and stored procedures.

· It also provides an easy way to integrate data validation and business logic rules into your data model.

· Scaffolding - Enable Dynamic Templates in Your Project:

· ASP.NET Dynamic Data projects provide built-in support for creating automatic "scaffolding" views of your LINQ to SQL and LINQ to Entities data models.

· Dynamic Data projects include template pages and user controls that can automatically create built-in Data Browsing/Editing/Selection/Deleting Ui That Is Dynamically Constructed At Runtime based on the LINQ to SQL or LINQ to Entities data model you've added to your project.

· To enable this auto-scaffolding support, open the web.config file of your project, search for the "dynamicData" section within it, and set the "enableTemplates" attribute to "true":

<system.web.extensions>

<dynamicData dataContextType=”” enableTemplate=”True”>

</system.web.extensions>

· Now the last step – Hit F5. You'll by default be taken to a default.aspx page that lists all of the table objects in your data model.

Thanks & Regards,

Arun Manglick || Tech Lead

ASP.NET 3.5 Extensions preview

ASP.NET 3.5 Extensions preview:

http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-3-5-extensions-ctp-preview-released.aspx

After the release of Orcas (VS 2008 and .NetFramework 3.5), there were few new features have been added into it. See my blog post.

Out of these new features, few have been for ASP.Net. These were called as ASP.Net 3.5 Extension.

This first ASP.NET 3.5 Extensions preview release (Dec 07) includes below:

  • ASP.NET AJAX Improvements: New ASP.NET AJAX features in the ASP.NET 3.5 Extensions release include better browser history support (back/forward button integration, and server-side history management support), improved AJAX content linking support with permalinks, and additional JavaScript library improvements.

  • ASP.NET MVC: This model view controller (MVC) framework for ASP.NET provides a structured model that enables a clear separation of concerns within web applications, and makes it easier to unit test your code and support a TDD workflow. It also helps provide more control over the URLs you publish in your applications, and more control over the HTML that is emitted from them.

http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx

  • ASP.NET Dynamic Data Support: The ASP.NET 3.5 Extensions release delivers new features that enable faster creation of data driven web sites. It provides a rich scaffolding framework, and will enable rapid data driven site development using both ASP.NET WebForms and ASP.NET MVC.

http://weblogs.asp.net/scottgu/archive/2007/12/14/new-asp-net-dynamic-data-support.aspx

  • ASP.NET Silverlight Support: With the ASP.NET 3.5 Extensions release we'll deliver support for easily integrating Silverlight within your ASP.NET applications. Included will be new controls that make it easy to integrate Silverlight video/media and interactive content within your sites.

  • ADO.NET Data Services: In parallel with the ASP.NET Extensions release we will also be releasing the ADO.NET Entity Framework. This provides a modeling framework that enables developers to define a conceptual model of a database schema that closely aligns to a real world view of the information. We will also be shipping a new set of data services (codename "Astoria") that make it easy to expose REST based API endpoints from within your ASP.NET applications.

Thanks & Regards,

Arun Manglick || Tech Lead

Thursday, December 13, 2007

Easily Converting to Visual Studio 2008

Easily Converting to Visual Studio 2008

http://www.wintellect.com/cs/blogs/jrobbins/archive/2007/11/21/easily-converting-to-visual-studio-2008.aspx

VS2008 has launched and on the pace. You might get into 100 different project files and solutions. The thought of manually opening each one and going through the upgrade wizard didn't sound that appealing. Fortunately, there's an easier way to automatically upgrade a solution or project: the /upgrade switch on DEVENV.EXE (the Visual Studio IDE itself). Using the /upgrade switch is about a million times faster than the wizard!

Steps:

· Begin by opening a Visual Studio Command 2008 Prompt from the Start menu.

· Navigate to your project tree and execute "devenv /upgrade MySoln.sln" (without the quotes).

· Visual Studio will automatically upgrade the solution and all projects as well as create backups.

Thanks & Regards,

Arun Manglick || Tech Lead

Wednesday, December 12, 2007

ASP.NET MVC Framework

ASP.NET MVC Framework:

http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-3-5-extensions-ctp-preview-released.aspx

Over the years ASP.NET does not have built-in support for developing web applications using a model-view-controller (MVC) based architecture. Microsoft is working towards implementing such framework and will be releasing a public preview of this ASP.NET MVC Framework a little later this year. A fully supported ASP.NET feature in the first half of next year.

Before we proceed further, access the link to know what is MVC.

This is true that the as of now ASP.Net does not having the built-in support for MVC framework. However it is possible to achieve the MVC Framework as below.

· Model: - This section is represented by Data view, Dataset, Typed Dataset, Business components, business entity models etc.

· View: - ASPX, ASCX, or windows application UI like data grid etc. form the view part of it.

· Controller: - In ASP.NET the behind code is the controller. As the events are handled by that part. Controller communicates both with Model as well as view.

But the new built-in-support implements the MVC in slightly a new way and provides more flexibility and loose coupling b/w Model, View & Controller.

A few quick details to share in the meantime about the ASP.NET MVC framework:

  • Enables clean separation of concerns, testability, and TDD by default - All core contracts within the MVC framework are interface based and easily mockable (it includes interface based IHttpRequest/IHttpResponse intrinsics). You can unit test the application without having to run the Controllers within an ASP.NET process (making unit testing fast). You can use any unit testing framework you want to-do this testing (including NUnit, MBUnit, MS Test, etc).
  • Highly extensible and pluggable - Everything in the MVC framework is designed so that it can be easily replaced/customized (for example: you can optionally plug-in your own view engine, routing policy, parameter serialization, etc). It also supports using existing dependency injection and IOC container models (Windsor, Spring.Net, NHibernate, etc).
  • Powerful URL mapping - It includes a very powerful URL mapping component that enables you to build applications with clean URLs. URLs do not need to have extensions within them, and are designed to easily support SEO and REST-friendly naming patterns. For example, I could easily map the /products/edit/4 URL to the "Edit" action of the ProductsController class in my project above, or map the /Blogs/scottgu/10-10-2007/SomeTopic/ URL to a "DisplayPost" action of a BlogEngineController class.
  • Compatabilty with Existing:
    • The MVC framework supports using the existing ASP.NET .ASPX, .ASCX, and .Master markup files as "view templates".
    • It does not, however, use the existing post-back model for interactions back to the server. Instead, you'll route all end-user interactions to a Controller class instead - which helps ensure clean separation of concerns and testability (it also means no viewstate or page lifecycle with MVC based views).
    • Fully supports existing ASP.NET features like forms/windows authentication, URL authorization, membership/roles, output and data caching, session/profile state management, health monitoring, configuration system, the provider architecture, etc.

Thanks & Regards,

Arun Manglick || Tech Lead

MVC Architecture

MVC Framework:


What is a Model View Controller (MVC) Framework?

MVC is a framework methodology that divides an application's implementation into three component roles: models, views, and controllers.

  • "Models" in a MVC based application are the components of the application that are responsible for maintaining state. Often this state is persisted inside a database (for example: we might have a Product class that is used to represent order data from the Products table inside SQL).
  • "Views" in a MVC based application are the components responsible for displaying the application's user interface. Typically this UI is created off of the model data (for example: we might create an Product "Edit" view that surfaces textboxes, dropdowns and checkboxes based on the current state of a Product object).
  • "Controllers" in a MVC based application are the components responsible for handling end user interaction, manipulating the model, and ultimately choosing a view to render to display UI. In a MVC application the view is only about displaying information - it is the controller that handles and responds to user input and interaction.

One of the benefits of using a MVC methodology is that it helps enforce a clean separation of concerns between the models, views and controllers within an application. Maintaining a clean separation of concerns makes the testing of applications much easier, since the contract between different application components are more clearly defined and articulated.

The MVC pattern can also help enable red/green test driven development (TDD) - where you implement automated unit tests, which define and verify the requirements of new code, first before you actually write the code itself.


Thanks & Regards,

Arun Manglick || Tech Lead

Tuesday, November 6, 2007

Speed up Visual Studio 2005

Hi,

Find the below tricks/shortcuts to speed up working with Visual Studio 2005

http://dotnettipoftheday.org/tips/speedup_visual_studio.aspx

  • Make sure Visual Studio 2005 SP1 is installed.

  • Turn off animation.
    • Tools | Options | Environment and uncheck Animate environment tools.
    • Clearing this option causes auto-hidden windows to appear instantly when requested rather than slowly transitioning onto the screen.

  • Disable Navigation Bar.
    • Tools | Options | Text Editor | C# and uncheck Navigation bar.
    • Instead of this option use CTRL-F12.

  • Turn off Track Changes.
    • Tools | Options | Text Editor and uncheck Track changes.
    • This will reduce overhead and speeds up IDE response.

  • Turn off Track Active item.
    • Tools | Options | Projects and Solutions and uncheck Track Active Item in Solution Explorer
    • When selected, Solution Explorer automatically opens the folder for the active item, scrolls to its node, and selects its name.
    • This option is enabled by default.

  • Turn off AutoToolboxPopulate.
    • Tools | Options | Windows Forms Designer and then set AutoToolboxPopulate to False.
    • There is an option in VS 2005 that will cause VS to automatically populate the toolbox with any controls you compile as part of your solution.
    • This is a useful feature when developing controls since it updates them when you build, but it can cause VS to end up taking a long time in some circumstances. So its better to disable this option.

Thanks & Regards,

Arun Manglick || Tech Lead

Saturday, November 3, 2007

Hard Disk/Drive Speed vs Visual Studio Performance

Hard Disk/Drive Speed and Visual Studio Performance

http://weblogs.asp.net/scottgu/archive/2007/11/01/tip-trick-hard-drive-speed-and-visual-studio-performance.aspx

Scott Guru has some recommendations on the type of Machines/Laptops should be used doing development with Visual Studio.

Summary - Get a Duel Core or better CPU. I also always recommend getting at least 2GB or more of RAM.

Admin always has a question why, why you need a better machine. Here is the answer.

Why the Speed Matters

· The much more likely to block on is the Seek and I/O speed capacity [Required to read/write a lot of files] with which your computer accesses your hard drive.

· When you are doing development with Visual Studio you end up reading/writing a lot of files, and spend a large amount of time doing disk I/O activity.

· Large projects and solutions might have hundreds (or thousands) of source files (including images, css, pages, user controls, etc). Below are the facts that cause a lot of I/O.

o When you open a project Visual Studio needs to read and parse all source files in it so as to provide intellisense.

o When you are enlisted in source control and check out a file you are updating files and timestamps on disk.

o When you do a compilation of a solution, Visual Studio will check for updated assemblies from multiple disk path locations, write out multiple new assemblies to disk when the compilation is done.

o Along with the compilation, it also persist .pdb debugger symbol files on disk with them (all as separate file save operations).

o When you attach a debugger to a process (the default behavior when you press F5 to run an application), Visual Studio then needs to search and load the debugger symbols of all assemblies and DLLs for the application so as to setup breakpoints.

If you have a slow hard-drive, Visual Studio will end up being blocked as it waits for it to complete all of these read/write operations - which can really slow down your overall development experience.

Below are the few recommendations for Hard Drives.

Some laptop hard drive recommendations:

· The default hard drive speed for most PC laptops is typically 5400rpm - which is a pretty slow drive.

· If you are getting a new laptop and plan to use Visual Studio on it, I highly recommend making sure you get a 7200rpm drive instead. You will realize a significant performance benefit by doing this.

· If you’re Laptop has 5400rpm then, put an additional $55 (Lenovo), $93 (Dell) or $200 (Apple) to upgrade the hard drive to be a 7200rpm disk instead.

· Putting this small amount of extra money in the faster disk can really make a big performance difference and is an absolutely worthwhile investment.

Some desktop machine hard drive recommendations

Scott - Two hard drive performance considerations to consider with desktop configurations:

· Consider getting a 10,000rpm hard drive. These are lightening fast and can make a big difference over the default 7,200rpm drives that typically come with desktops.

· Consider buying a second physical hard drive and setup your operating system and OS virtual memory swap file to use one of the physical drives, and then store all your data (images, documents and Visual Studio projects) on the second physical drive. The benefit of an approach like this is that your read/write data operations won't be competing for disk I/O activity with the operating system updating the virtual memory file.

See the article.

Thanks & Regards,

Arun Manglick || Tech Lead