Monday, November 16, 2009

Dynamic types in any application?

WorldCreator a module designed to work with Xaf can really work without it!!!!

Suppose you have a non xaf application and you use Xpo as your dataLayer and you want dynamic types then WorldCreator can for sure help you.

You just reference WorldCreator and eXpand.BaseImpl assemblies and use an approach similar to the specs bellow

public void Can_Create_Types_In_A_Non_Xaf_Context() {
    new PersistentClassInfo(Session.DefaultSession){Name = "Test"}.Save();
    var typeCreator =
        new TypeCreator(
            new TypesInfo(new List<Type> {
                                             typeof (PersistentClassInfo),
                                             typeof (ExtendedCollectionMemberInfo),
                                             typeof (ExtendedReferenceMemberInfo),
                                             typeof (ExtendedCoreTypeMemberInfo),
                                             typeof (InterfaceInfo)
                                         }), new UnitOfWork(Session.DefaultSession.DataLayer));

    Type dynamicModule = typeCreator.GetDynamicModule();

    Assert.IsNotNull(dynamicModule.Assembly.GetTypes().Where(type => type.Name=="Test").FirstOrDefault());
Technorati Tags: ,

Subscribe to XAF feed
Subscribe to community feed

blog comments powered by Disqus