The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Possible template issue (unsure, sorry) with Beta III

Last post 06-17-2008, 11:30 AM by pritcham. 13 replies.
Sort Posts: Previous Next
  •  05-20-2008, 1:54 PM 9379

    Possible template issue (unsure, sorry) with Beta III

    Hi all

    I'm trying to generate code for a multi DB (platform) test project - one DB is MS Access, the other is VistaDB (3.21) and have successfully ran the generated/custom templates over my Access DB (although it did generate code that needed amending as the table names started with numbers and contained a dash "-" char - once I'd find/replaced the dashes and changed them to underscore chars all was good - worth noting though), however, whenever I try to run the "MetadataMap" template (tried both C# and VB versions) Mygeneration bombs out with a "NullReferenceException" - details below:

    Source: DotNetScriptingEngine

    Method: Void EngineExecuteCode(Zeus.IZeusCodeSegment, Zeus.IZeusContext)

    Line: 0, Column: 0

    Message: Object reference not set to an instance of an object.

    Stack Trace:

       at Zeus.DotNetScript.DotNetScriptExecutioner.EngineExecuteCode(IZeusCodeSegment segment, IZeusContext context)
       at Zeus.ZeusExecutioner.ExecuteCode(IZeusExecutionHelper helper, IZeusTemplate template, IZeusContext context, ArrayList templateGroupIds)
       at Zeus.ZeusExecutioner.ExecuteCodeSegment(IZeusCodeSegment segment, IZeusContext context)
       at Zeus.ZeusCodeSegment.Execute(IZeusContext context)
       at MyGeneration.TemplateForms.TemplateEditor._Execute()

    My first time with this type of issue (connection is fine and can see all tables in the VistaDB database) so apologies if this is a known issue.  FYI some of the tables begin with numbers in the name (i.e. "123 - table one name" is an example of a table name - this also creates problems on codegen but that's a separate issue - I think!)

    Cheers

    Martin

  •  05-20-2008, 3:05 PM 9383 in reply to 9379

    Re: Possible template issue (unsure, sorry) with Beta III

    As for the tables beginning with numbers, I've never even heard of that, didn't know any database systems allowed that? Or perhaps it just never occurred to me. You should be able to add that to the "Trim List" in the Setting template. You didn't say what version of es you are using, is it ES2008 ? what beta.

    I generated Metadata maps just the other night for the Indy ALT.NET conference, try generating them against another database, it could be a VistaDB thing as that provider is a plugin for code generation. 


    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  05-20-2008, 3:15 PM 9385 in reply to 9383

    Re: Possible template issue (unsure, sorry) with Beta III

    Hi Mike

    Sorry - yes, it's ES2008 latest beta (version 3 I think?) - the db isn't one designed by me but there are a lot of tables where the table name begins with a number (Access 2003 but the DB has also been converted to VistaDB aswell) - I'll try amending the Trim list and regenning - won't be until tomorrow evening now so I'll post after then

     

    Cheers

    Martin

  •  05-20-2008, 3:22 PM 9386 in reply to 9385

    Re: Possible template issue (unsure, sorry) with Beta III

    Okay, Beta IV is out by the way with LINQ support and more.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  05-20-2008, 7:10 PM 9389 in reply to 9386

    Re: Possible template issue (unsure, sorry) with Beta III

    The default TrimList should already be removing spaces, dots, and dashes:

    Code:
    <esSetting Name="TrimList" Value=" .-" />

    Running the ES2008 Generated Master using MyGen 1.2.0.7 against an Access table named "123-Table" produced classes like this:

    Code:
    public partial class 123Table : es123Table

    This is from the generated Access MetadataMap:

    Code:
    public partial class 123TableMetadata : esMetadata, IMetadata
    ...
    meta.Source = "123-Table"; //***** the actual table name *****
    meta.Destination = "123-Table";

    David Neal Parsons
    www.entityspaces.net
  •  05-23-2008, 9:38 AM 9420 in reply to 9389

    Re: Possible template issue (unsure, sorry) with Beta III

    Hi

    I've just had a chance to look at this again and am still experiencing problems getting anything generated against a VistaDB database using ES v2008.0.0518.0 (sorry, can't remember what Beta this is).

    Steps I've folllowed:

    1) I've ran ES v2007.1.1119.0 against a copy of Northwind db (VistaDB v3.2) to check whether it works - no problem running any of the old ES templates against it, code gens fine.

    2) Tried to run any of the ES v2008.0.0518 templates against the same DB, same connection info, MyGen bombs out with a "NullReferenceException" as described above - the only thing I can think of as I'm using the same version of MyGen (1.2) to run the templates is that it must be something to do with the new Metadataprovider?

    Any ideas folks? (Not checked the issue with tables named with numbers again yet, still trying to get to the codegen stage against the VistaDB first)

    Cheers

    Martin

    2008.0.0518.0

  •  05-23-2008, 9:45 AM 9421 in reply to 9420

    Re: Possible template issue (unsure, sorry) with Beta III

    Yes, the VistaDB plugin for our esMetadataEngine assembly is bound to 3.57 (Build 57) of VistaDB. The release candidate for ES2008 will ship with the source for the esMetadataEngine plugin for VistaDB so you can recompile it for your version. My guess is that this is the issue.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  05-23-2008, 9:52 AM 9422 in reply to 9421

    Re: Possible template issue (unsure, sorry) with Beta III

    Sounds like that could be the issue Mike, I'll hang fire on the VistaDB code and carry working with the app - I can always plug the Vdb version in later (God I love how easy ES makes that!)

    BTW, separate issue but just wondered whether you could post any info on how the recent ES meet/demo went?

    Cheers

    Martin

  •  05-26-2008, 9:28 AM 9466 in reply to 9389

    Re: Possible template issue (unsure, sorry) with Beta III

    Hi

    Just as a follow on to this I have reran the templates against the Access DB containing tables with names like "123 - stock table" etc and it still produced code without the dashes stripped out - then I ran the "Settings" template, with the defaults selected, and this fixed the issue, so it appears I needed to run this Settings template in order for this to work properly, don't recall reading that in the release notes for the beta (but apologies if it's there!)

    Cheers

    Martin

  •  05-26-2008, 11:26 AM 9469 in reply to 9466

    Re: Possible template issue (unsure, sorry) with Beta III

    Is this happening for CodeSmith, MyGeneration 1.2, or MyGeneration 1.3?
    David Neal Parsons
    www.entityspaces.net
  •  05-26-2008, 12:20 PM 9473 in reply to 9469

    Re: Possible template issue (unsure, sorry) with Beta III

    Hi David

    It happened in MyGen 1.2, for sure, can't remember whether it happened in Codesmith.  The issue of " - " getting replaced/stripped got solved once I'd run the "Settings" template though (although the generated code still didn't compile as .Net doesn't like classes starting with a number - unfortunately if I add numbers to the Trim list then this doesn't work either as duplicate files would get generated (which means one file gets overwritten with another) - unfortunately I can't post the DDL scripts for the tables as they are confidential to the company so I'll have to see if I can re-create the situation with similar tables etc - I'll post back when I've come up with something suitable (although I'm certain it's a fringe case for you so not urgent don't worry)

    Cheers

    Martin

  •  05-26-2008, 3:15 PM 9475 in reply to 9473

    Re: Possible template issue (unsure, sorry) with Beta III

    Thanks for following through on this. It appears we are not installing a default esSettings.xml file to the MyGeneration Settings folder. This should be remedied in our next installer. Your "run it at least once" work-around, should hold users until then.

    As to numbers in your table names, I think aliasing them is your best bet to give them legal names in the generated code. I just did a quick and dirty update of this FAQ to cover ES2008, which might help you.

    http://community.entityspaces.net/forums/thread/3168.aspx


    David Neal Parsons
    www.entityspaces.net
  •  05-27-2008, 12:18 AM 9479 in reply to 9475

    Re: Possible template issue (unsure, sorry) with Beta III

    Cheers David - I'll do some aliasing later and see how I get on but unless you hear otherwise then consider this issue closed (for me).

    Cheers

    Martin

  •  06-17-2008, 11:30 AM 9852 in reply to 9479

    Re: Possible template issue (unsure, sorry) with Beta III

    Hi

    Just to feedback I've recompiled the VistaDB metadataprovider Addin to use my installed version and the templates run fine against my Vista databases now so this is completely sorted.

     

    Thanks

    Martin

View as RSS news feed in XML