Monday, February 8, 2010

Developing data analysis objects with the help of IO module

After creating PivotingChart Module I was able to really control the fluent DevExpress Pivot grid options at runtime and design more complex analysis pivoting UI writing no code and save all that “configuration” at the same database record as the analysis object.

But I was still developing inside my VS and since my model was not stable yet I continuous drop the database using the DxCore addin to drop database at design time which by the way have been updated to support multiple datastores

image

and damn I lose the designed analysis UI cause it was stored in the database

Time for some IO module use

I could export my analysis objects

image

and use the following import to load the configured objects at application start up

from an embedded resource

public class Updater : ModuleUpdater

{

    public Updater(Session session, Version currentDBVersion) : base(session, currentDBVersion) { }

    public override void UpdateDatabaseAfterUpdateSchema()

    {

        base.UpdateDatabaseAfterUpdateSchema();

        var unitOfWork = new UnitOfWork(Session.DataLayer);

        new ImportEngine().ImportObjects(unitOfWork,GetType(), "Resources.Analysis.xml");

        unitOfWork.CommitChanges();

    }

}

or from a file on your disk

public class Updater : ModuleUpdater

{

    public Updater(Session session, Version currentDBVersion) : base(session, currentDBVersion) { }

    public override void UpdateDatabaseAfterUpdateSchema()

    {

        base.UpdateDatabaseAfterUpdateSchema();

        var unitOfWork = new UnitOfWork(Session.DataLayer);

        new ImportEngine().ImportObjects(unitOfWork, @"c:\Analysis.xml");

        unitOfWork.CommitChanges();

    }

}

Subscribe to XAF feed
Subscribe to community feed

DiggIt!
blog comments powered by Disqus