NAVmoble - the pocket-sized ERP
Optimized for Microsoft Dynamics NAV and Windows Mobile powered devices

Sunday, July 30, 2006

Sandcastle CTP is out/NDoc is dead!

Microsoft released July 2006 CTP of their Documentation Compilers For Managed Class Libraries. It is much like the NDoc Open Source Project

Sandcastle produces accurate, MSDN style, comprehensive documentation by reflecting over the source assemblies and optionally integrating XML Documentation Comments.

Sandcastle has the following key features:
  • Works with or without authored comments

  • Supports Generics and .NET Framework 2.0

  • Sandcastle has 2 main components (MrefBuilder and Build Assembler)

  • MrefBuilder generates reflection xml file for Build Assembler

  • Build Assembler includes syntax generation, transformation..etc

  • Sandcastle is used internally to build .Net Framework documentation

  • Sandcastle should provide support for XAML as well.



Recently Kevin Downs (the leader of NDoc) sent a mail to the NDoc community saying that NDoc is dead!. That was a cool project that I've used many times and never gave a donation at all! We all should reconsider our community involvement!

Get more details about Sandcastle and NDoc's death here at the Scott Hanselman's blog and The Sandcastle blog

Pictures from MS Dev Days 2006 Bulgaria

Martin has few pictures from Microsoft Dev Days 2006, published on his blog.

Thursday, July 27, 2006

Atlas to be released in .NET Framework 3.5

A guy named Alian said in his blog that hopefully Atlas will be released till the end of the year and will be released as a part of .NET Framework 3.5 (codename "Orcas"). Does it mean that we will have . NET Framework 3.5 after few months?
Hey, I've just started loosing with all these .NET framework releases

LLBLGen 2.0 - Implementing Entity Factory Mapper

We've just finished upgrading our current project to LLBLGen v2.0. It provides a lot new features including some .NET 2.0. goodies. One of these new stunning features is the support for generic entity collections. Our project involves development of ASP.NET based application framework, which needs to construct and fetch entity collection run-time (Adapter scenario).

The common pattern for doing this with LLBLGen 2.0 in the Adapter scenario is like this:

EntityCollection<CustomerEntity> customers = new EntityCollection<CustomerEntity>(new CustomerEntityFactory());
DataAccessAdapter adapter = new DataAccessAdapter();
adapter.FetchEntityCollection(customers);



We've got a class called DataAccessManager, which is intended to be used like this:
EnityCollection<CustomerEntity> customers = DataAccessManager.FetchEntityCollection<CustomerEntity>(null);

...and the implementation(simplified version):

   public static class DataAccessManager
  {
      ..
         public static EntityCollection FetchEntityCollection(IPredicateExpression expression) where T : EntityBase2
         {
            EntityCollection collection = new EntityCollection();
            Type factoryType = EntityFactoryMapper.GetFactoryType(typeof(T));
            IEntityFactory2 factory = (IEntityFactory2)Activator.CreateInstance(factoryType);
            collection.EntityFactoryToUse = factory;
            DataAccessAdapter adapter = new DataAccessAdapter(connectionString);
            adapter.FetchEntityCollection(collection,expression);
            return collection;
         }
   }


The problem in the upper implementation is that we haven't found "out of the box" mechanism to map EntityBase2 type to IEntityFactory implementation. So we've managed to generate such a class by adding a new LLBLGen template.

We wanted to have our mappign pattern like this:
Type t = typeof(CustomerEntity);
IEntityFactory2 entityFactoryType = EntityFactoryMapper.GetFactoryType(t);


and the implemenation like this(not quite elegant solution):

   public class EntityFactoryMapper
   {
      public static Type GetFactoryType(Type entityType)
      {
         if(entityType == typeof(CustomerEntity))
            return typeof(CustomerEntityFactory);
         else
            if(entityType == typeof(OrderEntity))
               return typeof(OrderEntityFactory);
                  else
                  ....


In order to this we've created a new template file:
[DEVICE]:\Program Files\Solutions Design\LLBLGen Pro v2.0\Templates\SharedTemplates\Net2.x\C#\FactoryMapper.template

and we've added the following lines :
using System;
namespace <[RootNamespace]>
{

///


//Entity-Type To EntityFactory Type mapper
///

using YourProjectNamespace.EntityClasses;
using YourProjectNamespace.FactoryClasses;

   public class EntityFactoryMapper
   {
      public static Type GetFactoryType(Type entityType)
      {
         <[Foreach Entity CrLf]>
         if(entityType == typeof(<[CurrentEntityName]>Entity))
            return typeof(<[CurrentEntityName]>EntityFactory);
         else
            <[NextForeach]>
               return null;
      }
   }
}

After generating the code again we've received our new class EntityFactoryMapper ready for usage

Monday, July 24, 2006

Microsoft published Device Emulator source

The V1 Device Emulator source code is released by Microsoft under a shared-source initiative.
You can compile the emulator yourself, using Visual Studio 2005, and either run it as a standalone Windows application, or use its COM self-registration code to make it the default DeviceEmulator on your PC (meaning launch it and use it from Visual Studio 2005 and the Device Emulator Manager). The Shared Source release does not include sources to the Device Emulator Manager application or to the ActiveSync-over-DMA code, both of which are present in binary form in the V1 release.


Download link