# Wednesday, August 09, 2006

I'm currently helping a customer to migrate a *really large* web application from ASP.NET 1.1 to 2.0 (round about 130 projects in the master solution...).

I always liked FxCop but enabling "Code Analysis" manually is way to complicated (or not geekish enough?!?). So I wrote this small macro this morning.

Imports System

Imports System.Diagnostics

Imports System.Text

Imports System.Windows.Forms

 

Imports EnvDTE

Imports EnvDTE80

 

Public Module CodeAnalysis

 

    Public Sub EnableFxCop()

        Dim objProj As Object()

        Dim proj As Project

 

        For i As Integer = 1 To DTE.Solution.Projects.Count

            proj = DTE.Solution.Projects.Item(i)

            EnableFxCop(proj)

        Next

    End Sub

 

    Private Sub EnableFxCop(ByVal project As Project)

 

        If project.Kind = "{66A26720-8FB5-11D2-AA7E-00C04F688DDE}" Then

            'Filter Project Folders

            For Each subProject As ProjectItem In project.ProjectItems

                EnableFxCop(subProject.SubProject)

            Next

        Else

            project.ConfigurationManager.ActiveConfiguration.Properties.Item( _

                "RunCodeAnalysis").Value = "True"

 

            project.ConfigurationManager.ActiveConfiguration.Properties.Item( _

                "CodeAnalysisRules").Value = String.Concat( _

                    "-Microsoft.Design#CA2210;", _

                    "-Microsoft.Design#CA1020;", _

                    "-Microsoft.Naming#CA1705;", _

                    "-Microsoft.Naming#CA1709")

            project.Save()

        End If

    End Sub

End Module

Wednesday, August 09, 2006 2:50:21 PM (W. Europe Daylight Time, UTC+02:00)  #    Disclaimer  |  Comments [2]  | 
# Monday, July 17, 2006

thinktecture and newtelligence AG present a week of Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF) and Windows Workflow Foundation (WWF): TornadoCamp WinFX.

Christian, Ingo, Michael and me will present from the 16th - 20th of october in Bad Ems in GERMAN!

C# | Event | Indigo | WCF
Monday, July 17, 2006 1:57:23 PM (W. Europe Daylight Time, UTC+02:00)  #    Disclaimer  |  Comments [0]  | 

I posted some Bits Michael and I wrote recently in a WCF Project:

The Constraints-Extensions let you easily define attribute based limitations for input, output and return parameters. Limitations can be set to service contracts operations as well as to data contract data member implementations. The constraints validation gets called at runtime by the WCF infrastructure and the behavior will throw a ConstraintViolationException with descriptive messages in case of a constraint gets violated/the validation fails.

The following constraint attributes have been implemented:

  • Between
  • BetweenExclusive
  • CompareAgainst
  • EarlierThanNow
  • EarlierThanToday
  • EqualTo
  • GreaterEqualTo
  • GreaterThan
  • LaterThanNow
  • LaterThanToday
  • LessEqualTo
  • LessThan
  • Match
  • MaxElements
  • MaxLength
  • MinElements
  • MinLength
  • NotBetween
  • NotEmpty
  • NotEqualTo
  • NotNull
  • Nullable
  • OneOffยท    

Data Contract Sample:

[DataContract]
class
TestClass
{
    [DataMember]
    [LessEqualTo(CompareAgainst.FieldOrProperty,"EndDate")]
    public DateTime StartDate;

    [DataMember]
    [GreaterEqualTo(CompareAgainst.FieldOrProperty, "StartDate")]
    public DateTime EndDate;

    public TestClass(DateTime startDate, DateTime endDate)
    {
        StartDate = startDate;
        EndDate = endDate;
    }
}

 

Service Contract Sample:

[ServiceContract, ConstraintsValidatorBehavior]
interface
ITestConstraints
{

    [OperationContract]
    [return:GreaterEqualTo(0)]
    int MethodA(
        [Between(0,100)]
        int a,
        [LessEqualTo(20)]
        double b,
        [NotEmpty]
        string c); 

    [OperationContract]
    int MethodB(
        [Between(0, 100)]
        int a,
        [LessEqualTo(20)]
        ref double b,
        [NotEmpty]
        out string c);

    [OperationContract]
    [return:LaterThanNow]
    DateTime MethodC(
        [GreaterThan(0)]
        int a);

 

    [OperationContract]
    void MethodD(
        [VerifyObject]
        TestClass a);
}


Download at wcf.netfx3.com

C# | Indigo | Projects | WebServices | WCF
Monday, July 17, 2006 1:43:28 PM (W. Europe Daylight Time, UTC+02:00)  #    Disclaimer  |  Comments [1]  | 
# Tuesday, June 06, 2006

Developer day[1] (DDD) in Reading (U.K.) was again really a great experience. My talk together with Michael[2] went fine and we really enjoyed the great audience. And the weather was sooooo sunny - unbelievable.

It was nice to meet Melita Walton, Craig Murphy[3], Benjamin Mitchel[4], Ian Cooper, Phil Winstanley (Plip)[5], Dave Sussman[6], Guy Smith-Ferrier[7] and so on.

Take a look at the pics Plip posted http://www.flickr.com/photos/plip/sets/72157594154434387/

[1] http://www.developerday.co.uk/ddd/
[2] http://staff.newtelligence.net/michaelw/
[3] http://www.craigmurphy.com/
[4] http://benjaminm.net/
[5] http://weblogs.asp.net/plip/
[6] http://aspadvice.com/blogs/dsussman/
[7] http://www.guysmithferrier.com/

Tuesday, June 06, 2006 9:50:38 AM (W. Europe Daylight Time, UTC+02:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, May 16, 2006

Two tools really useful if you work with AJAX

ASP.NET | C#
Tuesday, May 16, 2006 2:04:19 PM (W. Europe Daylight Time, UTC+02:00)  #    Disclaimer  |  Comments [0]  |