Archive

Archive for March, 2008

CRUD to the GUI – VS2008 v CodeSmith


ASP.NET 3.5 Extensions is really delivering the good stuff.

The screencast here has to be the best I have seen in that it is concise and to the point to the extreme.

Awesome.

Advertisements
Categories: New Posts

Running a service as an application (or v.v)


public static void Main(string[] args)
{
//If ‘ApplicationMode’ argument was passed then run as a windows application otherwise run as a Windows service.
if (args.Length > 0)
{
foreach (string currentArg in args)
{
if (String.Compare(currentArg, “-applicationmode”, true, CultureInfo.InvariantCulture) == 0)
{
_runningAsService = false;
}
}
}

_exceptionHandler = new ExceptionHandler(_runningAsService, SR.ServiceMainName);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(_exceptionHandler.OnUnhandledException);

if (_runningAsService)
{
//Service
System.ServiceProcess.ServiceBase[] ServicesToRun = new System.ServiceProcess.ServiceBase[] { new DispatchService() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}
else
{
//Windows Application
System.Windows.Forms.Form applicationForm = new ApplicationModeForm();
System.Windows.Forms.Application.Run(applicationForm);
}
}

Categories: C# Code Comments

Starter Kits


Starter kits are a great place to…

For me, using an ecommerce starter kit means I don’t have to concern myself with writing the code that takes money from my paying customers – by Visa, Mastercard, PayPal etc.

Hmm … now I just have to get some paying customers!

Categories: C# Code Comments

DiskData


Daniel B just mentioned “DiskData” that has been around since asp was hot stuff and dinosaurs (like me) roamed the planet.

The latest versions are shareware but earlier versions are still free.

BTW Using the word free will probably quadruple the number of visitors to this site (taking it up to 4 for the week)

Categories: New Posts

Setting your Default Browser in VS2005 +


Stolen form Scott Guthries site (my current hero)

1) Right click on a .aspx page in your solution explorer

2) Select the “browse with” context menu option

3) In the dialog you can select or add a browser. If you want Firefox in the list, click “add” and point to the firefox.exe filename

4) Click the “Set as Default” button to make this the default browser when you run any page on the site.

Categories: New Posts

The DAL, LINQ and where to next


In developing software we endeavor to follow the SOA or “Service-Oriented Architecture” approach. SOA is an approach one might take as opposed to mindlessly writing code to meet an end objective. SOA allows orienting our design towards interoperability and reuse. The main concepts of SOA are:

Reuse and composition: Share modules between applications and inter-application interchanges.

Permanence: Support current and future technologies.

Flexibility: Ensure applications can be enriched with new modules to answer new business needs.

Openness and interoperability: Enable modules to be shared between platforms and environments.

Distribution: Enable modules to be remotely accessed so that they can be centralized

Performance: Ensure scalability.

The new challenge is to incorporate LINQ and Entities into this philosophy BUT without creating the bloatware we see in implementations like Model – View – Presenter.

The DAL and LINQ

The use of the Data Access Layer and our traditional approach must now be questioned with the emergence of LINQ. We could say that LINQ itself is the DAL – but have a problem with this approach in that we may not wish choose to use LINQ for data access i.e. the data access technology should not be visible to the upper layers.
The discussion continues … perhaps this approach LINQ to SQL

There are some good web references to LINQ but Scott Allen has managed to bundle all the new technologies in one small demo application

Categories: Ramblings

Visual Studio Go Faster Techniques


The trick of the year supplied by Paul is to drag code from your active cs (or vb) page into the Toolbox sidebar. This is far better than using the snippets feature that VS supplies yet, as far as I can see, is not a widely known super feature.

The snippets seemed great when VS was released (just right click on a coding surface and select one) but having your superior custom code available in the Toolbox is the bees knees.

Another performance trick (if somewhat obvious) is to add debug and view windows as tabs at the bottom of the development page. For example:

    Immediates Window
    Call Stack
    Breakpoints
    Pending Checkins
    Watch1
    FindResults1

To achieve this in VS2005+, right click on each window to make them dockable then drag the window down to the bottom status bar. Use Auto Hide to keep tidy.

Here is a way to speed things up by using shortcut keys.

Categories: C# Code Comments