zengcheng / codesmith

Automatically exported from code.google.com/p/codesmith
0 stars 0 forks source link

Problems generating PLINQO-NH using ADOXSchemaExplorer and Access #692

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When you try to generate a project from CSGE using the ADOSchemaExplorer and 
select an Access Database there are some issues:

1.  When you select the "SourceDatabase" is puts the "ConnectionString" in all 
the fields of the QuickStart dialog including SourceDatabase, Location, 
SolutionName, DataContextName, DataProjectName, and WebProjectName.

2.  When it tries to generate the hbm's it chokes when I have a foreign key on 
a table.  I get the following error:

C:\Development\Sandlot\dotNet\LSInternal\LSInternal.Data\Entities.csp(0,0) 
Object reference not set to an instance of an object.
Stack Trace:
   at SchemaExplorer.MemberColumnSchema.get_Table()
   at SchemaExplorer.ColumnSchema.#dxe()
   at CodeSmith.SchemaHelper.TableAssociation.FromChildPrimaryKey(TableEntity source, ITableKeySchema tableKeySchema)
   at CodeSmith.SchemaHelper.TableEntity.GetChildAssociations()
   at CodeSmith.SchemaHelper.TableEntity.LoadAssociations()
   at CodeSmith.SchemaHelper.TableEntity.Initialize()
   at CodeSmith.SchemaHelper.SchemaExplorerEntityProvider.Initialize(TableSchemaCollection tables, ViewSchemaCollection views, CommandSchemaCollection commands)
   at CodeSmith.SchemaHelper.SchemaExplorerEntityProvider.Load()
   at CodeSmith.SchemaHelper.EntityManager..ctor(IEntityProvider provider)
   at _CodeSmith.Hbms_cst.CreateEntityManager()
   at _CodeSmith.Hbms_cst.Generate()
   at _CodeSmith.Hbms_cst.__RenderMethod1(TextWriter writer, Control control)
   at CodeSmith.Engine.DelegateControl.Render(TextWriter writer)
   at CodeSmith.Engine.Control.RenderChildren(TextWriter writer)
   at CodeSmith.Engine.Control.Render(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.Render(TextWriter writer)
   at CodeSmith.Engine.CodeTemplate.RenderToString()
   at CodeSmith.Engine.ProjectCodeGenerator.GenerateCode(CodeSmithProject project)

Unable to render output Hbms, skipping...

3.  It improperly id's an "Autonumber" primary as <generator class="assigned" 
/> when it should be "identity".

These are just the initial issues I've found.

Thanks

David Logan

Original issue reported on code.google.com by ibflyfis...@yahoo.com on 28 Aug 2013 at 4:50

GoogleCodeExporter commented 9 years ago
One other issue that I've found is that something is added a new entry in the 
"Data Source Manager" using the ConnectionString as the Name instead of the one 
that was actually indicated in the dialog box.

Original comment by ibflyfis...@yahoo.com on 28 Aug 2013 at 4:55

GoogleCodeExporter commented 9 years ago
1. I'm not sure what we could do here. We are using the DatabaseName property 
to populate these fields. The ADOX Schema Provider is very generic and there's 
really no way to know what to parse / get the database name because that 
provider can be used with so many different vendors.

2. I'm not sure how much we can do to fix this issue on our end without a 
database to test with. The ADOX Schema Provider is a very generic provider (so 
it will be interesting what needs to change).

3. This is a bug and will need to be updated in the templates.

Original comment by bniemyjski on 28 Aug 2013 at 6:48

GoogleCodeExporter commented 9 years ago
I attached the access database I have.  It is very simple and only had 3 tables 
in it.  I'll look into #1 and see what I find.

Original comment by ibflyfis...@yahoo.com on 28 Aug 2013 at 7:40

Attachments: