Posts tagged with visual-studio - page 2

Experimental LINQ to SQL template

A newer version of this LINQ to SQL template is available.

While SQLMetal does a good job of turning your SQL schema into a set of classes for you it doesn’t let you customize the code generation process.

Usefully there is now a templating system built into Visual Studio 2008 called Text Templates (T4 for short).

Here is a short (369 line) experimental proof-of-concept T4 template I wrote last night that will generate a data context and associated entity classes as a starting point similar to that produced by SQLMetal.

Download of this old version no longer available, see the newer article!

Once downloaded unzip and drop the DataContext.cs.tt into your project and edit line 17 to set the connection string. You can also edit lines 18 and 19 to set the namespace and class name. The lightweight wrappers around database, table and column can be found at the end of the file – they simply wrap the SQL Server Information_Schema views as briefly as possible.

Within seconds Visual Studio should have created a code-behind file for the DataContext named DataContext.cs.cs with your generated code ready to use :) If you don’t like the way the template generates your context you can change it :)

There are limitations with this experimental proof-of-concept including: </p>
  • Processes all and only tables in the database (no views or SP’s)
  • Foreign-key relationships are not implemented
  • Column attributes for IsDbGenerated, UpdateCheck and AutoSync not implemented
  • C# only (sorry Julie)
  • Plural and singular naming rules are incomplete
  • Can’t modify schema as you could with a designer stage
To learn more about T4: </p>

[)amien

Visual Studio, Windows Server and SQL Server 2008 launch in Guernsey

The various Heroes Happen Here community events in the UK/USA to celebrate the launch of Visual Studio 2008 etc. made me envious that we don’t get such events and goodies here on the little island of Guernsey so I thought I’d so something about it!

We at the Guernsey Software Developer Forum are hosting a community event in conjunction with Microsoft to celebrate the launch of Visual Studio 2008, Windows Server 2008 and SQL Server 2008.

The event starts at 6:30pm on March 27th (next Thursday) at La Rocquettes hotel in St. Peter Port, Guernsey.

We will be giving away a bunch of goodies including the Heroes Happen Here launch packs with promotional copies of Visual Studio 2008 Standard, Windows 2008 Enterprise Server and SQL Server 2008 Developer as well as demonstrating some of the new features of Visual Studio 2008 and .NET 3.5.

I’m hoping this event will be bigger than normal GSDF events given the cool stuff we are giving away and the interest from non-developers in Windows 2008 and SQL Server 2008 so tell your friends (if you’re in Guernsey of course)

[)amien

Future of AnkhSVN (Subversion for Visual Studio)

AnkhSVN 2.0 is now out with the majority of these features making the cut!

Now that AnkhSVN 1.0.3 is out with support for Visual Studio 2008 we can discuss our future plans for AnkhSVN.

We have moved over to openCollabNet and welcomed Jeremy Whitlock and Bert Huijben to the team!

Our preliminary road-map for AnkhSVN 2.0 is:

  • Improve user experience
  • Refine windows, options and icons
  • Localize dialogs and messages
  • Support customization of icons & menus
  • Develop interactive log window
  • Add keyboard support (short cuts & tab order)
  • Extend integration
  • Subversion 1.5 branch & merge tracking
  • Subversion property editing
  • Visual Studio 2005/2008 source provider model for better integration
  • Foster developer participation
  • Simplify build environment with MSBuild
  • Reduce code-base with SharpSvn
  • Switch Visual Studio API from automation to source control
  • Provide source-on-demand using Sourceserver

Switching the provider model means we have to drop Visual Studio 2003 support for 2.0 but means we get to use .NET 2.0+ features as well as a much faster and more robust mechanism for extending Visual Studio.

The timetable is quite aggressive and I’m hoping we can get quick regular builds out for people to try.

[)amien

Web site vs web application in Visual Studio

Rob Conery got me thinking about web site maintenance and I put forward a brief comment on the two distinct types and how Visual Studio handles them which I have expanded upon here.

Web site

Primarily for working with ad-hoc web sites that have programmed elements. Easily identified by customer-specific content present in aspx files.

No solution or project files are required and the pages and source can reside locally (file system, IIS) or remotely (FTP, WebDev/FrontPage extensions) via the File > Open > Web Site… menu option.

Code-behind and classes are typically stored on the web server which compiles them in-memory on demand. Changes can be made to the files without restarting the application and losing sessions.

For Against
Quick edit, test, deploy cycle Syntax errors at run-time
No need to compile or restart app Can’t create an installer
Source always available Source on server useful to hackers

Web application

Web application projects were introduced as an add-on for Visual Studio 2005, later rolled in to VS 2005 SP1 and made a full first-class citizen with Visual Studio 2008.

Like the name implies these are primarily for web applications, those times when you have written a product or solution that happens to have a web interface.

Web application projects exist on your local drive and are treated like any other VS project type and can be added to existing solutions are subject to full compilation, validation and build steps.

Deployment is typically via MSI installers however you can also utilize the addition Web Deployment Projects add-in which allows you to deployment directly to servers which is useful for deploying to test environments.

For Against
Controlled build & deploy process Deployment causes application restart
No class files on web server, dll only Can’t deploy individual classes
Syntax errors at compile time

Hybrid

Sander and I were discussing this article and thought an interesting solution might be to use the Web Application model for local development but to use the Publish option to publish all solution files to an intermediate directory.

Then in the intermediate directory just remove the bin/applicationname.dll file and copy to the target. This should prevent an application restart unless the web.config or global.asax/global.asax.vb files have been modified.

[)amien