ssteenkiste / nettiers

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

Serious bug when using multiple data source/connection strings and Views with custom procedures... #336

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Details/ScreenShots in the attached file...

Summary:

Using multiple data source/connection strings causes the XML data in the 
properties file to be incorrectly populated leading to failed code generation. 
Seems to primarily impact code generation where Views are used and there are 
custom stored procedures associated with the View...

Original issue reported on code.google.com by bh...@questis.com on 17 Sep 2010 at 2:18

Attachments:

GoogleCodeExporter commented 9 years ago
Hello,

As a work around please open the csp in notepad and replace all the instances 
of ConnectionString2 with ConnectionString1 and then remove the connection 
string 1 (original node).

I'm not sure what is the best way for us to merge these settings as one might 
want to generate from two databases. The reason this is happening because you 
might want to select different properties from different data sources so 
CodeSmith doesn't enforce the unique source Database for all of the properties.

How do you think this should be implemented with taking the above paragraph 
into consideration.

Thanks
-Blake

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 21 Sep 2010 at 12:07

GoogleCodeExporter commented 9 years ago
I would think the TableList and ViewList XML elements could be demoted to being 
child/children under a node that would represent the source connection string...

For tables...

    <TableListSource connection="ConnectionString1">
        <TableList></TableList>
    </TableListSource>
    <TableListSource connection="ConnectionString2">
        <TableList></TableList>
    </TableListSource>

And for Views...

    <ViewListSource connection="ConnectionString1">
        <ViewList></ViewList>
    </ViewListSource>
    <ViewListSource connection="ConnectionString2">
        <ViewList></ViewList>
    </ViewListSource>

Original comment by bh...@questis.com on 21 Sep 2010 at 5:25

GoogleCodeExporter commented 9 years ago
Also - the idea of having multiple databases - in NetTiers current form at 
least - isn't intuitive since the property panel has a single database 
chosen...  Otherwise that drop-down needs to be a drop-down of elements with 
check-boxes (perhaps) and when display the list of tables/views it should be 
more like a tree-view control (so the user could determine which of the 
selected datasources the table or view was contained within...

Actually... with the tree-view paradigm - the user would just register all of 
the database connections and the whole notion of a 'chosen database' could go 
away...

Original comment by bh...@questis.com on 21 Sep 2010 at 5:28

GoogleCodeExporter commented 9 years ago
Hello,

The problem is with multiple databases is that if the schema changes any how do 
we account for this. In 3.0 there is much more flexibility for this using 
Unity. You could have one entity hit a different database than entity2. At 
least that is what I saw and my understanding :-)

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 21 Sep 2010 at 8:45

GoogleCodeExporter commented 9 years ago
Hello,

I agree with you but this is just a template (we keep them generic as a user 
might want this functionality, but in this case we don't), I guess the template 
could be updated to enforce this... Not really sure of a clean way to do this 
other than checking every database string for each table/view. Ideas?

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 21 Sep 2010 at 8:47

GoogleCodeExporter commented 9 years ago
Outside of trying to actually support multiple databases... I think in this 
case the crux of the problem is that when I use the property pane in CodeSmith 
and picked a different connection string, it simply updated 2 out of 3 
places... rather than all 3... 

Addressing that fixes the problem I encountered...  As far as properly 
supporting multiple data sources... I think each data source is unique and 
hence its structure... if you have Customer on 2 different databases with 2 
different schemas... it's 2 different Services, 2 different Data Entities, 
etc...  the namesspaces wold have to distinguish them...

So in your connection string XML meta-data... the user must provide a 
namespace/qualifier for each distinct connection perhaps? Like naming an ODBC 
data source sort of... 

Original comment by bh...@questis.com on 21 Sep 2010 at 10:14

GoogleCodeExporter commented 9 years ago
And to share some experience... we have a transaction database that is located 
at each physical site... some 60+ instances of the same database (hence same 
schema)... 

So for NetTiers.. I'd say each connection string/data soruce is defining a 
strucutre...  at RUNTIME we used dynamic connections/connection-strings to 
point to one or the other and their schemas BETTER BE in synch!

So above where you talk about if the schemas are different... I think that's a 
different problem that would require an approach where each unique schema must 
be represented individually... 1 connection string/data source == 1 schema...   

If NetTiers were to support multiple schemas within one code generation, the 
properties XML would need some tweaks, the namespaces would need qualifiers, 
etc...

In our case, we just have 2 different code-gens... well 3 actually... 1 for our 
centralized database, 1 for the per-location database, and 1 for the mobile 
hand-held devices running SQL Express... We didn't even try and generate all 3 
as one...

See Issue #252 for where I submitted an issue about trying to share code across 
the 3 different sets of generated code though... 

Original comment by bh...@questis.com on 21 Sep 2010 at 10:20