in

ljusberg.se

Smöråkning

January 2006 - Posts

  • Transactional memory? Cool!

    Joe Duffy has written a short introduction to something I hadn't heard about before; Transactional memory. Basically, the idea is to implement some scheme for optimistic concurrency when doing things in-memory. I'm thinking this will be one of the things coming in C# 4.0! I mean, combine this with LINQ and.. well.. it'll be way cool!

    Posted Jan 16 2006, 10:09 AM by anders with no comments
    Filed under:
  • Project references in GAT

    Yesterday I spent more or less the entire day trying to figure out how to add references between projects while unfolding a solution template. Turns out it was wasn't that tricky once you get the hang of GAT... Here's a step-by-step instruction:

    1. Add new arguments for the complete name of each project in the CreateSolution recipe:
      <Arguments>
      <Argument Name="BaseNamespace">
      <Converter Type="Microsoft.Practices.RecipeFramework.Library.Converters.NamespaceStringConverter, Microsoft.Practices.RecipeFramework.Library"/>
      </Argument>
      <Argument Name="ServiceName" Type="System.String"/>
      <Argument Name="RootNamespace">
      <Converter Type="Microsoft.Practices.RecipeFramework.Library.Converters.NamespaceStringConverter, Microsoft.Practices.RecipeFramework.Library"/>
      <ValueProvider Type="Evaluator"
      Expression="$(BaseNamespace).$(ServiceName)">
      <MonitorArgument Name="ServiceName" />
      <MonitorArgument Name="BaseNamespace" />
      </ValueProvider>
      </Argument>
      <Argument Name="BusinessEntitiesProjectName">
      <ValueProvider Type="Evaluator"
      Expression="$(RootNamespace).BusinessEntities">
      <MonitorArgument Name="RootNamespace" />
      </ValueProvider>
      </Argument>
      <Argument Name="DataAccessProjectName">
      <ValueProvider Type="Evaluator"
      Expression="$(RootNamespace).DataAccess">
      <MonitorArgument Name="RootNamespace" />
      </ValueProvider>
      </Argument>
      ...
      </Arguments>
      As you can see, the project names are created automatically when specifying a root namespace and a service name - but that isn't necessary for the solution to work.
    2. In the Solution.vstemplate file, make sure to pass the arguments on as custom parameters:
      <TemplateContent>
      <ProjectCollection>
      <ProjectTemplateLink ProjectName="$BusinessEntitiesProjectName$">Projects\BusinessEntities\BusinessEntities.vstemplate</ProjectTemplateLink>
      <ProjectTemplateLink ProjectName="$DataAccessProjectName$">Projects\DataAccess\DataAccess.vstemplate</ProjectTemplateLink>
      </ProjectCollection>
      <CustomParameters>
      <CustomParameter Name="$BusinessEntitiesProjectName$" Value="$BusinessEntitiesProjectName$"/>
      <CustomParameter Name="$DataAccessProjectName$" Value="$DataAccessProjectName$"/>
      </CustomParameters>
      </TemplateContent>
    3. Do the same for each project .vstemplate file:
      <CustomParameters>
      <CustomParameter Name="$businessentitiesprojectname$" Value="$BusinessEntitiesProjectName$"/>
      <CustomParameter Name="$dataaccessprojectname$" Value="$DataAccessProjectName$"/>
    4. And finally, in the project where you want to add a reference, put a new ItemGroup that looks like this:
      <ItemGroup>
      <ProjectReference Include="..\$businessentitiesprojectname$\$businessentitiesprojectname$.csproj">
      <Name>$businessentitiesprojectname$</Name>
      </ProjectReference>
      </ItemGroup>

    Oh, and there is an added bonus. If you use the same namespace names as project names, you can put things like this in any pre-generated content:

    using $businessentitiesprojectname$;
  • The pain of Guidance Automation Toolkit

    I'm telling you, writing guidance packages using GAT can be infinitely frustrating! At least on my rather slow laptop with a measly 1 Gb of RAM. Why is that, you might ask yourself? Well, here's the process you use when finding errors in a package:

    1. Rebuild your package (about 45 seconds)
    2. Register your package (about 90 seconds)
    3. Open a new Visual Studio 2005 instance (about 30 seconds)
    4. Create a solution using your new package (about 30 seconds)
    5. Realize that you've made yet another stupid mistake (less than 1 second)
    6. Shut down the new Visual Studio instance (10 seconds)
    7. Fix the bug (a second or two)
    8. Repeat

    Sure, it might not sound that bad, but remember that there is hardly any compile-time checking going on here and I'm making tons of spelling errors and other stuff that would usually be caught by the compiler. This is going to take me the rest of the week.. Easily..

    Posted Jan 04 2006, 02:54 PM by anders
    Filed under: ,
  • GAT again

    My last post was about the Guidance Automation Toolkit from the P&P team. Well, I've spent a couple of hours trying to wrap my head around it and I have to admit I'm quite overwhelmed. It is very well structured and the possibilities are endless, but the amount of XML files and other stuff is equally endless.

    Oh well, I love a good challenge..!

Powered by Community Server (Non-Commercial Edition), by Telligent Systems