Jeff-Lewis / codesmith

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

Table and View Selections for PLINQO #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The RegEx method of including/excluding tables and views in PLINQO is a
smart idea, but it does not cover all use cases.  I would like to be able
to manually select tables and views like NetTiers.  The same applies to
Enum tables.  I should not need to modify my table names and add a special
prefix in order to tell the code gen tool which table(s) to process.  The
Linq designer in VS allows a user to select individual tables to add. 
PLINQO should have the same freedom of table choice, but implemented the
same way as NetTiers.

Original issue reported on code.google.com by KevinLa...@gmail.com on 17 Feb 2009 at 8:07

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,  This has been debated back and forth over the life of plinqo.  The primary 
use
case is to have a csp file that generates your data layer, automatically adding 
new
things.  If a table is added or changed, a simple right click generate is all it
takes.  If we have to add new tables explicitly, it would be a pain over time.
Ideally it would be nice to have both scenarios.  However, we felt it was a 
lower
priority in the over all feature set.

Thanks for the feedback! 
~ Paul

Original comment by paul.wel...@gmail.com on 18 Feb 2009 at 12:25

GoogleCodeExporter commented 9 years ago
Hi Paul,

Thanks for your quick response.  I agree that it would be ideal to support both
scenarios.  Note that NetTiers by default will generate all tables in the 
database
unless you specify tables, which still suits the use case you suggest.  I 
picture
that the RegEx box would always be visible and enabled and the table selection 
can
remain an optional selection that expands (pretty much the same as NetTiers 
handles
it).  If the user specifies tables, it overrides the RegEx.

Again, my concern from an architecture standpoint is that I shouldn't need to 
rename
my tables to use my code gen tool.  I realize that I could write a long and
complicated RegEx to manually specify individual tables for exclusion, but that 
just
seems silly.  :-)  For now, I guess that's my best option.

Thanks again for your time and help.

- Kevin

Original comment by KevinLa...@gmail.com on 18 Feb 2009 at 3:34

GoogleCodeExporter commented 9 years ago
This is definitely less than ideal, but I think you could use this regex with 
your
list of tables that you want to include:

^((?!table1|table2|table3).)*$

I agree that we probably should have an IncludeList as well as the current
IgnoreList.  That way you could choose whether you wanted to work on an include 
or
exclude basis.

Original comment by ejsm...@gmail.com on 9 Mar 2009 at 7:00

GoogleCodeExporter commented 9 years ago
For the first time I was asking about the same, but I agree with Paul and I 
remember
my self how problematic this in NetTiers to keep the list up to date, it is much
easier just to get the list of everything from database using sys.tables, views 
and
procedures and then exclude whatever you want to be generated, that works fine 
for
us, we was trying to use complex regex expressions at the beginning, but found 
that
using ignore list with the list of object we want to ignore is much easier.

Original comment by kachalkov on 10 Mar 2009 at 11:49

GoogleCodeExporter commented 9 years ago

Original comment by shannon....@gmail.com on 21 Apr 2009 at 3:57

GoogleCodeExporter commented 9 years ago
I have added a new Property called IncludeList where you can provide regular 
expressions for those items to be included.
By default it has the value .* which means everything is included except the 
IgnoreList - to keep the current default behavior.

To only define those that you want to be included, remove the .* and define 
only your desired includes.

Make sure you don't put them on the IgnoreList too :)

I have attached a patch with this addition.

Happy codding!

Original comment by alonec...@gmail.com on 11 Jun 2010 at 11:45

Attachments:

GoogleCodeExporter commented 9 years ago
The above patch also contains another useful property to define the code from 
your ConnectionString called ConnectionStringCode i.e. I want to pick it up 
from my dynamic AppContext.Instance.ConnectionString.

Original comment by alonec...@gmail.com on 11 Jun 2010 at 11:49

GoogleCodeExporter commented 9 years ago
Hello,

Thanks for the patch we will review it.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 11 Jun 2010 at 4:04

GoogleCodeExporter commented 9 years ago
Hello.  Has the IncludeList feature been added to the nightly builds or are you 
planning on adding this feature?  Thanks.

Original comment by ryan.da...@gmail.com on 14 Sep 2010 at 1:28

GoogleCodeExporter commented 9 years ago
Hello,

It currently has not been added into the templates, we have been looking into a 
better solution to this issue as regex's can become quite complex and requires 
knowledge that may not be known by some consumers of PLINQO. You could specify 
an regex that makes the IgnoreRegex into a Include Regex like this: 

^((?!\b(<tablename>|<tablename>|<tablename>)\b).)*$

You could also apply this patch to the latest templates if you would like by 
using SVN. Please let me know if you need any assistance in doing so.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 15 Sep 2010 at 10:07

GoogleCodeExporter commented 9 years ago
yes, this appears to have been added

Original comment by paul.wel...@gmail.com on 17 Sep 2010 at 2:05