SubSonic is great and helps me code a lot faster, but now I've run into something that I think would help a ton of programmers.
I'm programming against a huge database, but only need about 6 or 7 tables out of the 50 or so tables. The exclude in the Settings.ttinclude requires me to enter the other tables not needed. I would love to have a IncludeTables string array that speeds up the entry of the tables that are required for the application.
Hopefully the team at the SubSonic project already have a patch/fix for this.
[Edited]
I see that v2.2 has includeTableList and whole list of other configuration options. Where do I set these in v3.0.0.2???
I'm no SubSonic expert but if you are using the ActiveRecord t4 templates, you can just edit the template itself.
Look in SQLServer.ttinclude:
const string TABLE_SQL=#"SELECT *
FROM INFORMATION_SCHEMA.TABLES";
Just add a WHERE clause to the above to include only the tables you want.
Sestocker - Thanks for that... I believe that would work, but I have the solution that I want:
In the Settings.ttinclude I have a IncludeTables variable below the ExcludeTables variable:
string[] ExcludeTables = new string[]{
....
};
string[] IncludeTables = new string[]{
....
};
Then I updated the ActiveRecord.tt and Context.tt, changing the code that checks the ExcludeTables:
if(!ExludeTables.Contains(tbl.Name))
....
to this
if(IncludeTables.Contains(tbl.Name))
....
so I made sure that any reference to the "!ExcludeTables" was changed to "IncludeTables".
It generated the classes I needed, but I have not tested it yet.
I'll see if I can work on the t4 templates a bit to have the code work with both Exclude and Include and see if I can post it online later today or tomorrow.
The goal of having T4 templates is so you can do for yourself - not ask us to fix it (not that we mind honestly - but it's easier for you). In this case most people have just a few tables they want to exclude.
That said, in the next rev I'll make the method more generic so you can change it as needed (rather than check an array - I should ask "ShouldGenerate()").
Related
I have a question about using a certian drools functionality in drools decision spreadsheet, that would help a lot in reducing the files and making them more readable.
I can't add more than two links so please downlad this .zip file that includes:
Version1.PNG, Version1.drl, Version2.PNG, Version2.drl, Version3desired.drl
http://s000.tinyupload.com/?file_id=89653236807266194978
So here is the sample rule that we are using right now (something similar)Version1.PNG
And this when converted to a drl gives us the following 193 line long drl file. (Version1.drl)
It is ok and it works well, but after some research we found out we could use the "extends" functionality in drl.
And it works in a drl, what I would like to know is how would I use it in an Excel spreadsheet?
I designed the rule in this way: Version2.PNG
Clearly this is not how "extends" should be used in Excel, since this returns the following drl (Version2.drl)
You can see the extends is inside the "" of the rule name. Makes sense I guess, what I woudl like to know however is, how would I use it correctly? a seperate column? That didn't work, at least not the way I did it.
Does anyone know how It should be done?
The correct DRL that should be made after the Excel is converted is this: (Version3desired.drl)
Thank you for any help :)
Cheers!
There is no gain in using extends with spreadsheets in the way you describe it in your question.
I suggest that you stick to the spreadsheet layout shown in Version1.png. If data entry personnel complains about the dull repetition of 1/7/30 in oodles of rows, teach them how to join cells so they need to type each value only once.
i have been trying to figure out the best way writing custum table view cells.
I have found Lots og post but most talk about doing it with a controller class and a dictionary which uses ticks as a key. This seems very much like a hack and not a pattern i would like to use.
http://www.infoq.com/articles/monotouch-custom-tables
However then i found an alternative:
http://www.alexyork.net/blog/2011/07/18/creating-custom-uitableviewcells-with-monotouch-the-correct-way/
this Seems so much cleaner however a hack is needed to be able to wire up oitlets, described in the comments
However even with this all outlets appear to be null and egen rendering a table using a template with this pattern it is empty.
Does anyone know why ?
I noticed that sitecore has the option of exporting users in an Excel format.
I need to have similar functionality for exporting 'participations', (a users can enlist to take part in an 'event', and if their entry is approved via a sitecore workflow, a 'participation' item is created in the content tree)
Since mostly everything in Sitecore is in essence based on items, and I want to export items to Excel, my question is - what are some of the best ways of doing this?
Questions:
Is there a way to re-use this functionality for regular items?
Would it be a good idea to create a custom admin page (any tips on doing this?) which has some custom code that reads the items from the database using the API?
are there sitecore plugins/shared source projects that can help me achieve this?
Or does anyone have a better idea? - would it be better to just store the participations in SQL? I'm mostly doing it this way because I want to make use of the 'free' functionality offers, for example workflow, but if that leads to me using anti-patterns please shoot me ;)
Link is different now: https://marketplace.sitecore.net/en/Modules/Advanced_System_Reporter.aspx
P.S. Couldn't leave a comment to original answer as I don't have enough reputation. Oh well :)
Found a most excellent shared source module which does exactly this (and much more)!
Basically it allows you to configure (and easily extend, if you need to) any kind of table based report on 'items'.
The report module shows up as an application in the sitecore menu (like the user manager tool) and comes with features such as xml,csv, xls export. It's also really easy to set up, once you get the hang of it.
http://trac.sitecore.net/AdvancedSystemReporter
where do I access the comment field for a core data model to add the "xmod" for mogenerator?
hopefully not too dumb a question - but I just can't see where in my existing Xcode 4 model (*.xcdatamodel) to put the "xmod" to get mogenerator working
(reference https://github.com/rentzsch/mogenerator )
Xmo'd currently doesn't work with Xcode4. It is a .pbplugin and Apple removed support for them in Xcode4. There was a couple guys working on a new way of doing it, but I haven't seen any updates in awhile on it.
You can still use the AppleScript and command line though. You just have to manually trigger it and add the files. You lose the automation that Xmo'd gave you. Also, Xmo'd still works in Xcode3. So you can switch over to it when doing your modeling if you really wanted to.
SubSonic newbe question;
I want to put custom attributes on properties in the generated classes, is that possible?
It's definitely possible. Is this SubSonic 2 or 3? It's doable for either one, but the question of where to find the templates is different depending on which one you're using.
Edit: For SubSonic 2, follow this link and look at the entry on "templateDirectory". For SubSonic 3, you probably have some .tt files in your VS Project you can mess with.
There's two ways to do this:
If you want to add them at generation time you can do what Skinniest Man suggests and modify the templates to add them.
If you want to add them manually things are a little more tricky and you'll need to create a 'buddy class' and apply your custom attributes to that. You can see an example for data annotations here which should illustrate the concept.