Wednesday, April 29, 2009
Extension methods
Imho: Extension methods should reside in the same namespace as the class they are extending (even if that namespace belongs to the .Net framework or a 3rd. party vendor.) This is the easiest way to keep functionality discoverable in a large solution.
Tuesday, April 28, 2009
Shortcut your environment
The last few months I've spent a conscious effort to speed up my development. I have used resharper since version 1.5 (i think...) but have only recently found a lot of nifty stuff in it here's my favourites:
I have also used True Launch Bar for my quick menu for a long time.
having all programs I need categorized for easy access, but I started
creating shortcuts for all the relevant folders on all the relevant machines, and that's sped me up quite a bit also. To see the folder where the web project is deployed in the build environment I hover the folder icon on the toolbar which pops up a list of environments, and drill my way in like that, all the icons are easily recognizable ( i set them myself) so to find any relevant place on any environment takes me < .5 secs.
Oh, did I mention I put a shortcut to the hosts-file in there also for each machine?
I cannot recommend TrueLaunchBar.com enough. takes about an hour to set up the way I want it, but it's totally worth it
- ctrl + n = goto type (classes)
- ctrl + shift + n = goto file (web.config / language files / aspx / ...)
- Capitalized shortform (I write CMSG and r# suggests CustomerManagementServiceGateway (a class in our project) to me
I have also used True Launch Bar for my quick menu for a long time.
having all programs I need categorized for easy access, but I started
creating shortcuts for all the relevant folders on all the relevant machines, and that's sped me up quite a bit also. To see the folder where the web project is deployed in the build environment I hover the folder icon on the toolbar which pops up a list of environments, and drill my way in like that, all the icons are easily recognizable ( i set them myself) so to find any relevant place on any environment takes me < .5 secs.
Oh, did I mention I put a shortcut to the hosts-file in there also for each machine?
I cannot recommend TrueLaunchBar.com enough. takes about an hour to set up the way I want it, but it's totally worth it
Monday, April 27, 2009
Tiny drips of Asp.Net juice
long time no see,
I've been a busy little bee working on a fairly large web site for online gambling (horse races), with some SERIOUSLY cool software/frameworks. Going from the outside in it's been jQuery, EPiServer 5, Asp.Net 3.5, WCF, SOA, NHibernate. And I have learned more from this project than any other. I'm going to publish reference code (for my own later googling pleasure) from this project for quite a while I reckon. I'm starting easy with some webcontrols we have used throughout the solution. using our own has made it possible to enable/utilize jQuery very easily.
to ensure the ID of controls are fixed, we have used this little trick:
This enables us to be certain that the jQuery selectors all work as expected
similarly we have overridden labels/buttons/etc to enable us to give the webcontrols a TextKey property (e.g. TextKey="/app/game/gamewindow/buygame" ) declaratively, the TextKey is then used to lookup the correct text from the Translate function in EPiServer
As these are all just Custom Controls (no code-front file) we can specify their namespace in web.config:
I've been a busy little bee working on a fairly large web site for online gambling (horse races), with some SERIOUSLY cool software/frameworks. Going from the outside in it's been jQuery, EPiServer 5, Asp.Net 3.5, WCF, SOA, NHibernate. And I have learned more from this project than any other. I'm going to publish reference code (for my own later googling pleasure) from this project for quite a while I reckon. I'm starting easy with some webcontrols we have used throughout the solution. using our own has made it possible to enable/utilize jQuery very easily.
to ensure the ID of controls are fixed, we have used this little trick:
public class ClientIdHiddenField: HiddenField
{ public override string ClientID{ get{ return ID; } }
}
This enables us to be certain that the jQuery selectors all work as expected
similarly we have overridden labels/buttons/etc to enable us to give the webcontrols a TextKey property (e.g. TextKey="/app/game/gamewindow/buygame" ) declaratively, the TextKey is then used to lookup the correct text from the Translate function in EPiServer
public class TranslateButton: Button
{
[DefaultValue("")]public string TextKey{ get; set; }
protected override void OnPreRender(EventArgs e){
if (!string.IsNullOrEmpty(TextKey) && string.IsNullOrEmpty(Text)){
Text = LanguageUtil.TranslateOrBlank(TextKey);}
base.OnPreRender(e);
}
}
As these are all just Custom Controls (no code-front file) we can specify their namespace in web.config:
[pages validateRequest="false" enableEventValidation="false"]
(couldn't get < to work properly in markup here ...)
[controls]
...........
[add tagPrefix="cc" namespace="OurNamespace.CommonUC" assembly="OurAssemblies.Web" /]
[controls]
[pages]
Subscribe to:
Posts (Atom)