SBD.Cashbook - Part One

working-out-loud

#1

Today I am working out loud on SBD.Cashflow.using XAF, Entity Framework Code FIrst

Here is the GitHub link
Here are my initial wizard choices.




image

The result is


#2

Now for the data structures
Ah pushed them.
Better add a license MIT

Upgrade to EF 6.2

(I have asked for DX to fix that bit.


#3

Right Click the Win project and set as Start Up


#4

I ran the app and messed about with data entry for a bit.
Then re-designed the business model somewhat.

Now for migrations


#5

Uh, Uh I am going to need validations, I wonder what goes where?

Ah actually they are already installed!

I want a rule that if a GLAccount has a parent GLAccount then they must have the same category.

I better consult the Validation Rules Help.

Here we go


#6

A bit of a play with the app

Let’s add a filter combo for the GLAccounts using this way.

Adding some conditions

Causes these filters to be available


#7

OK, I forgot to add reports, so lets drag them on to the win application

this looks better
image

I need to do it for each module though.
So for the Module.Win

becomes
image

and for reports module [ LATER NOTE I DO THE WRONG THING HERE… I should have used ReportsModuleV2… watch how I troubleshoot my mistake ]
image

I add the data type to the dbcontext

     public DbSet<ReportDataV2> ReportDataV2s { get; set; }

Also I need the [VisibleInReports] attribute on the classes I want to report on

image

and that means I need to run Migrations again

Oops I missed something

image

Cannot find the 'DevExpress.Persistent.BaseImpl.ReportData' type or 'DevExpress.Persistent.BaseImpl.v18.2' assembly.

   at DevExpress.ExpressApp.Reports.ReportsModule.FindDefaultReportDataType()
   at DevExpress.ExpressApp.Reports.ReportsModule.GetDeclaredExportedTypes()
   at DevExpress.ExpressApp.ModuleBase.GetExportedTypes()
   at DevExpress.ExpressApp.ApplicationModulesManager.CollectDomainComponents()
   at DevExpress.ExpressApp.ApplicationModulesManager.Load(ITypesInfo typesInfo, Boolean loadTypesInfo)
   at DevExpress.ExpressApp.XafApplication.Setup(String applicationName, IList`1 objectSpaceProviders, ApplicationModulesManager modulesManager, ISecurityStrategyBase security)
   at DevExpress.ExpressApp.XafApplication.Setup()
   at SBD.Cashbook.Win.Program.Main() in D:\dev\SBD.Cashbook\SBD.Cashbook.Win\Program.cs:line 45

Adding to the Middle tier module
image


#8

Time for the sledge hammer


#9

I am going to create a new solution with reports so I can study where things went wrong.

Text search shows the following mentions

Find all "ReportDataV2", Subfolders, Find Results 1, Entire Solution, ""
  D:\dev\thing4\things4.Module\BusinessObjects\things4DbContext.cs(24):		public DbSet<ReportDataV2> ReportDataV2 { get; set; }
  D:\dev\thing4\things4.Module\Model.DesignedDiffs.xafml(4):    <DetailView Id="ReportDataV2_DetailView">
  D:\dev\thing4\things4.Module\Model.DesignedDiffs.xafml(8):            <LayoutGroup Id="ReportDataV2" >
  D:\dev\thing4\things4.Module\Module.cs(47):            reportModule.ReportDataType = typeof(DevExpress.Persistent.BaseImpl.EF.ReportDataV2);
  D:\dev\thing4\things4.Win\WinApplication.Designer.cs(38):            this.reportsModuleV2.ReportDataType = typeof(DevExpress.Persistent.BaseImpl.EF.ReportDataV2);
  Matching lines: 5    Matching files: 4    Total files searched: 40

comparing with the main project …
oops, lets fix the dataset name

 public DbSet<ReportDataV2> ReportDataV2 { get; set; }

Ah quite a bit missing

Find all "ReportDataV2", Subfolders, Find Results 1, Entire Solution, ""
  D:\dev\SBD.Cashbook\SBD.Cashbook.Module\BusinessObjects\CashbookDbContext.cs(36):        public DbSet<ReportDataV2> ReportDataV2 { get; set; }
  D:\dev\SBD.Cashbook\SBD.Cashbook.Module\Migrations\201901030327288_two.cs(11):                "dbo.ReportDataV2",
  D:\dev\SBD.Cashbook\SBD.Cashbook.Module\Migrations\201901030327288_two.cs(28):            DropTable("dbo.ReportDataV2");
  Matching lines: 3    Matching files: 2    Total files searched: 58

Actually I need to copy the whole Setup method because my Cashbook project is using

 public override void Setup(XafApplication application) {
            base.Setup(application);
           

            // Manage various aspects of the application UI and behavior at the module level.
        }

[NOTE THE DIFFERENT TYPE FOR THE PARAMETER]

Another thing I notice is that my Module class does not have validation… better add that

image

And in my WinModule I added a type I did not need
image


#10

Now I can add Reports


#11

I could go on making the data entry screens nice, but the next technical challenge I want to tackle is now to get the connection string to come from Azure Key Vault… sounds like a new topic.